Class: Ucode::Glyphs::Source
- Inherits:
-
Object
- Object
- Ucode::Glyphs::Source
- Defined in:
- lib/ucode/glyphs/source.rb
Overview
Abstract glyph source — one tier of the 4-tier sourcing strategy.
The canonical Resolver holds an ordered array of Source subclasses and returns the first non-nil Result for a given codepoint. Each tier is one subclass:
* Tier 1 — {Sources::Tier1RealFont}: real-font cmap + outline
extraction (highest fidelity).
* Pillar 1 — {Sources::Pillar1EmbeddedTounicode}: PDF-embedded
CIDFont + /ToUnicode CMap.
* Pillar 2 — {Sources::Pillar2Correlator}: PDF content-stream
positional correlation for fonts without /ToUnicode.
* Pillar 3 — {Sources::Pillar3LastResort}: Last Resort UFO
placeholder outlines (catches the tail).
Subclasses must implement #tier, #provenance, and #fetch. #fetch returns nil when the source cannot produce a glyph for the given codepoint — this is NOT an error, it's the signal for the resolver to try the next source.
Direct Known Subclasses
Ucode::Glyphs::Sources::Pillar1EmbeddedTounicode, Ucode::Glyphs::Sources::Pillar3LastResort, Ucode::Glyphs::Sources::Tier1RealFont
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#fetch(codepoint) ⇒ Result?
Nil when this source cannot produce a glyph.
-
#provenance ⇒ String
Dotted provenance string, e.g.
-
#tier ⇒ Symbol
One of :tier1, :pillar1, :pillar2, :pillar3.
Instance Method Details
#fetch(codepoint) ⇒ Result?
Returns nil when this source cannot produce a glyph.
43 44 45 |
# File 'lib/ucode/glyphs/source.rb', line 43 def fetch(codepoint) raise NotImplementedError end |
#provenance ⇒ String
Returns dotted provenance string, e.g. "tier-1:lentariso", "pillar-3:last-resort".
37 38 39 |
# File 'lib/ucode/glyphs/source.rb', line 37 def provenance raise NotImplementedError end |
#tier ⇒ Symbol
Returns one of :tier1, :pillar1, :pillar2, :pillar3.
31 32 33 |
# File 'lib/ucode/glyphs/source.rb', line 31 def tier raise NotImplementedError end |