Skip to content

Fill property not being respected on text #1038

@OptimisticPeach

Description

@OptimisticPeach

I apologize if another issue already covers this; I'm not super knowledgeable about the SVG spec, so I'm not quite sure what should cover this.

I've got an SVG with coloured text, generated by Typst:
Image

(Hopefully you should be able to use the above to get back an SVG file? If not let me know and I'll figure out another way -- perhaps a zip file?)

As you can see in the GitHub preview, the text is white & red, however when rendered with resvg, I get:

Image

I'm not entirely sure if this is an error on my part, or if this is a bug in resvg.

My code essentially amounts to:

let tree = Tree::from_data(svg.as_bytes(), &Options::default())?;
let mut buffer = Pixmap::new(...);

buffer.data_mut().fill(0); // resetting from a previous render

let size = tree.size();

let transform = Transform::from_scale(
    buffer.width() as f32 / size.width(),
    buffer.height() as f32 / size.height(),
);

resvg::render(
    &tree,
    transform,
    &mut buffer,
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions