Documentation
¶
Overview ¶
Package otf2ttf converts CFF (PostScript, cubic Bézier) glyph outlines in an OpenType font to TrueType (glyf, quadratic Bézier) outlines. This exists because many printer RIPs and PDF interpreters render embedded CIDFontType2 (TrueType) fonts correctly but blank out or garble CIDFontType0 (CFF) fonts; converting the outlines lets a PDF writer embed any CFF/OpenType font in the universally supported TrueType form. Cubics are approximated with quadratic splines via the cu2qu algorithm (see cu2qu.go); with the recommended tolerance of upem/1000 the deviation is invisible at any practical size.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
Convert returns a copy of the font with its CFF outlines converted to TrueType (glyf) outlines, so it can be embedded as a CIDFontType2 in a PDF. maxErr is the maximum approximation error in font units; pass 0 to use the recommended unitsPerEm/1000. Metrics tables (head, hhea, hmtx, cmap, ...) are preserved; only the outline representation changes. The conversion fails (with the original font left untouched) if any glyph's charstring cannot be interpreted, so callers can fall back to embedding the CFF as-is.
Types ¶
This section is empty.