linebender / resvg

An SVG rendering library.
Apache License 2.0
2.84k stars 229 forks source link

Support embedded fonts via @font-face #541

Open RazrFalcon opened 2 years ago

RazrFalcon commented 2 years ago

Requires WOFF/WOFF2 support first...

yisibl commented 2 years ago

We have used woff2-rs in our product, which may not be perfect, but is basically usable.

theofficialgman commented 1 year ago

also interested in this as a feature

LaurenzV commented 7 months ago

@RazrFalcon would you accept an implementation that uses the woff2-rs crate?

LaurenzV commented 7 months ago

Or should we rather work towards adding support in ttf-parser?

RazrFalcon commented 7 months ago

Yes, that's a good start. The only issue with woff2-rs is thiserror...

Note that we have to rewrite fontdb handling first, because usvg accepts a non-mutable reference. We would have to populate fontdb with embedded fonts and then remove those fonts after usvg is finished.

I'm not even sure if we're capable of parsing @font-face at all.

If you have any ideas - I'm interested in hearing them.

As always, there is nothing simple when it comes to SVG.

LaurenzV commented 7 months ago

I'm not even sure if we're capable of parsing @font-face at all.

How so?

RazrFalcon commented 7 months ago

Because we use simplecss and it doesn't support at-rules.

LaurenzV commented 7 months ago

Right...

maielo commented 3 months ago

+1