class HexaPDF::Type::FontType0

Parent

Represents a composite PDF font.

Composites fonts wrap a descendant CIDFont and use CIDs to identify glyphs. A CID can be encoded in one or more bytes and an associated CMap specifies how this encoding is done. Composite fonts also allow for vertical writing mode and support TrueType as well as OpenType fonts.

See: PDF2.0 s9.7

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
TypeSymboltrue:Font
ToUnicodeHexaPDF::Stream or Hashfalsenil
SubtypeSymboltrue:Type0
BaseFontSymboltruenil
EncodingHexaPDF::Stream or Symbol or Hashtruenil
DescendantFontsHexaPDF::PDFArray or Arraytruenil

Public Instance Methods

bounding_box()

Returns the bounding box of the font or nil if it is not found.

decode(string)

Decodes the given string into an array of CIDs.

descendant_font()

Returns the CID font of this type 0 font.

embedded?()

Returns true if the font is embedded.

font_descriptor()

Returns the font descriptor of the descendant font.

font_file()

Returns the embeeded font file object or nil if the font is not embedded.

to_utf8(code)

Returns the UTF-8 string for the given code, or calls the configuration option ‘font.on_missing_unicode_mapping’ if no mapping was found.

width(code)

Returns the unscaled width of the given CID in glyph units, or 0 if the width for the code point is missing.

word_spacing_applicable?()

Returns whether word spacing is applicable when using this font.

Note that the return value is cached when accessed the first time.

See: PDF2.0 s9.3.3

writing_mode()

Returns the writing mode which is either :horizontal or :vertical.