x/image/font/opentype: Face.Kern
always returns the same value
#46727
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I parsed the
arial.ttf
font on my Windows 10 machine and attempted to use theFace.Kern
method to adjust the horizontal position of some glyphs as I rendered them.(
Face.Kern
: https://pkg.go.dev/golang.org/x/image@v0.0.0-20210607152325-775e3b0c77b9/font/opentype#Face.Kern)What did you expect to see?
I expected to see
Face.Kern
return a different value based on the size of the font face being used.What did you see instead?
I always see the same number for a given pair of characters being returned regardless of the size of the font face being used.
I'm not sure if this is intended or not, but given that other methods on
Face
, for example,GlyphBounds
, return different values based on the size of the face being used, I assumed thatFace.Kern
should do the same.I brought this up as an issue here: hajimehoshi/ebiten#1671, where @hajimehoshi pointed out that it's being used without any additional scaling here: https://cs.opensource.google/go/x/image/+/775e3b0c:font/font.go;l=228;drc=3f4726a040e860b3702c9dab9e3b94cad413328f, which also leads me to believe that
Face.Kern
always returning the same number for a given pair of glyphs isn't the expected behaviour.As can be seen in my linked issue in the Ebiten repo, my current workaround is to scale it myself:
I'm not sure if this is actually an accurate way to do it since I don't know much about fonts myself, but it seems to work for me for now.
If this is actually the intended behaviour then a bit more documentation explaining that it needs to be scaled by the user would be helpful, but based on what I've seen so far I'm guessing this is actually a bug.
The text was updated successfully, but these errors were encountered: