class TTFunk::Table::Cff::CharstringsIndex
CFF Charstrings Index
.
Attributes
top_dict[R]
Top dict. @return [TTFunk::Table::Cff::TopDict]
Public Class Methods
new(top_dict, *remaining_args)
click to toggle source
@overload initialize(top_dict
, file, offset, length = nil)
@param top_dict [TTFunk::Table:Cff::TopDict] @param file [TTFunk::File] @param offset [Integer] @param length [Integer]
Calls superclass method
TTFunk::SubTable::new
# File lib/ttfunk/table/cff/charstrings_index.rb, line 17 def initialize(top_dict, *remaining_args) super(*remaining_args) @top_dict = top_dict end
Private Instance Methods
decode_item(index, _offset, _length)
click to toggle source
Calls superclass method
TTFunk::Table::Cff::Index#decode_item
# File lib/ttfunk/table/cff/charstrings_index.rb, line 24 def decode_item(index, _offset, _length) TTFunk::Table::Cff::Charstring.new(index, top_dict, font_dict_for(index), super) end
encode_items(charmap)
click to toggle source
# File lib/ttfunk/table/cff/charstrings_index.rb, line 28 def encode_items(charmap) charmap .reject { |code, mapping| mapping[:new].zero? && !code.zero? } .sort_by { |_code, mapping| mapping[:new] } .map { |(_code, mapping)| items[mapping[:old]] } end
font_dict_for(index)
click to toggle source
# File lib/ttfunk/table/cff/charstrings_index.rb, line 35 def font_dict_for(index) # only CID-keyed fonts contain an FD selector and font dicts if top_dict.is_cid_font? fd_index = top_dict.font_dict_selector[index] top_dict.font_index[fd_index] end end