Sha256: 2c8645fcd46e2d594c3eb379713c26ffaa5fa9882c62b8515919195b7bb94186
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module TTFunk class Table class Cmap module Format12 attr_reader :language attr_reader :code_map def [](code) @code_map[code] || 0 end def supported? true end private def parse_cmap! # skip reserved USHORT io.read(2) # read length, language and nGroups length, @language, n_groups = read(12, "NNN") # read the groups into code_map cmap_data = io.read(12*n_groups) # ruby is too slow to loop trough the code_map in real time, so we need to # prepare data and to store this in a hash @code_map = {} n_groups.times{ |i| start_index = i*12 start_char_code,end_char_code,start_glyph_id = cmap_data[start_index..(start_index+12)].unpack("NNN") (start_char_code..end_char_code).each { |ch| @code_map[ch] = (ch-start_char_code) + start_glyph_id } } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glyph_imager-0.1.1 | vendor/ttfunk/lib/ttfunk/table/cmap/format12.rb |
glyph_imager-0.1.0 | vendor/ttfunk/lib/ttfunk/table/cmap/format12.rb |