Documentation ¶
Overview ¶
Package cff implements reading and writing of CFF fonts.
CFF fonts are typically embedded in OpenType font files, rather than being used as stand-alone font files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StandardEncoding ¶
StandardEncoding returns the encoding vector for the standard encoding. The result can be used for the `Outlines.Encoding` field.
Types ¶
type FDSelectFn ¶ added in v0.3.4
FDSelectFn maps glyphID values to private dicts in Font.Info.Private.
type Font ¶
Font stores a CFF font.
TODO(voss): make this more similar to type1.Font. Maybe merge Outlines into Font?
func (*Font) Clone ¶ added in v0.3.5
Clone creates a new font, consisting of shallow copies of the FontInfo and Outlines fields.
type Glyph ¶
type Glyph struct { Name string Cmds []GlyphOp HStem []funit.Int16 VStem []funit.Int16 Width funit.Int16 }
Glyph represents a glyph in a CFF font.
type GlyphOp ¶
type GlyphOp struct { Op GlyphOpType Args []float64 }
GlyphOp is a CFF glyph drawing command.
type GlyphOpType ¶
type GlyphOpType byte
GlyphOpType is the type of a CFF glyph drawing command.
TODO(voss): merge this with the Type 1 command type?
const ( // OpMoveTo closes the previous subpath and starts a new one at the given point. OpMoveTo GlyphOpType = iota + 1 // OpLineTo appends a straight line segment from the previous point to the given point. OpLineTo // OpCurveTo appends a Bezier curve segment from the previous point to the given point. OpCurveTo // OpHintMask adds a CFF hintmask command. OpHintMask // OpCntrMask adds a CFF cntrmask command. OpCntrMask )
func (GlyphOpType) String ¶
func (op GlyphOpType) String() string
type Outlines ¶
type Outlines struct { Glyphs []*Glyph Private []*type1.PrivateDict // FDSelect determines which private dictionary is used for each glyph. FDSelect FDSelectFn // Encoding lists the glyphs corresponding to the 256 one-byte character // codes in a simple font. The length of this slice must be 256, entries // for unused character codes must be set to 0. // For CIDFonts (where ROS != nil), Encoding must be nil. Encoding []glyph.ID // ROS specifies the character collection of the font, using Adobe's // Registry, Ordering, Supplement system. This must be non-nil // if and only if the font is a CIDFont. ROS *cid.SystemInfo // GIDToCID lists the character identifiers corresponding to the glyphs. // This is only present for CIDFonts, and encodes the information from the // charset table in the CFF font. When present, the first entry // (corresponding to the .notdef glyph) must be 0. GIDToCID []cid.CID }
Outlines stores the glyph data of a CFF font.
func (*Outlines) BuiltinEncoding ¶ added in v0.4.0
BuiltinEncoding returns the built-in encoding of the font. For simple CFF fonts, the result is a slice of length 256. For CIDFonts, the result is nil.
func (*Outlines) IsCIDKeyed ¶ added in v0.3.4
IsCIDKeyed returns true if the font is a CID-keyed font.