Class: Ucode::Glyphs::Sources::Pillar1EmbeddedTounicode

Inherits:
Ucode::Glyphs::Source show all
Defined in:
lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb

Overview

Pillar 1 glyph source: Code Charts PDF-embedded CIDFont outlines resolved via /ToUnicode CMap.

Delegates to EmbeddedFonts::Renderer, which walks the PDF object graph (Type0 → CIDFont → FontDescriptor → FontFile2/3), looks up the GID via /ToUnicode, and renders the outline as a standalone SVG via EmbeddedFonts::Svg.

Pillar 2 unification

TODO 20 lists a separate Sources::Pillar2Correlator class. It is intentionally omitted. ContentStreamCorrelator alone returns Hash{Integer=>Integer} (codepoint → GID mappings), not SVGs; it only produces SVGs when invoked through EmbeddedFonts::Catalog via its correlator_configs: registry. The Catalog already unifies pillars 1 and 2 at index-build time, so a Source-layer split would either duplicate the Catalog's index or require tagging each FontEntry with the sub-mechanism that served it — both violations of MECE. Pillar 2 fallback is configured by constructing the wrapped Catalog with correlator_configs:.

Instance Method Summary collapse

Constructor Details

#initialize(renderer:) ⇒ Pillar1EmbeddedTounicode

Returns a new instance of Pillar1EmbeddedTounicode.

Parameters:



37
38
39
40
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 37

def initialize(renderer:)
  super()
  @renderer = renderer
end

Instance Method Details

#fetch(codepoint) ⇒ Result?

Returns nil when this source cannot produce a glyph.

Parameters:

  • codepoint (Integer)

Returns:

  • (Result, nil)

    nil when this source cannot produce a glyph



53
54
55
56
57
58
59
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 53

def fetch(codepoint)
  result = @renderer.render(codepoint)
  return nil unless result

  Result.new(tier: tier, codepoint: codepoint,
             svg: result.svg, provenance: provenance)
end

#provenanceString

Returns "pillar-1:embedded-tounicode".

Returns:

  • (String)

    "pillar-1:embedded-tounicode"



48
49
50
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 48

def provenance
  "pillar-1:embedded-tounicode"
end

#tierSymbol

Returns :pillar1.

Returns:

  • (Symbol)

    :pillar1



43
44
45
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 43

def tier
  :pillar1
end