Class: HexaPDF::Font::TrueType::Table::Head

Inherits:
HexaPDF::Font::TrueType::Table show all
Extended by:
Utils::BitField
Defined in:
lib/hexapdf/font/true_type/table/head.rb

Overview

The ‘head’ table contains global information about the font.

See: developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6head.html

Constant Summary

Constants inherited from HexaPDF::Font::TrueType::Table

TIME_EPOCH

Instance Attribute Summary collapse

Attributes inherited from HexaPDF::Font::TrueType::Table

#font

Instance Method Summary collapse

Methods included from Utils::BitField

bit_field

Methods inherited from HexaPDF::Font::TrueType::Table

calculate_checksum, #directory_entry, #initialize, #raw_data

Constructor Details

This class inherits a constructor from HexaPDF::Font::TrueType::Table

Instance Attribute Details

#bboxObject

The bounding box for all glyphs of the font in the form [xmin, ymin, xmax, ymax].



75
76
77
# File 'lib/hexapdf/font/true_type/table/head.rb', line 75

def bbox
  @bbox
end

#checksum_adjustmentObject

The adjustment value for the checksum.



59
60
61
# File 'lib/hexapdf/font/true_type/table/head.rb', line 59

def checksum_adjustment
  @checksum_adjustment
end

#createdObject

The creation time of the font.



69
70
71
# File 'lib/hexapdf/font/true_type/table/head.rb', line 69

def created
  @created
end

#flagsObject

Various font flags. See Flags.



62
63
64
# File 'lib/hexapdf/font/true_type/table/head.rb', line 62

def flags
  @flags
end

#font_direction_hintObject

Represents an indication of the direction of the glyphs of the font.

0

Mixed directional font

1

Font with only left-to-right glyphs

-1

Font with only right-to-left glyphs

2

Font with left-to-right and neutral (e.g. punctuation) glyphs

-2

Font with right-to-left and neutral (e.g. punctuation) glyphs



93
94
95
# File 'lib/hexapdf/font/true_type/table/head.rb', line 93

def font_direction_hint
  @font_direction_hint
end

#font_revisionObject

The revision of the font as set by the manufacturer (a Rational).



56
57
58
# File 'lib/hexapdf/font/true_type/table/head.rb', line 56

def font_revision
  @font_revision
end

#index_to_loc_formatObject

Indicates the type of offset format used in the ‘loca’ table, 0 for short offsets, 1 for long offsets.

See: Loca



99
100
101
# File 'lib/hexapdf/font/true_type/table/head.rb', line 99

def index_to_loc_format
  @index_to_loc_format
end

#mac_styleObject

Apple Mac style information.



78
79
80
# File 'lib/hexapdf/font/true_type/table/head.rb', line 78

def mac_style
  @mac_style
end

#modifiedObject

The modification time of the font.



72
73
74
# File 'lib/hexapdf/font/true_type/table/head.rb', line 72

def modified
  @modified
end

#smallest_readable_sizeObject

The smallest readable size in pixels per em for this font.



84
85
86
# File 'lib/hexapdf/font/true_type/table/head.rb', line 84

def smallest_readable_size
  @smallest_readable_size
end

#units_per_emObject

The number of units per em for the font. Should be a power of 2 in the range from 64 through 16384.



66
67
68
# File 'lib/hexapdf/font/true_type/table/head.rb', line 66

def units_per_em
  @units_per_em
end

#versionObject

The version of the font (a Rational).



53
54
55
# File 'lib/hexapdf/font/true_type/table/head.rb', line 53

def version
  @version
end

Instance Method Details

#checksum_valid?Boolean

The checksum for the head table is calculated differently because the checksum_adjustment value is not used during the calculation.

See: Table#checksum_valid?

Returns:

  • (Boolean)


105
106
107
108
109
# File 'lib/hexapdf/font/true_type/table/head.rb', line 105

def checksum_valid?
  data = raw_data
  data[8, 4] = 0.chr * 4
  directory_entry.checksum == self.class.calculate_checksum(data)
end