Class: Fontisan::Subset::TableStrategy::Glyf

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

Overview

Glyf strategy: extract each subset glyph's bytes from the source glyf table (remapping composite component glyph IDs), build the corresponding loca offsets, and stash both into [SharedState] so the Loca strategy can read them. Also records the union bbox for the Head strategy.

Class Method Summary collapse

Class Method Details

.call(context:, tag:, table:) ⇒ String

Returns binary glyf bytes for the subset.

Parameters:

  • context (SubsetContext)
  • tag (String)

    "glyf"

  • table (Glyf)

    parsed glyf table (unused; builder reads the table from context.font directly so it sees the same instance)

Returns:

  • (String)

    binary glyf bytes for the subset



18
19
20
21
22
23
24
25
# File 'lib/fontisan/subset/table_strategy/glyf.rb', line 18

def self.call(context:, tag:, table:)
  builder = GlyfLocaBuilder.new(font: context.font,
                                mapping: context.mapping).build
  context.state.glyf_data = builder.glyf_data
  context.state.loca_offsets = builder.loca_offsets
  context.state.subset_bbox = builder.bbox
  builder.glyf_data
end