Class: Fontisan::Tables::Head
- Inherits:
-
Binary::BaseRecord
- Object
- BinData::Record
- Binary::BaseRecord
- Fontisan::Tables::Head
- Defined in:
- lib/fontisan/tables/head.rb
Overview
BinData structure for 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.
Reference: OpenType specification, head table
Constant Summary collapse
- MAGIC_NUMBER =
Magic number that must be present in the head table
0x5F0F3CF5
Instance Method Summary collapse
-
#created ⇒ Time
Convert created timestamp to Time object.
-
#font_revision ⇒ Float
Convert font revision from fixed-point to float.
-
#modified ⇒ Time
Convert modified timestamp to Time object.
-
#valid? ⇒ Boolean
Validate that the magic number is correct.
-
#validate_magic_number! ⇒ Object
(also: #validate!)
Validate magic number and raise error if invalid.
-
#version ⇒ Float
Convert version from fixed-point to float.
Methods inherited from Binary::BaseRecord
Instance Method Details
#created ⇒ Time
Convert created timestamp to Time object
67 68 69 |
# File 'lib/fontisan/tables/head.rb', line 67 def created longdatetime_to_time(created_raw) end |
#font_revision ⇒ Float
Convert font revision from fixed-point to float
60 61 62 |
# File 'lib/fontisan/tables/head.rb', line 60 def font_revision fixed_to_float(font_revision_raw) end |
#modified ⇒ Time
Convert modified timestamp to Time object
74 75 76 |
# File 'lib/fontisan/tables/head.rb', line 74 def modified longdatetime_to_time(modified_raw) end |
#valid? ⇒ Boolean
Validate that the magic number is correct
81 82 83 |
# File 'lib/fontisan/tables/head.rb', line 81 def valid? magic_number == MAGIC_NUMBER end |
#validate_magic_number! ⇒ Object Also known as: validate!
Validate magic number and raise error if invalid
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/fontisan/tables/head.rb', line 88 def validate_magic_number! return if valid? = "Invalid magic number in head table: " \ "expected 0x#{MAGIC_NUMBER.to_s(16).upcase}, " \ "got 0x#{magic_number.to_s(16).upcase}" error = Fontisan::CorruptedTableError.new() error.set_backtrace(caller) Kernel.raise(error) end |
#version ⇒ Float
Convert version from fixed-point to float
53 54 55 |
# File 'lib/fontisan/tables/head.rb', line 53 def version fixed_to_float(version_raw) end |