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:



34
35
36
37
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 34

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



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 50

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

  Result.new(
    tier: tier,
    codepoint: codepoint,
    svg: result.svg,
    provenance: provenance,
    base_font: result.base_font,
    gid: result.gid,
    source_page: result.source_page,
    source_cell: result.source_cell,
  )
end

#provenanceString

Returns "pillar-1:embedded-tounicode".

Returns:

  • (String)

    "pillar-1:embedded-tounicode"



45
46
47
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 45

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

#tierSymbol

Returns :pillar1.

Returns:

  • (Symbol)

    :pillar1



40
41
42
# File 'lib/ucode/glyphs/sources/pillar1_embedded_tounicode.rb', line 40

def tier
  :pillar1
end