Documentation ¶
Overview ¶
Package cff allows to embed CFF fonts into a PDF file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewComposite ¶
NewComposite allocates a new CFF font for embedding into a PDF file as a composite font. The font `info` is allowed but not required to be CID-keyed.
func NewSimple ¶
NewSimple allocates a new CFF font for embedding in a PDF file as a simple font. Info must be an OpenType font with CFF outlines. If info is CID-keyed, the function will attempt to convert it to a simple font. If the conversion fails (because more than one private dictionary is used after subsetting), an error is returned.
Types ¶
type EmbedInfoComposite ¶
type EmbedInfoComposite struct { // Font is the font to embed (already subsetted, if needed). Font *cff.Font // SubsetTag should be a unique tag for the font subset, // or the empty string if this is the full font. SubsetTag string CMap *cmap.Info UnitsPerEm uint16 // TODO(voss): get this from the font matrix instead? Ascent funit.Int16 Descent funit.Int16 CapHeight funit.Int16 IsSerif bool IsScript bool IsAllCap bool IsSmallCap bool // ToUnicode (optional) is a map from character codes to unicode strings. ToUnicode *cmap.ToUnicode }
EmbedInfoComposite is the information needed to embed a CFF font as a composite PDF font.
func ExtractComposite ¶
ExtractComposite extracts information about a composite CFF font from a PDF file. This is the reverse of EmbedInfoComposite.Embed.
func (*EmbedInfoComposite) Embed ¶
Embed adds a composite CFF font to a PDF file. This is the reverse of ExtractComposite
type EmbedInfoSimple ¶
type EmbedInfoSimple struct { // Font is the font to embed (already subsetted, if needed). Font *cff.Font // SubsetTag should be a unique tag for the font subset, // or the empty string if this is the full font. SubsetTag string // Encoding is the encoding vector used by the client (a slice of length 256). // Together with the font's built-in encoding, this is used to determine // the `Encoding` entry of the PDF font dictionary. Encoding []glyph.ID UnitsPerEm uint16 // TODO(voss): get this from the font matrix instead Ascent funit.Int16 Descent funit.Int16 CapHeight funit.Int16 IsSerif bool IsScript bool IsAllCap bool IsSmallCap bool // ToUnicode (optional) is a map from character codes to unicode strings. ToUnicode *cmap.ToUnicode }
EmbedInfoSimple is the information needed to embed a simple CFF font.
func ExtractSimple ¶
ExtractSimple extracts all information about a simple CFF font from a PDF file. This is the inverse of EmbedInfoSimple.Embed.
type FontComposite ¶
FontComposite is a CFF font for embedding into a PDF file as a composite font.