Class: Fontisan::Subset::TableStrategy::ColorBitmapStrikePlan

Inherits:
Object
  • Object
show all
Defined in:
lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb

Overview

Plan for one strike emitted by [ColorBitmapSubsetter]: the source BitmapSize plus the list of contiguous new-gid runs (each run becomes one IndexSubTable in the output CBLC).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_strike) ⇒ ColorBitmapStrikePlan

Returns a new instance of ColorBitmapStrikePlan.



12
13
14
15
# File 'lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb', line 12

def initialize(source_strike)
  @source_strike = source_strike
  @subtable_plans = []
end

Instance Attribute Details

#source_strikeObject (readonly)

Returns the value of attribute source_strike.



10
11
12
# File 'lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb', line 10

def source_strike
  @source_strike
end

#subtable_plansObject (readonly)

Returns the value of attribute subtable_plans.



10
11
12
# File 'lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb', line 10

def subtable_plans
  @subtable_plans
end

Instance Method Details

#add(placement) ⇒ Object

Add a placement, grouping into contiguous new-gid runs. A new run starts when the new gid skips, the ppem changes, or the image format changes.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb', line 20

def add(placement)
  current = @subtable_plans.last

  if current && placement.new_gid == current.last_new_gid + 1
    current.add(placement)
  else
    sub = ColorBitmapSubtablePlan.new(
      strike_ppem: placement.strike_ppem,
      image_format: placement.image_format,
    )
    sub.add(placement)
    @subtable_plans << sub
  end
end

#empty?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb', line 35

def empty?
  @subtable_plans.empty?
end

#subtable_countObject



39
40
41
# File 'lib/fontisan/subset/table_strategy/color_bitmap_strike_plan.rb', line 39

def subtable_count
  @subtable_plans.size
end