font/sfnt: implement rrcurveto.
Change-Id: I2e24293568b296dd916b2ef6a9c1113ffd5f9253 Reviewed-on: https://go-review.googlesource.com/34171 Reviewed-by: Dave Day <djd@golang.org>
This commit is contained in:
parent
ce50dba65c
commit
88b013251f
|
@ -548,7 +548,7 @@ var psOperators = [...][2][]psOperator{
|
|||
5: {-1, "rlineto", t2CRlineto},
|
||||
6: {-1, "hlineto", t2CHlineto},
|
||||
7: {-1, "vlineto", t2CVlineto},
|
||||
8: {}, // rrcurveto.
|
||||
8: {-1, "rrcurveto", t2CRrcurveto},
|
||||
9: {}, // Reserved.
|
||||
10: {}, // callsubr.
|
||||
11: {}, // return.
|
||||
|
@ -834,6 +834,23 @@ func t2CVcurveto(p *psInterpreter, i int32) (j int32) {
|
|||
return i
|
||||
}
|
||||
|
||||
func t2CRrcurveto(p *psInterpreter) error {
|
||||
if !p.type2Charstrings.seenWidth || p.stack.top < 6 || p.stack.top%6 != 0 {
|
||||
return errInvalidCFFTable
|
||||
}
|
||||
for i := int32(0); i != p.stack.top; i += 6 {
|
||||
t2CAppendCubeto(p,
|
||||
p.stack.a[i+0],
|
||||
p.stack.a[i+1],
|
||||
p.stack.a[i+2],
|
||||
p.stack.a[i+3],
|
||||
p.stack.a[i+4],
|
||||
p.stack.a[i+5],
|
||||
)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func t2CEndchar(p *psInterpreter) error {
|
||||
t2CReadWidth(p, 0)
|
||||
if p.stack.top != 0 || len(p.instructions) != 0 {
|
||||
|
|
|
@ -125,6 +125,20 @@ func TestPostScript(t *testing.T) {
|
|||
lineTo(300, 0),
|
||||
lineTo(300, 800),
|
||||
lineTo(100, 800),
|
||||
}, {
|
||||
// Q
|
||||
// - contour #0
|
||||
moveTo(657, 237),
|
||||
lineTo(289, 387),
|
||||
lineTo(519, 615),
|
||||
// - contour #1
|
||||
moveTo(792, 169),
|
||||
cubeTo(867, 263, 926, 502, 791, 665),
|
||||
cubeTo(645, 840, 380, 831, 228, 673),
|
||||
cubeTo(71, 509, 110, 231, 242, 93),
|
||||
cubeTo(369, -39, 641, 18, 722, 93),
|
||||
lineTo(802, 3),
|
||||
lineTo(864, 83),
|
||||
}, {
|
||||
// uni4E2D
|
||||
// - contour #0
|
||||
|
|
BIN
font/testdata/CFFTest.otf
vendored
BIN
font/testdata/CFFTest.otf
vendored
Binary file not shown.
30
font/testdata/CFFTest.sfd
vendored
30
font/testdata/CFFTest.sfd
vendored
|
@ -19,7 +19,7 @@ OS2Version: 0
|
|||
OS2_WeightWidthSlopeOnly: 0
|
||||
OS2_UseTypoMetrics: 1
|
||||
CreationTime: 1479626795
|
||||
ModificationTime: 1480661567
|
||||
ModificationTime: 1481282599
|
||||
PfmFamily: 17
|
||||
TTFWeight: 400
|
||||
TTFWidth: 5
|
||||
|
@ -48,11 +48,11 @@ NameList: Adobe Glyph List
|
|||
DisplaySize: -24
|
||||
AntiAlias: 1
|
||||
FitToEm: 1
|
||||
WinInfo: 19712 32 23
|
||||
WinInfo: 64 32 11
|
||||
BeginPrivate: 0
|
||||
EndPrivate
|
||||
TeXData: 1 0 0 346030 173015 115343 0 1048576 115343 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
|
||||
BeginChars: 65536 3
|
||||
BeginChars: 65536 4
|
||||
|
||||
StartChar: zero
|
||||
Encoding: 48 48 0
|
||||
|
@ -120,5 +120,29 @@ SplineSet
|
|||
EndSplineSet
|
||||
Validated: 1
|
||||
EndChar
|
||||
|
||||
StartChar: Q
|
||||
Encoding: 81 81 3
|
||||
Width: 1000
|
||||
VWidth: 0
|
||||
Flags: W
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
657 237 m 0
|
||||
519 615 l 0
|
||||
289 387 l 0
|
||||
657 237 l 0
|
||||
792 169 m 1
|
||||
864 83 l 25
|
||||
802 3 l 21
|
||||
722 93 l 1
|
||||
641 18 369 -39 242 93 c 0
|
||||
110 231 71 509 228 673 c 24
|
||||
380 831 645 840 791 665 c 0
|
||||
926 502 867 263 792 169 c 1
|
||||
EndSplineSet
|
||||
Validated: 33
|
||||
EndChar
|
||||
EndChars
|
||||
EndSplineFont
|
||||
|
|
Loading…
Reference in New Issue
Block a user