Class: Fontisan::Tables::Cblc::BitmapSize
- Inherits:
-
Binary::BaseRecord
- Object
- BinData::Record
- Binary::BaseRecord
- Fontisan::Tables::Cblc::BitmapSize
- Defined in:
- lib/fontisan/tables/cblc.rb
Overview
BitmapSize record structure (48 bytes)
Describes a bitmap strike at a specific ppem size
Instance Attribute Summary collapse
-
#bit_depth ⇒ Object
readonly
Returns the value of attribute bit_depth.
-
#color_ref ⇒ Object
readonly
Returns the value of attribute color_ref.
-
#end_glyph_index ⇒ Object
readonly
Returns the value of attribute end_glyph_index.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#hori ⇒ Object
readonly
Returns the value of attribute hori.
-
#index_subtable_array_offset ⇒ Object
readonly
Returns the value of attribute index_subtable_array_offset.
-
#index_tables_size ⇒ Object
readonly
Returns the value of attribute index_tables_size.
-
#number_of_index_subtables ⇒ Object
readonly
Returns the value of attribute number_of_index_subtables.
-
#ppem_x ⇒ Object
readonly
Returns the value of attribute ppem_x.
-
#ppem_y ⇒ Object
readonly
Returns the value of attribute ppem_y.
-
#start_glyph_index ⇒ Object
readonly
Returns the value of attribute start_glyph_index.
-
#vert ⇒ Object
readonly
Returns the value of attribute vert.
Class Method Summary collapse
-
.read(io) ⇒ Object
Read the SbitLineMetrics structures manually.
Instance Method Summary collapse
-
#glyph_range ⇒ Range
Get glyph range for this strike.
-
#includes_glyph?(glyph_id) ⇒ Boolean
Check if this strike includes a specific glyph ID.
-
#ppem ⇒ Integer
Get ppem size (assumes square pixels).
Methods inherited from Binary::BaseRecord
Instance Attribute Details
#bit_depth ⇒ Object (readonly)
Returns the value of attribute bit_depth.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def bit_depth @bit_depth end |
#color_ref ⇒ Object (readonly)
Returns the value of attribute color_ref.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def color_ref @color_ref end |
#end_glyph_index ⇒ Object (readonly)
Returns the value of attribute end_glyph_index.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def end_glyph_index @end_glyph_index end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def flags @flags end |
#hori ⇒ Object (readonly)
Returns the value of attribute hori.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def hori @hori end |
#index_subtable_array_offset ⇒ Object (readonly)
Returns the value of attribute index_subtable_array_offset.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def index_subtable_array_offset @index_subtable_array_offset end |
#index_tables_size ⇒ Object (readonly)
Returns the value of attribute index_tables_size.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def index_tables_size @index_tables_size end |
#number_of_index_subtables ⇒ Object (readonly)
Returns the value of attribute number_of_index_subtables.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def number_of_index_subtables @number_of_index_subtables end |
#ppem_x ⇒ Object (readonly)
Returns the value of attribute ppem_x.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def ppem_x @ppem_x end |
#ppem_y ⇒ Object (readonly)
Returns the value of attribute ppem_y.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def ppem_y @ppem_y end |
#start_glyph_index ⇒ Object (readonly)
Returns the value of attribute start_glyph_index.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def start_glyph_index @start_glyph_index end |
#vert ⇒ Object (readonly)
Returns the value of attribute vert.
111 112 113 |
# File 'lib/fontisan/tables/cblc.rb', line 111 def vert @vert end |
Class Method Details
.read(io) ⇒ Object
Read the SbitLineMetrics structures manually
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/fontisan/tables/cblc.rb', line 84 def self.read(io) data = io.is_a?(String) ? io : io.read size = new io = StringIO.new(data) size.instance_variable_set(:@index_subtable_array_offset, io.read(4).unpack1("N")) size.instance_variable_set(:@index_tables_size, io.read(4).unpack1("N")) size.instance_variable_set(:@number_of_index_subtables, io.read(4).unpack1("N")) size.instance_variable_set(:@color_ref, io.read(4).unpack1("N")) # Parse hori and vert metrics (12 bytes each) hori_data = io.read(12) vert_data = io.read(12) size.instance_variable_set(:@hori, SbitLineMetrics.read(hori_data)) size.instance_variable_set(:@vert, SbitLineMetrics.read(vert_data)) # Parse remaining fields size.instance_variable_set(:@start_glyph_index, io.read(2).unpack1("n")) size.instance_variable_set(:@end_glyph_index, io.read(2).unpack1("n")) size.instance_variable_set(:@ppem_x, io.read(1).unpack1("C")) size.instance_variable_set(:@ppem_y, io.read(1).unpack1("C")) size.instance_variable_set(:@bit_depth, io.read(1).unpack1("C")) size.instance_variable_set(:@flags, io.read(1).unpack1("c")) size end |
Instance Method Details
#glyph_range ⇒ Range
Get glyph range for this strike
126 127 128 |
# File 'lib/fontisan/tables/cblc.rb', line 126 def glyph_range start_glyph_index..end_glyph_index end |
#includes_glyph?(glyph_id) ⇒ Boolean
Check if this strike includes a specific glyph ID
134 135 136 |
# File 'lib/fontisan/tables/cblc.rb', line 134 def includes_glyph?(glyph_id) glyph_range.include?(glyph_id) end |
#ppem ⇒ Integer
Get ppem size (assumes square pixels)
119 120 121 |
# File 'lib/fontisan/tables/cblc.rb', line 119 def ppem ppem_x end |