Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/image/font/sfnt: implement font.Face #22451

Closed
sbinet opened this issue Oct 26, 2017 · 13 comments
Closed

x/image/font/sfnt: implement font.Face #22451

sbinet opened this issue Oct 26, 2017 · 13 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@sbinet
Copy link
Member

sbinet commented Oct 26, 2017

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 ?

@gopherbot gopherbot added this to the Unreleased milestone Oct 26, 2017
@nigeltao
Copy link
Contributor

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.

@sbinet
Copy link
Member Author

sbinet commented Oct 27, 2017

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)

@gopherbot
Copy link

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

gopherbot pushed a commit to golang/image that referenced this issue Dec 8, 2017
This CL adds the type Face that implements the font.Face interface.
This CL also adds tests using gofont/goregular as an input font, using
github.com/golang/freetype/truetype as reference values.

Updates golang/go#22451.

Change-Id: I2a6945309331b251ec2ddec95b6e809ad10aa116
Reviewed-on: https://go-review.googlesource.com/73870
Reviewed-by: Nigel Tao <nigeltao@golang.org>
@hajimehoshi
Copy link
Member

What's up on this issue? Thank you!

@nigeltao
Copy link
Contributor

nigeltao commented Feb 9, 2018

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

@sbinet
Copy link
Member Author

sbinet commented Feb 13, 2018

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)

@gopherbot
Copy link

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

@hajimehoshi
Copy link
Member

Hi, what's going on this?

@nigeltao
Copy link
Contributor

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.

@nigeltao
Copy link
Contributor

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.

@gopherbot
Copy link

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

@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 13, 2020
@gopherbot
Copy link

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

joeblubaugh added a commit to joeblubaugh/image that referenced this issue Jul 13, 2020
Implementing font.Face allows sfnt-parsed fonts to be used in code that
uses DrawString, DrawRune, etc.
Fixes a bug in sfnt GlyphBounds when the advance-width table is
truncated.
Adds an updated source link for font measurement terms.

Fixes golang/go#22451

Change-Id: Ie3a434c2b4c5152e72cd6a992f853725658101bb
@gopherbot
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants