Class: Fontisan::Tables::HeadTable
- Defined in:
- lib/fontisan/tables/head_table.rb
Overview
OOP representation of the ‘head’ (Font Header) table
The head table contains global information about the font, including metadata about the font file, bounding box, and indexing information.
This class extends SfntTable to provide head-specific validation and convenience methods for accessing common head table fields.
Instance Attribute Summary
Attributes inherited from SfntTable
Instance Method Summary collapse
-
#bounding_box ⇒ Hash?
Get font bounding box.
-
#font_revision ⇒ Float?
Get font revision.
-
#index_to_loc_format ⇒ Integer?
Get index to loc format.
-
#long_loca_format? ⇒ Boolean
Check if using long loca format.
-
#magic_number_valid? ⇒ Boolean
Check if magic number is valid.
-
#units_per_em ⇒ Integer?
Get units per em.
-
#version ⇒ Float?
Get font version.
Methods inherited from SfntTable
#available?, #calculate_checksum, #checksum, #data_loaded?, #human_name, #initialize, #inspect, #length, #load_data!, #offset, #parse, #parsed?, #required?, #tag, #to_s, #validate!
Constructor Details
This class inherits a constructor from Fontisan::SfntTable
Instance Method Details
#bounding_box ⇒ Hash?
Get font bounding box
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fontisan/tables/head_table.rb', line 39 def bounding_box return nil unless parsed { x_min: parsed.x_min, y_min: parsed.y_min, x_max: parsed.x_max, y_max: parsed.y_max, } end |
#font_revision ⇒ Float?
Get font revision
74 75 76 |
# File 'lib/fontisan/tables/head_table.rb', line 74 def font_revision parsed&.font_revision end |
#index_to_loc_format ⇒ Integer?
Get index to loc format
53 54 55 |
# File 'lib/fontisan/tables/head_table.rb', line 53 def index_to_loc_format parsed&.index_to_loc_format end |
#long_loca_format? ⇒ Boolean
Check if using long loca format
60 61 62 |
# File 'lib/fontisan/tables/head_table.rb', line 60 def long_loca_format? index_to_loc_format == 1 end |
#magic_number_valid? ⇒ Boolean
Check if magic number is valid
25 26 27 |
# File 'lib/fontisan/tables/head_table.rb', line 25 def magic_number_valid? parsed && parsed.magic_number == Tables::Head::MAGIC_NUMBER end |
#units_per_em ⇒ Integer?
Get units per em
32 33 34 |
# File 'lib/fontisan/tables/head_table.rb', line 32 def units_per_em parsed&.units_per_em end |
#version ⇒ Float?
Get font version
67 68 69 |
# File 'lib/fontisan/tables/head_table.rb', line 67 def version parsed&.version end |