From a021a5f23e82e49245485ce04e57da64b1c1edac Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 24 Aug 2015 16:17:16 +1000 Subject: [PATCH] Rename Kerning to Kern. --- example/truetype/main.go | 2 +- freetype.go | 2 +- truetype/face.go | 2 +- truetype/truetype.go | 5 +++-- truetype/truetype_test.go | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) 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()