Module: Pdfrb::Font::GlyphList

Defined in:
lib/pdfrb/font/glyph_list.rb

Overview

Adobe Glyph List — maps glyph names to Unicode codepoints. Loaded from data/pdfrb/glyphlist.txt on first access.

Class Method Summary collapse

Class Method Details

.[](glyph_name) ⇒ Object



22
23
24
# File 'lib/pdfrb/font/glyph_list.rb', line 22

def [](glyph_name)
  table[glyph_name]
end

.tableObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/pdfrb/font/glyph_list.rb', line 11

def table
  return @table if @table

  path = File.join(Pdfrb::DataDir.root, "glyphlist.txt")
  @table = if File.exist?(path)
             parse(File.read(path, encoding: "UTF-8"))
           else
             {}
           end
end

.unicode_for(glyph_name) ⇒ Object



26
27
28
# File 'lib/pdfrb/font/glyph_list.rb', line 26

def unicode_for(glyph_name)
  table[glyph_name]
end