class HexaPDF::Font::TrueType::Font

Parent

Represents a font in the TrueType font file format.

Constants

DEFAULT_CONFIG

The default configuration:

font.ttf.table_mapping

The default mapping from table tag as symbol to table class name.

font.ttf.unknown_format

Action to take when encountering unknown subtables. Can either be :ignore which ignores them or :raise which raises an error.

Attributes

config[R]

The configuration for the TrueType font.

io[R]

The IO stream associated with this file.

Public Class Methods

new(io, config: {})

Creates a new TrueType font file object for the given IO object.

The config hash can contain configuration options.

Public Instance Methods

[](tag)

Returns the table instance for the given tag (a symbol), or nil if no such table exists.

ascender()

Returns the ascender of the font.

bounding_box()

Returns the bounding of the font.

cap_height()

Returns the cap height of the font.

descender()

Returns the descender of the font.

directory()

Returns the font directory.

dominant_vertical_stem_width()

Returns the dominant width of vertical stems.

Note: This attribute does not actually exist in TrueType fonts, so it is estimated based on the weight.

family_name()

Returns the family name of the font.

features()

Returns a set of features this font supports.

Features that may be available are for example :kern or :liga.

font_name()

Returns the PostScript font name.

full_name()

Returns the full name of the font.

italic_angle()

Returns the italic angle of the font, in degrees counter-clockwise from the vertical.

missing_glyph_id()

Returns th glyph ID of the missing glyph, i.e. 0.

strikeout_position()

Returns the distance from the baseline to the top of the strikeout line.

strikeout_thickness()

Returns the stroke width for the strikeout line.

underline_position()

Returns the distance from the baseline to the top of the underline.

underline_thickness()

Returns the stroke width for the underline.

weight()

Returns the weight of the font.

x_height()

Returns the x-height of the font.