From 486e1683dde5aafeb37ba8a979d4c893a098e717 Mon Sep 17 00:00:00 2001 From: R?my Oudompheng Date: Fri, 25 Oct 2013 11:01:57 +1100 Subject: [PATCH] freetype/truetype: handle control value cut-in in MIRP. The difference is quite large on glyph 509 (period character) of Adobe Source Sans Pro Bold Italic. R=golang-dev, nigeltao, bsiegert CC=golang-dev https://codereview.appspot.com/16820043 Committer: Nigel Tao --- freetype/truetype/hint.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/freetype/truetype/hint.go b/freetype/truetype/hint.go index e7b6d11..1312f54 100644 --- a/freetype/truetype/hint.go +++ b/freetype/truetype/hint.go @@ -1023,7 +1023,11 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, // TODO: metrics compensation. distance := cvtDist if opcode&0x04 != 0 { - distance = h.round(cvtDist) + // The CVT value is only used if close enough to oldDist. + if (cvtDist - oldDist).abs() > h.gs.controlValueCutIn { + distance = oldDist + } + distance = h.round(distance) } // Minimum distance bit.