Rename Kerning to Kern.

This commit is contained in:
Nigel Tao 2015-08-24 16:17:16 +10:00
parent db77c6a161
commit a021a5f23e
5 changed files with 8 additions and 7 deletions

View File

@ -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))
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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()