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
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fontisan/tables/head_table.rb', line 36 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
71 72 73 |
# File 'lib/fontisan/tables/head_table.rb', line 71 def font_revision parsed&.font_revision end |
#index_to_loc_format ⇒ Integer?
Get index to loc format
50 51 52 |
# File 'lib/fontisan/tables/head_table.rb', line 50 def index_to_loc_format parsed&.index_to_loc_format end |
#long_loca_format? ⇒ Boolean
Check if using long loca format
57 58 59 |
# File 'lib/fontisan/tables/head_table.rb', line 57 def long_loca_format? index_to_loc_format == 1 end |
#magic_number_valid? ⇒ Boolean
Check if magic number is valid
22 23 24 |
# File 'lib/fontisan/tables/head_table.rb', line 22 def magic_number_valid? parsed && parsed.magic_number == Tables::Head::MAGIC_NUMBER end |
#units_per_em ⇒ Integer?
Get units per em
29 30 31 |
# File 'lib/fontisan/tables/head_table.rb', line 29 def units_per_em parsed&.units_per_em end |
#version ⇒ Float?
Get font version
64 65 66 |
# File 'lib/fontisan/tables/head_table.rb', line 64 def version parsed&.version end |