Class: Fontisan::Models::BitmapStrike
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::BitmapStrike
- Defined in:
- lib/fontisan/models/bitmap_strike.rb
Overview
Bitmap strike representation model
Represents a bitmap strike (size) from the CBLC table. Each strike contains bitmap glyphs at a specific ppem (pixels per em) size.
This model uses lutaml-model for structured serialization to YAML/JSON/XML.
Instance Attribute Summary collapse
-
#bit_depth ⇒ Integer
Bit depth (1, 2, 4, 8, or 32).
-
#end_glyph_id ⇒ Integer
Last glyph ID in this strike.
-
#num_glyphs ⇒ Integer
Number of glyphs in this strike.
-
#ppem ⇒ Integer
Pixels per em (square pixels).
-
#start_glyph_id ⇒ Integer
First glyph ID in this strike.
Instance Method Summary collapse
-
#color? ⇒ Boolean
Check if this is a color strike (32-bit).
-
#color_depth ⇒ String
Get the color depth description.
-
#glyph_range ⇒ Range
Get glyph IDs covered by this strike.
-
#includes_glyph?(glyph_id) ⇒ Boolean
Check if this strike covers a specific glyph ID.
-
#monochrome? ⇒ Boolean
Check if this is a monochrome strike (1-bit).
Instance Attribute Details
#bit_depth ⇒ Integer
Returns Bit depth (1, 2, 4, 8, or 32).
44 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 44 attribute :bit_depth, :integer |
#end_glyph_id ⇒ Integer
Returns Last glyph ID in this strike.
40 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 40 attribute :end_glyph_id, :integer |
#num_glyphs ⇒ Integer
Returns Number of glyphs in this strike.
48 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 48 attribute :num_glyphs, :integer |
#ppem ⇒ Integer
Returns Pixels per em (square pixels).
32 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 32 attribute :ppem, :integer |
#start_glyph_id ⇒ Integer
Returns First glyph ID in this strike.
36 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 36 attribute :start_glyph_id, :integer |
Instance Method Details
#color? ⇒ Boolean
Check if this is a color strike (32-bit)
82 83 84 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 82 def color? bit_depth == 32 end |
#color_depth ⇒ String
Get the color depth description
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 68 def color_depth case bit_depth when 1 then "1-bit (monochrome)" when 2 then "2-bit (4 colors)" when 4 then "4-bit (16 colors)" when 8 then "8-bit (256 colors)" when 32 then "32-bit (full color with alpha)" else "#{bit_depth}-bit" end end |
#glyph_range ⇒ Range
Get glyph IDs covered by this strike
53 54 55 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 53 def glyph_range start_glyph_id..end_glyph_id end |
#includes_glyph?(glyph_id) ⇒ Boolean
Check if this strike covers a specific glyph ID
61 62 63 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 61 def includes_glyph?(glyph_id) glyph_range.include?(glyph_id) end |
#monochrome? ⇒ Boolean
Check if this is a monochrome strike (1-bit)
89 90 91 |
# File 'lib/fontisan/models/bitmap_strike.rb', line 89 def monochrome? bit_depth == 1 end |