freetype icon indicating copy to clipboard operation
freetype copied to clipboard

Expose ascent and descent in truetype.Font.

Open GoogleCodeExporter opened this issue 10 years ago • 7 comments

These are needed to figure out line height and the height for the background of 
highlighted text. Font.Bounds().YMin and YMax don't work; they are too large. 
Instead we need ascent and descent from the hhea table.

Original issue reported on code.google.com by [email protected] on 16 Feb 2015 at 8:13

GoogleCodeExporter avatar Aug 11 '15 04:08 GoogleCodeExporter

linegap would be nice too.

Original comment by [email protected] on 16 Feb 2015 at 8:53

GoogleCodeExporter avatar Aug 11 '15 04:08 GoogleCodeExporter

I second this notion.

stephenwithav avatar Aug 22 '15 22:08 stephenwithav

Mind if I tackle this one in the near future, @nigeltao?

stephenwithav avatar Sep 21 '15 09:09 stephenwithav

Sure, have at it, although there might be implications for what we want to do for the x/image/font package wrt exposing ascent / descent / height in a uniform way across all font formats, not just the truetype font format. That's the "TODO: per-font Metrics" in https://go.googlesource.com/image/+/master/font/font.go

nigeltao avatar Sep 22 '15 02:09 nigeltao

Has there been any/much discussion on how to expose them that I can look at before starting?

stephenwithav avatar Sep 22 '15 22:09 stephenwithav

No, no discussion yet.

nigeltao avatar Sep 23 '15 01:09 nigeltao

Maybe deprecate this code in favor of https://godoc.org/golang.org/x/image/font#Metrics ? I was able to successfully render text with just x/image/font, so this library seems to no longer be needed.

tv42 avatar Nov 21 '20 01:11 tv42