Class: Fontisan::Models::BitmapGlyph
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::BitmapGlyph
- Defined in:
- lib/fontisan/models/bitmap_glyph.rb
Overview
Bitmap glyph representation model
Represents a bitmap glyph from the CBDT/CBLC tables. Each glyph contains bitmap image data at a specific ppem 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, 32).
-
#data_offset ⇒ Integer
Offset to bitmap data in CBDT table.
-
#data_size ⇒ Integer
Size of bitmap data in bytes.
-
#format ⇒ String
Bitmap format (e.g., “PNG”, “JPEG”, “TIFF”).
-
#glyph_id ⇒ Integer
Glyph ID.
-
#height ⇒ Integer
Bitmap height in pixels.
-
#ppem ⇒ Integer
Pixels per em for this bitmap.
-
#width ⇒ Integer
Bitmap width in pixels.
Instance Method Summary collapse
-
#color? ⇒ Boolean
Check if this is a color bitmap (32-bit).
-
#color_depth ⇒ String
Get the color depth description.
-
#dimensions ⇒ String
Get bitmap dimensions as string.
-
#jpeg? ⇒ Boolean
Check if this is a JPEG bitmap.
-
#monochrome? ⇒ Boolean
Check if this is a monochrome bitmap (1-bit).
-
#png? ⇒ Boolean
Check if this is a PNG bitmap.
-
#tiff? ⇒ Boolean
Check if this is a TIFF bitmap.
Instance Attribute Details
#bit_depth ⇒ Integer
Returns Bit depth (1, 2, 4, 8, 32).
56 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 56 attribute :bit_depth, :integer |
#data_offset ⇒ Integer
Returns Offset to bitmap data in CBDT table.
64 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 64 attribute :data_offset, :integer |
#data_size ⇒ Integer
Returns Size of bitmap data in bytes.
60 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 60 attribute :data_size, :integer |
#format ⇒ String
Returns Bitmap format (e.g., “PNG”, “JPEG”, “TIFF”).
44 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 44 attribute :format, :string |
#glyph_id ⇒ Integer
Returns Glyph ID.
36 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 36 attribute :glyph_id, :integer |
#height ⇒ Integer
Returns Bitmap height in pixels.
52 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 52 attribute :height, :integer |
#ppem ⇒ Integer
Returns Pixels per em for this bitmap.
40 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 40 attribute :ppem, :integer |
#width ⇒ Integer
Returns Bitmap width in pixels.
48 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 48 attribute :width, :integer |
Instance Method Details
#color? ⇒ Boolean
Check if this is a color bitmap (32-bit)
90 91 92 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 90 def color? bit_depth == 32 end |
#color_depth ⇒ String
Get the color depth description
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 104 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 |
#dimensions ⇒ String
Get bitmap dimensions as string
118 119 120 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 118 def dimensions "#{width}x#{height}" end |
#jpeg? ⇒ Boolean
Check if this is a JPEG bitmap
76 77 78 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 76 def jpeg? format&.upcase == "JPEG" end |
#monochrome? ⇒ Boolean
Check if this is a monochrome bitmap (1-bit)
97 98 99 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 97 def monochrome? bit_depth == 1 end |
#png? ⇒ Boolean
Check if this is a PNG bitmap
69 70 71 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 69 def png? format&.upcase == "PNG" end |
#tiff? ⇒ Boolean
Check if this is a TIFF bitmap
83 84 85 |
# File 'lib/fontisan/models/bitmap_glyph.rb', line 83 def tiff? format&.upcase == "TIFF" end |