Class: Fontisan::Subset::TableStrategy::ColorBitmapSubtablePlan
- Inherits:
-
Object
- Object
- Fontisan::Subset::TableStrategy::ColorBitmapSubtablePlan
- Defined in:
- lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb
Overview
Plan for one IndexSubTable emitted by [ColorBitmapSubsetter]: a contiguous run of new GIDs at a single strike, with the CBDT offsets and lengths needed to emit a format 1 IndexSubTable.
Instance Attribute Summary collapse
-
#image_format ⇒ Object
readonly
Returns the value of attribute image_format.
-
#placements ⇒ Object
readonly
Returns the value of attribute placements.
-
#strike_ppem ⇒ Object
readonly
Returns the value of attribute strike_ppem.
Instance Method Summary collapse
- #add(placement) ⇒ Object
-
#byte_length ⇒ Object
Byte length of this IndexSubTable in the output CBLC: 8-byte header + (count + 1) × 4-byte offsets.
- #first_new_gid ⇒ Object
-
#first_new_offset ⇒ Integer
Absolute CBDT offset where this subtable's first glyph's bitmap begins.
-
#initialize(strike_ppem:, image_format:) ⇒ ColorBitmapSubtablePlan
constructor
A new instance of ColorBitmapSubtablePlan.
- #last_new_gid ⇒ Object
-
#offset_array ⇒ Array<Integer>
IndexSubTable format 1 offset array (relative to imageDataOffset).
Constructor Details
#initialize(strike_ppem:, image_format:) ⇒ ColorBitmapSubtablePlan
Returns a new instance of ColorBitmapSubtablePlan.
12 13 14 15 16 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 12 def initialize(strike_ppem:, image_format:) @strike_ppem = strike_ppem @image_format = image_format @placements = [] end |
Instance Attribute Details
#image_format ⇒ Object (readonly)
Returns the value of attribute image_format.
10 11 12 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 10 def image_format @image_format end |
#placements ⇒ Object (readonly)
Returns the value of attribute placements.
10 11 12 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 10 def placements @placements end |
#strike_ppem ⇒ Object (readonly)
Returns the value of attribute strike_ppem.
10 11 12 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 10 def strike_ppem @strike_ppem end |
Instance Method Details
#add(placement) ⇒ Object
18 19 20 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 18 def add(placement) @placements << placement end |
#byte_length ⇒ Object
Byte length of this IndexSubTable in the output CBLC: 8-byte header + (count + 1) × 4-byte offsets.
53 54 55 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 53 def byte_length 8 + (@placements.size + 1) * 4 end |
#first_new_gid ⇒ Object
22 23 24 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 22 def first_new_gid @placements.first.new_gid end |
#first_new_offset ⇒ Integer
Absolute CBDT offset where this subtable's first glyph's bitmap begins. Assigned during CBDT emission.
34 35 36 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 34 def first_new_offset @placements.first.new_offset end |
#last_new_gid ⇒ Object
26 27 28 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 26 def last_new_gid @placements.last.new_gid end |
#offset_array ⇒ Array<Integer>
43 44 45 46 47 48 49 |
# File 'lib/fontisan/subset/table_strategy/color_bitmap_subtable_plan.rb', line 43 def offset_array arr = [0] @placements.each do |p| arr << (arr.last + p.byte_length) end arr end |