Documentation
¶
Overview ¶
Package t1build assembles a Type 1 font program in the PFA form from nothing, for tests.
It exists for the reason internal/cffbuild does: a test that needs a font either redistributes one it may not, skips in a clone, or builds what it needs, and font and render/native both need the same bytes.
The program is laid out the way the producers in the corpus write one: a clear-text font dictionary ending in "currentfile eexec", then the binary eexec-encrypted Private dictionary, Subrs, and CharStrings, with no trailer, since a PDF's FontFile carries none.
Not in a _test.go file, because an internal package cannot export from one. Internal so it cannot become part of the module's surface by accident.
On the overflow annotations below ¶
A charstring's number forms and the cipher are defined on the bits of a value cast down to a byte, and a scanner reads each cast as a possible overflow. The annotations carry this one explanation; every input is a literal or a small value from this file or a caller's test data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
Glyphs []Glyph
Subrs [][]byte // plain; a nil entry leaves that index undefined
// Encoding is the built-in encoding, code to glyph name; nil writes StandardEncoding.
Encoding map[byte]string
// NoEncoding omits the /Encoding key entirely, for a font that declares none. Encoding is
// ignored when this is set.
NoEncoding bool
// NoCharStrings omits the /CharStrings key entirely, for a font that declares none. Glyphs
// and CharStringsExtra are ignored when this is set.
NoCharStrings bool
// LenIV, when set, is written as /lenIV and used for the Subrs and CharStrings; otherwise
// the default of 4 is used and no key is written.
LenIV *int
FontMatrix string // the /FontMatrix value; empty writes [0.001 0 0 0.001 0 0]
// FontExtra and PrivateExtra are PostScript written verbatim at the end of the clear-text
// font dictionary and at the start of the Private dictionary.
FontExtra, PrivateExtra string
// CharStringsExtra is written verbatim after the last CharStrings entry, before its end.
CharStringsExtra string
}
Builder describes a program. The zero value of each field is the ordinary choice.
type Op ¶
type Op int
Op is a Type 1 charstring operator. An escaped operator is 1200 plus its second byte.
const ( HStem Op = 1 VStem Op = 3 VMoveTo Op = 4 RLineTo Op = 5 HLineTo Op = 6 VLineTo Op = 7 RRCurveTo Op = 8 ClosePath Op = 9 CallSubr Op = 10 Return Op = 11 HSBW Op = 13 EndChar Op = 14 RMoveTo Op = 21 HMoveTo Op = 22 VHCurveTo Op = 30 HVCurveTo Op = 31 DotSection Op = 1200 VStem3 Op = 1201 HStem3 Op = 1202 Seac Op = 1206 SBW Op = 1207 Div Op = 1212 CallOtherSubr Op = 1216 Pop Op = 1217 SetCurrentPoint Op = 1233 )