diff --git a/example/truetype/main.go b/example/truetype/main.go index ff9d27f..6ab93fc 100644 --- a/example/truetype/main.go +++ b/example/truetype/main.go @@ -76,5 +76,5 @@ func main() { fmt.Printf("AdvanceWidth:%d LeftSideBearing:%d\n", hm.AdvanceWidth, hm.LeftSideBearing) printGlyph(g) i1 := f.Index(c1) - fmt.Printf("\n'%c', '%c' Kerning:%d\n", c0, c1, f.Kerning(fupe, i0, i1)) + fmt.Printf("\n'%c', '%c' Kern:%d\n", c0, c1, f.Kern(fupe, i0, i1)) } diff --git a/freetype.go b/freetype.go index ac1de50..885de24 100644 --- a/freetype.go +++ b/freetype.go @@ -235,7 +235,7 @@ func (c *Context) DrawString(s string, p fixed.Point26_6) (fixed.Point26_6, erro for _, rune := range s { index := c.f.Index(rune) if hasPrev { - kern := c.f.Kerning(c.scale, prev, index) + kern := c.f.Kern(c.scale, prev, index) if c.hinting != font.HintingNone { kern = (kern + 32) &^ 63 } diff --git a/truetype/face.go b/truetype/face.go index 2c1beb3..e947ad9 100644 --- a/truetype/face.go +++ b/truetype/face.go @@ -98,7 +98,7 @@ func (a *face) Close() error { return nil } func (a *face) Kern(r0, r1 rune) fixed.Int26_6 { i0 := a.f.Index(r0) i1 := a.f.Index(r1) - kern := a.f.Kerning(a.scale, i0, i1) + kern := a.f.Kern(a.scale, i0, i1) if a.hinting != font.HintingNone { kern = (kern + 32) &^ 63 } diff --git a/truetype/truetype.go b/truetype/truetype.go index ebc36e6..7e0a1e7 100644 --- a/truetype/truetype.go +++ b/truetype/truetype.go @@ -420,8 +420,9 @@ func (f *Font) VMetric(scale fixed.Int26_6, i Index) VMetric { return v } -// Kerning returns the kerning for the given glyph pair. -func (f *Font) Kerning(scale fixed.Int26_6, i0, i1 Index) fixed.Int26_6 { +// Kern returns the horizontal adjustment for the given glyph pair. A positive +// kern means to move the glyphs further apart. +func (f *Font) Kern(scale fixed.Int26_6, i0, i1 Index) fixed.Int26_6 { if f.nKern == 0 { return 0 } diff --git a/truetype/truetype_test.go b/truetype/truetype_test.go index 06b2d5d..0f3253d 100644 --- a/truetype/truetype_test.go +++ b/truetype/truetype_test.go @@ -59,8 +59,8 @@ func TestParse(t *testing.T) { if got, want := f.VMetric(fupe, i0), (VMetric{2465, 553}); got != want { t.Errorf("VMetric: got %v, want %v", got, want) } - if got, want := f.Kerning(fupe, i0, i1), fixed.Int26_6(-144); got != want { - t.Errorf("Kerning: got %v, want %v", got, want) + if got, want := f.Kern(fupe, i0, i1), fixed.Int26_6(-144); got != want { + t.Errorf("Kern: got %v, want %v", got, want) } g := NewGlyphBuf()