Class: Fontisan::Subset::SharedState
- Inherits:
-
Object
- Object
- Fontisan::Subset::SharedState
- Defined in:
- lib/fontisan/subset/shared_state.rb
Overview
Per-subsetting shared state.
Several subset strategies depend on values computed by earlier strategies during the same subsetting run:
- `subset_max_advance` is computed by the Hmtx strategy and read
by Hhea (because hhea is processed alphabetically before hmtx).
- `glyf_data`, `loca_offsets`, and `subset_bbox` are computed by
the Glyf strategy and consumed by Loca and Head.
Rather than giving each TableStrategy access to the entire TableSubsetter (which would couple them to internals), the cross-strategy state lives here. Each strategy receives a Context exposing [font], [mapping], [options], and this [SharedState].
Instance Attribute Summary collapse
-
#color_bitmap_subsetter ⇒ TableStrategy::ColorBitmapSubsetter?
Cached paired CBDT+CBLC subsetter so both strategies reuse the same pass.
-
#glyf_data ⇒ String?
Binary glyf data built by the Glyf strategy.
-
#loca_offsets ⇒ Array<Integer>?
Loca offsets produced by the Glyf strategy.
-
#subset_bbox ⇒ Array(Integer, Integer, Integer, Integer)?
Union xMin/yMin/xMax/yMax over the subset's glyphs.
-
#subset_max_advance ⇒ Integer
Largest advanceWidth seen while subsetting hmtx.
Instance Method Summary collapse
-
#initialize ⇒ SharedState
constructor
A new instance of SharedState.
Constructor Details
#initialize ⇒ SharedState
Returns a new instance of SharedState.
37 38 39 |
# File 'lib/fontisan/subset/shared_state.rb', line 37 def initialize @subset_max_advance = 0 end |
Instance Attribute Details
#color_bitmap_subsetter ⇒ TableStrategy::ColorBitmapSubsetter?
Returns cached paired CBDT+CBLC subsetter so both strategies reuse the same pass.
35 36 37 |
# File 'lib/fontisan/subset/shared_state.rb', line 35 def color_bitmap_subsetter @color_bitmap_subsetter end |
#glyf_data ⇒ String?
Returns binary glyf data built by the Glyf strategy.
21 22 23 |
# File 'lib/fontisan/subset/shared_state.rb', line 21 def glyf_data @glyf_data end |
#loca_offsets ⇒ Array<Integer>?
Returns loca offsets produced by the Glyf strategy.
24 25 26 |
# File 'lib/fontisan/subset/shared_state.rb', line 24 def loca_offsets @loca_offsets end |
#subset_bbox ⇒ Array(Integer, Integer, Integer, Integer)?
Returns union xMin/yMin/xMax/yMax over the subset's glyphs.
28 29 30 |
# File 'lib/fontisan/subset/shared_state.rb', line 28 def subset_bbox @subset_bbox end |
#subset_max_advance ⇒ Integer
Returns largest advanceWidth seen while subsetting hmtx.
31 32 33 |
# File 'lib/fontisan/subset/shared_state.rb', line 31 def subset_max_advance @subset_max_advance end |