class TTFunk::Table::Cff::FontDict
Constants
- OPERATORS
- OPERATOR_CODES
- PLACEHOLDER_LENGTH
Attributes
top_dict[R]
Public Class Methods
new(top_dict, file, offset, length = nil)
click to toggle source
Calls superclass method
TTFunk::SubTable::new
# File lib/ttfunk/table/cff/font_dict.rb, line 13 def initialize(top_dict, file, offset, length = nil) @top_dict = top_dict super(file, offset, length) end
Public Instance Methods
encode(_mapping)
click to toggle source
# File lib/ttfunk/table/cff/font_dict.rb, line 18 def encode(_mapping) EncodedString.new do |result| each do |operator, operands| case OPERATOR_CODES[operator] when :private result << encode_private else operands.each { |operand| result << encode_operand(operand) } end result << encode_operator(operator) end end end
finalize(new_cff_data, mapping)
click to toggle source
# File lib/ttfunk/table/cff/font_dict.rb, line 33 def finalize(new_cff_data, mapping) encoded_private_dict = private_dict.encode(mapping) encoded_offset = encode_integer32(new_cff_data.length) encoded_length = encode_integer32(encoded_private_dict.length) new_cff_data.resolve_placeholder( :"private_length_#{@table_offset}", encoded_length ) new_cff_data.resolve_placeholder( :"private_offset_#{@table_offset}", encoded_offset ) private_dict.finalize(encoded_private_dict) new_cff_data << encoded_private_dict end
private_dict()
click to toggle source
# File lib/ttfunk/table/cff/font_dict.rb, line 50 def private_dict @private_dict ||= if (info = self[OPERATORS[:private]]) private_dict_length, private_dict_offset = info PrivateDict.new( file, top_dict.cff_offset + private_dict_offset, private_dict_length ) end end
Private Instance Methods
encode_private()
click to toggle source
# File lib/ttfunk/table/cff/font_dict.rb, line 65 def encode_private EncodedString.new do |result| result << Placeholder.new( :"private_length_#{@table_offset}", length: PLACEHOLDER_LENGTH ) result << Placeholder.new( :"private_offset_#{@table_offset}", length: PLACEHOLDER_LENGTH ) end end