typst / typst

A new markup-based typesetting system that is powerful and easy to learn.
https://typst.app
Apache License 2.0
32.93k stars 885 forks source link

OpenType-SVG should respect currentColor #4973

Open jkwchui opened 1 week ago

jkwchui commented 1 week ago

Description

This is for the dev version 0.11.1, which has OpenType-SVG support.

The SVG glyphs can contain fill or strokes with currentColor (spec). These should receive color attributes from Typst markup; instead, it currently stays black and all the colors inside the SVG is impossible to change.

Reproduction URL

No response

Operating system

macOS

Typst version

Enivex commented 1 week ago

Duplicate of https://github.com/typst/typst/issues/1939

jkwchui commented 1 week ago

I don't think this is a duplicate. #1939 is about general rendering and changing colors in SVG, and involves inventing an API within Typst; it's a feature request. This is a meeting a specification of a format that Typst (intends to) support (hence a bug-fix), and could be as simple as pre-processing the SVG prior to passing into usvg with the text-color substituted into currentColor.

Enivex commented 1 week ago

I don't think this is a duplicate. #1939 is about general rendering and changing colors in SVG, and involves inventing an API within Typst; it's a feature request. This is a meeting a specification of a format that Typst (intends to) support (hence a bug-fix), and could be as simple as pre-processing the SVG prior to passing into usvg with the text-color substituted into currentColor.

See the discussion in the two last replies.

That being said, maybe @LaurenzV could chime in.

LaurenzV commented 1 week ago

Yes, this is a bit different.

LaurenzV commented 1 week ago

This is blocked by https://github.com/RazrFalcon/resvg/issues/768, though.

LaurenzV commented 1 week ago

@jkwchui Do you happen to know any fonts that use that feature, so I can try it? I haven't been able to find one...

jkwchui commented 1 week ago

I can send you one; let me try to find your email.

LaurenzV commented 1 week ago

All good, I've managed to make one myself now, but thanks! 😄