chickadee » pdf-truetype » build-embedded-font

build-embedded-font DOC TTF-PATH #!key BASE-NAME AFM-PATH FLAGS FONT-BBOX ITALIC-ANGLE ASCENT DESCENT CAP-HEIGHT STEM-Vprocedure

Embeds the TrueType font in the file TTF-PATH in DOC and returns an embedded-font. Use it with pdf's set-font through embedded-font-name, just as a build-font font is used through font-name.

BASE-NAME sets the font's name in the PDF; it defaults to the font file's PostScript name. Characters not allowed in PDF names (spaces, delimiters such as parentheses, and #) are removed, and a name left empty is an error.

FLAGS, FONT-BBOX (a vector of four numbers), ITALIC-ANGLE, ASCENT, DESCENT, CAP-HEIGHT and STEM-V replace the values otherwise read from the font file, in the 1000-units-per-em scale PDF uses. They are rarely needed. The stem width (/StemV) is not recorded in TrueType files, so by default it is estimated from the font's weight.

AFM-PATH, if given, names an AFM metrics file whose widths are registered with pdf's pdf-font module, for its get-char-width and get-string-width. It does not change what is written into the PDF. embedded-font-string-width measures text from the font file directly.

Raises an error if the file cannot be read as a supported TrueType font.