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

Open
sbinet opened this issue Oct 26, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@sbinet
Copy link
Member

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

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2017

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link

commented Oct 27, 2017

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

font/opentype: implement font.Face interface
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

This comment has been minimized.

Copy link
Contributor

commented Feb 9, 2018

What's up on this issue? Thank you!

@nigeltao

This comment has been minimized.

Copy link
Contributor

commented Feb 9, 2018

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

@sbinet

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link

commented Apr 3, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.