class HexaPDF:: Font:: TrueTypeWrapper
Parent | Object |
---|
This class wraps a generic TrueType
font object and provides the methods needed for working with the font in a PDF context.
TrueType
fonts can be represented in two ways in PDF: As a simple font with Subtype TrueType
or as a composite font using a Type2 CIDFont. The wrapper only supports the composite font case because:
-
By using a composite font more than 256 characters can be encoded with one font object.
-
Fonts for vertical writing can potentially be used.
-
The PDF specification recommends using a composite font (see PDF1.7 s9.9 at the end).
Additionally, TrueType
fonts are always embedded.
Attributes
Returns the PDF object associated with the wrapper.
Public Class Methods
Creates a new object wrapping the TrueType
font for the PDF document.
The optional argument pdf_object
can be used to set the PDF font object that this wrapper should be associated with. If no object is set, a suitable one is automatically created.
If subset
is true, the font is subset.
Public Instance Methods
Returns an array of glyph objects representing the characters in the UTF-8 encoded string.
Encodes the glyph and returns the code string.
Returns the type of the font, i.e. :TrueType.
Returns a Glyph
object for the given glyph ID.
The optional argument str
should be the string representation of the glyph. Only use it if it is known,
Note: Although this method is public, it should normally not be used by application code!
Returns the scaling factor for converting font units into PDF units.