The library use zpb-ttf to extract path from TTF fonts.
While paths-from-string handle kerning between each pair of character, it is up to the user to scale the font, compute alignment (center,..), compute bounding box, break text into several lines if necessary, and so on, according to information obtained from zpb-ttf directly. However, more convenient support may be added in the future to cl-vectors.
Note that hinting is not supported at all. It may be a problem for rendering fonts at very small sizes. But otherwise, paths extracted from zpb-ttf are sufficient for most uses.
Function PATHS-FROM-GLYPH
Syntax:
paths-from-glyph glyph &key (offset (make-point 0 0)) (scale-x 1.0) (scale-y 1.0) => paths
Arguments and Values:
glyph -- a glyph object from zpb-ttf
offset -- a point
scale-x -- a real number
scale-y -- a real number
Description:
Create paths from the glyph extracted by the zpb-ttf library.
Examples:
(zpb-ttf:with-font-loader (loader "font.ttf") (show-annotated-path (paths-from-glyph (zpb-ttf:find-glyph #\π loader) :offset (make-point 200 550) :scale-x 0.3 :scale-y -0.3)))
Function PATHS-FROM-STRING
Syntax:
paths-from-string font-loader string &key (offset (make-point 0 0)) (scale-x 1.0) (scale-y 1.0) (kerning t) => paths
Arguments and Values:
font-loader -- a font loader from zpb-ttf
string -- a string
offset -- a point
scale-x -- a real number
scale-y -- a real number
kerning -- a boolean (available in version >=0.1.4)
Description:
Return a list of paths describing the given string. Kerning is taken into account if kerning is true.
Examples:
(zpb-ttf:with-font-loader (loader "font.ttf") (paths-from-string loader "Hello World!" :offset (make-point 200 550) :scale-x 0.3 :scale-y -0.3)))
Function MAKE-STRING-PATH
Syntax:
make-string-path font-loader text &key position size halign valign inverted kerning => paths
Arguments and Values:
font-loader -- a font loader from zpb-ttf
text -- a string
position -- a point
size -- an integer
halign -- either :none, :left, :right or :center
valign -- either :baseline, :top, :bottom or :center
inverted -- a boolean
kerning -- a boolean
Description:
To be added in 0.1.4.
This function is a convenient wrapper around paths-from-string.