WIP: Replace freetype with sfnt
DO NOT SUBMIT
I'd like to see if I can get the opentype changes merged upstream first. I'm not sure if the changes are general enough. Also, I'm not sure if this fixes #17 because sfnt docs state this:
It is valid to re-use a *Buffer with multiple Font method calls, even with different *Font receivers, as long as they are not concurrent calls.
All of the Font methods are safe to call concurrently, as long as each call has a different *Buffer (or nil).
The Font methods that don't take a *Buffer argument are always safe to call concurrently.
So, I think either opentype or duitdraw needs a lock?
Very nice! It would be great to merge it upstream.
I'd be willing to review those :)
migrating gonum/plot to drop freetype (and use font.Face) has been on my want-to list for the longest time...
This is the CL: https://go-review.googlesource.com/c/image/+/170578
@fhs thanks a ton for this!! Could you maybe give us a rough summary of where the CL is hanging before I try to load the review discussion in my head? :sweat_smile:
If you rather let someone else take a stab at finishing it that is more than fine (it's quite a complex thing after all) was just sad to see it stalled.
Sorry I didn't get around to finishing this. The CL I created probably works well enough for duitdraw's needs, but it gets a lot of details wrong. It doesn't compute glyph bounds correctly. Unlike Plan 9 fonts, the glyphs can actually overlap each other, as I understand it. Also, I don't take into account sub-pixels.
I'd be glad if someone else finishes the CL. Freetype can be used as reference, and it may be as simple as copying stuff from it.
Cool, thanks for the overview! That was very helpful to understand where it's at and your suggestion seems feasable enough even without a solid background in text rendering.
I don't want to get to specific with time commitments but I have a project in the back of my mind that could really use this... stay tuned? 🙃