class TTFunk::Table::Cff::CharstringsIndex

Attributes

top_dict[R]

Public Class Methods

new(top_dict, *remaining_args) click to toggle source
Calls superclass method TTFunk::SubTable::new
# File lib/ttfunk/table/cff/charstrings_index.rb, line 9
def initialize(top_dict, *remaining_args)
  super(*remaining_args)
  @top_dict = top_dict
end

Public Instance Methods

[](index) click to toggle source
Calls superclass method TTFunk::Table::Cff::Index#[]
# File lib/ttfunk/table/cff/charstrings_index.rb, line 14
def [](index)
  entry_cache[index] ||= TTFunk::Table::Cff::Charstring.new(
    index, top_dict, font_dict_for(index), super
  )
end
encode(mapping) click to toggle source

gets passed a mapping of new => old glyph ids

Calls superclass method TTFunk::Table::Cff::Index#encode
# File lib/ttfunk/table/cff/charstrings_index.rb, line 21
def encode(mapping)
  super() do |_entry, index|
    self[mapping[index]].encode if mapping.include?(index)
  end
end

Private Instance Methods

font_dict_for(index) click to toggle source
# File lib/ttfunk/table/cff/charstrings_index.rb, line 29
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