swash icon indicating copy to clipboard operation
swash copied to clipboard

Use ttf-parser for font parsing

Open notgull opened this issue 1 year ago • 5 comments

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.

notgull avatar May 03 '23 13:05 notgull

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.

dfrg avatar Jun 22 '23 15:06 dfrg

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?

Maximkaaa avatar Feb 21 '24 08:02 Maximkaaa

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

dfrg avatar Feb 21 '24 15:02 dfrg

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).

Maximkaaa avatar Feb 21 '24 16:02 Maximkaaa

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

dfrg avatar Feb 22 '24 16:02 dfrg