class HexaPDF::Type::FontSimple

Parent

Represents a simple PDF font.

A simple font has only single-byte character codes and only supports horizontal metrics.

See: PDF2.0 s9.6

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
TypeSymboltrue:Font
ToUnicodeHexaPDF::Stream or Hashfalsenil
NameSymbolfalsenil
FirstCharIntegerfalsenil
LastCharIntegerfalsenil
WidthsHexaPDF::PDFArray or Arrayfalsenil
FontDescriptorHexaPDF::Type::FontDescriptor or Hashfalsenil
EncodingHexaPDF::Dictionary or Symbol or Hashfalsenil

Public Instance Methods

decode(string)

Decodes the given string into an array of character codes.

encoding()

Returns the encoding object used for this font.

Note that the encoding is cached internally when accessed the first time.

font_descriptor()

Returns the font descriptor. May be nil for a standard 14 font.

The font descriptor is required except for the standard 14 fonts in PDF version up to 1.7.

symbolic?()

Returns true if the font is a symbolic font, false if it is not, and nil if it is not known.

to_utf8(code)

Returns the UTF-8 string for the given character 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 code point 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.

Always returns true for simple fonts.

See: PDF2.0 s9.3.3

writing_mode()

Returns the writing mode which is always :horizontal for simple fonts like Type1.