duitdraw icon indicating copy to clipboard operation
duitdraw copied to clipboard

WIP: Replace freetype with sfnt

Open fhs opened this issue 7 years ago • 6 comments

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?

fhs avatar Apr 02 '19 23:04 fhs

Very nice! It would be great to merge it upstream.

ktye avatar Apr 03 '19 06:04 ktye

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

sbinet avatar Apr 03 '19 07:04 sbinet

This is the CL: https://go-review.googlesource.com/c/image/+/170578

fhs avatar Apr 03 '19 16:04 fhs

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

cryptix avatar Jun 12 '19 08:06 cryptix

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.

fhs avatar Jun 12 '19 16:06 fhs

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? 🙃

cryptix avatar Jun 12 '19 17:06 cryptix