提交 02a88bab 编写于 作者: N Nigel Tao

freetype/truetype: fix SHC, MIRP opcodes.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/33750043
上级 5a5d1174
...@@ -545,7 +545,7 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, ...@@ -545,7 +545,7 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point,
case opSHC0, opSHC1: case opSHC0, opSHC1:
top-- top--
_, _, d, ok := h.displacement(opcode&1 == 0) zonePointer, i, d, ok := h.displacement(opcode&1 == 0)
if !ok { if !ok {
return errors.New("truetype: hinting: point out of range") return errors.New("truetype: hinting: point out of range")
} }
...@@ -557,12 +557,15 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, ...@@ -557,12 +557,15 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point,
if contour < 0 || len(ends) <= int(contour) { if contour < 0 || len(ends) <= int(contour) {
return errors.New("truetype: hinting: contour out of range") return errors.New("truetype: hinting: contour out of range")
} }
j0, j1 := 0, h.ends[contour] j0, j1 := int32(0), int32(h.ends[contour])
if contour > 0 { if contour > 0 {
j0 = h.ends[contour-1] j0 = int32(h.ends[contour-1])
} }
move := h.gs.zp[zonePointer] != h.gs.zp[2]
for j := j0; j < j1; j++ { for j := j0; j < j1; j++ {
h.move(h.point(2, current, int32(j)), d, false) if move || j != i {
h.move(h.point(2, current, j), d, false)
}
} }
case opSHZ0, opSHZ1: case opSHZ0, opSHZ1:
...@@ -1149,7 +1152,9 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, ...@@ -1149,7 +1152,9 @@ func (h *Hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point,
distance := cvtDist distance := cvtDist
if opcode&0x04 != 0 { if opcode&0x04 != 0 {
// The CVT value is only used if close enough to oldDist. // The CVT value is only used if close enough to oldDist.
if (cvtDist - oldDist).abs() > h.gs.controlValueCutIn { if (h.gs.zp[0] == h.gs.zp[1]) &&
((cvtDist - oldDist).abs() > h.gs.controlValueCutIn) {
distance = oldDist distance = oldDist
} }
distance = h.round(distance) distance = h.round(distance)
......
...@@ -255,7 +255,7 @@ var scalingTestCases = []struct { ...@@ -255,7 +255,7 @@ var scalingTestCases = []struct {
hintingBrokenAt int hintingBrokenAt int
}{ }{
{"luxisr", 12, -1}, {"luxisr", 12, -1},
{"x-arial-bold", 11, 94}, {"x-arial-bold", 11, 130},
{"x-deja-vu-sans-oblique", 17, -1}, {"x-deja-vu-sans-oblique", 17, -1},
{"x-droid-sans-japanese", 9, 0}, {"x-droid-sans-japanese", 9, 0},
{"x-times-new-roman", 13, 0}, {"x-times-new-roman", 13, 0},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册