Class: Fontisan::Binary::BaseRecord
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- Fontisan::Binary::BaseRecord
- Defined in:
- lib/fontisan/binary/base_record.rb
Overview
Base class for all BinData record definitions
Provides common configuration for OpenType binary structures:
- Big-endian byte order (OpenType standard)
- Common helper methods
All table parsers and binary structures should inherit from this class to ensure consistent behavior across the codebase.
Direct Known Subclasses
OffsetTable, TableDirectoryEntry, Tables::Cbdt, Tables::Cblc, Tables::CblcBigGlyphMetrics, Tables::CblcBitmapSize, Tables::CblcIndexSubTableArrayEntry, Tables::CblcIndexSubTableHeader, Tables::CblcSbitLineMetrics, Tables::Cff, Tables::Cff2, Tables::Cff2::Cff2Header, Tables::Cff::Header, Tables::Cmap, Tables::Colr, Tables::Colr::BaseGlyphRecord, Tables::Colr::LayerRecord, Tables::Cpal, Tables::Cvar, Tables::Fvar, Tables::Glyf, Tables::Gpos, Tables::Gsub, Tables::Gvar, Tables::Head, Tables::Hhea, Tables::Hmtx, Tables::Hmtx::LongHorMetric, Tables::Hvar, Tables::InstanceRecord, Tables::LayoutCommon::Feature, Tables::LayoutCommon::FeatureList, Tables::LayoutCommon::FeatureRecord, Tables::LayoutCommon::LangSys, Tables::LayoutCommon::LangSysRecord, Tables::LayoutCommon::Script, Tables::LayoutCommon::ScriptList, Tables::LayoutCommon::ScriptRecord, Tables::Loca, Tables::Maxp, Tables::Mvar, Tables::Mvar::ValueRecord, Tables::Name, Tables::NameRecord, Tables::Os2, Tables::Post, Tables::Sbix, Tables::Svg, Tables::Svg::SvgDocumentRecord, Tables::VariationAxisRecord, Tables::VariationCommon::DeltaSetIndexMap, Tables::VariationCommon::ItemVariationData, Tables::VariationCommon::ItemVariationStore, Tables::VariationCommon::RegionAxisCoordinates, Tables::VariationCommon::VariationRegion, Tables::VariationCommon::VariationRegionList, Tables::Vvar, Variation::TupleVariationHeader
Instance Attribute Summary collapse
-
#raw_data ⇒ String
Get the raw binary data that was read.
Class Method Summary collapse
-
.read(io) ⇒ Object
Override read to handle nil/empty/String inputs gracefully.
Instance Method Summary collapse
-
#valid? ⇒ Boolean
Check if the record is valid.
Instance Attribute Details
#raw_data ⇒ String
Get the raw binary data that was read
49 50 51 |
# File 'lib/fontisan/binary/base_record.rb', line 49 def raw_data @raw_data || to_binary_s end |
Class Method Details
.read(io) ⇒ Object
Override read to handle nil/empty/String inputs gracefully.
String inputs are wrapped in a StringIO so the rest of the read path always works against an IO-like object.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fontisan/binary/base_record.rb', line 31 def self.read(io) return new if io.nil? io = StringIO.new(io) if io.is_a?(String) return new if io.is_a?(StringIO) && io.eof? # Store the original data for later parsing data = io.read io.rewind instance = super(io) instance.raw_data = data instance end |
Instance Method Details
#valid? ⇒ Boolean
Check if the record is valid
59 60 61 |
# File 'lib/fontisan/binary/base_record.rb', line 59 def valid? true end |