dfrg / swash

Font introspection, complex text shaping and glyph rendering.
Apache License 2.0
584 stars 34 forks source link

Use ttf-parser for font parsing #36

Open notgull opened 1 year ago

notgull commented 1 year ago

I see that this crate uses its own code for TTF parsing. Is there a reason why ttf-parser isn't used here? It has no dependencies and is written in exclusively safe code.

dfrg commented 1 year ago

The primary value proposition of swash is support for hinting which is not possible to implement on top of ttf-parser without significant architectural changes to that crate.

Maximkaaa commented 4 months ago

I don't know much about how fonts work, but it seems that rustybuzz implement hinting even though they use ttf-parser for font loading. Or is it related to performance considerations?

dfrg commented 4 months ago

Rustybuzz implements shaping. AFAIK swash is the only rust library with full support for hinting.

Maximkaaa commented 4 months ago

Yeah, sorry, I completely misunderstood things. The more I understand about text rendering the more I understand that I don't understand more than I understand...

The source of my confusion was that I saw a reference to ttf-parser HintDevice and thought they use it (though they clearly don't since they don't do rasterizing).

dfrg commented 4 months ago

Yes, text rendering is a very deep rabbit hole :)