Class: Ucode::Glyphs::Sources::Pillar3LastResort
- Inherits:
-
Ucode::Glyphs::Source
- Object
- Ucode::Glyphs::Source
- Ucode::Glyphs::Sources::Pillar3LastResort
- Defined in:
- lib/ucode/glyphs/sources/pillar3_last_resort.rb
Overview
Pillar 3 glyph source: Last Resort UFO placeholder outlines.
Wraps LastResort::Renderer, which chains cmap → contents → glif → svg for every codepoint the Last Resort Font's Format 13 cmap maps (essentially all of Unicode 0x0..0x10FFFF). This is the catch-all tier: any codepoint no higher tier produced a glyph for lands here and gets a placeholder outline.
The Renderer returns nil only for codepoints outside the cmap (extremely rare — the Format 13 cmap is exhaustive). For everything else it returns a LastResort::Renderer::Result with the SVG. We adapt that to Ucode::Glyphs::Source::Result.
Instance Method Summary collapse
-
#fetch(codepoint) ⇒ Result?
Nil when this source cannot produce a glyph.
-
#initialize(renderer:) ⇒ Pillar3LastResort
constructor
A new instance of Pillar3LastResort.
-
#provenance ⇒ String
"pillar-3:last-resort".
-
#tier ⇒ Symbol
:pillar3.
Constructor Details
#initialize(renderer:) ⇒ Pillar3LastResort
Returns a new instance of Pillar3LastResort.
25 26 27 28 |
# File 'lib/ucode/glyphs/sources/pillar3_last_resort.rb', line 25 def initialize(renderer:) super() @renderer = renderer end |
Instance Method Details
#fetch(codepoint) ⇒ Result?
Returns nil when this source cannot produce a glyph.
41 42 43 44 45 46 47 |
# File 'lib/ucode/glyphs/sources/pillar3_last_resort.rb', line 41 def fetch(codepoint) result = @renderer.render(codepoint) return nil unless result&.ok? Result.new(tier: tier, codepoint: codepoint, svg: result.svg, provenance: provenance) end |
#provenance ⇒ String
Returns "pillar-3:last-resort".
36 37 38 |
# File 'lib/ucode/glyphs/sources/pillar3_last_resort.rb', line 36 def provenance "pillar-3:last-resort" end |
#tier ⇒ Symbol
Returns :pillar3.
31 32 33 |
# File 'lib/ucode/glyphs/sources/pillar3_last_resort.rb', line 31 def tier :pillar3 end |