Go: x/image/font/sfnt: implement font.Face

Created on 26 Oct 2017  ·  13Comments  ·  Source: golang/go

To ease the migration from github.com/golang/freetype/truetype to golang.org/x/image/font/sfnt, it would be valuable to have font/sfnt provide a type that implements font.Face on top of the sfnt facilities.

with https://golang.org/cl/67330 it seems possible to implement most of the font.Face interface.

truetype does it via NewFace.
I'd propose to do the same with a new sfnt.NewFace function:

// NewFace returns a new font.Face for the given Font.
func NewFace(f *Font) font.Face { ... }

@nigeltao what do you think ?

NeedsFix

Most helpful comment

Change https://golang.org/cl/240897 mentions this issue: x/image/font: Implement font Face in the opentype package.

All 13 comments

There totally needs to be a font.Face implementation somewhere under golang.org/x/image/sfnt, either using or being part of golang.org/x/image/font/sfnt. I just haven't had the time to do it myself.

I was thinking it would be a separate package, perhaps golang.org/x/image/font/opentype, so that people could import just the sfnt package if they wanted e.g. metrics and layout without having to pull in all of the rasterization code. But I haven't given a lot of thought to it.

I have mailed what I got so far: https://go-review.googlesource.com/#/c/image/+/73870
(I can of course put all the current font.Face implementation under this new font/opentype package)

Change https://golang.org/cl/73870 mentions this issue: font/sfnt: implement font.Face interface

What's up on this issue? Thank you!

That's for @sbinet to answer. I don't have any time to work on this myself.

CL-73870 didn't close this issue as the Glyph and GlyphBounds methods are left basically unimplemented.

I did try a bit to see how one would go with implementing them but I quickly reached my level of incompetence. (sorry.)

happy to get some more insights on how I would go about implementing those. (or encourage a new champion to do that)

Change https://golang.org/cl/170578 mentions this issue: font/opentype: implement Glyph and GlyphBounds

Hi, what's going on this?

I can't speak for others, but for myself, I'll repeat what I've said before: I'd like to see this happen, but I don't have any time to work on this myself.

See also https://go-review.googlesource.com/c/image/+/170578 "font/opentype: implement Glyph and GlyphBounds" which is incomplete and abandoned, but might be educational for anyone who wants to tackle this themselves.

Change https://golang.org/cl/217817 mentions this issue: image/font: implement Glyph and GlyphBounds

Change https://golang.org/cl/240897 mentions this issue: x/image/font: Implement font Face in the opentype package.

Change https://golang.org/cl/255237 mentions this issue: font/opentype: implement Glyph and GlyphBounds

Was this page helpful?
0 / 5 - 0 ratings