class TTFunk::Table::Cff::PrivateDict
Constants
- DEFAULT_WIDTH_X_DEFAULT
- DEFAULT_WIDTH_X_NOMINAL
- OPERATORS
- OPERATOR_CODES
- PLACEHOLDER_LENGTH
Public Instance Methods
default_width_x()
click to toggle source
# File lib/ttfunk/table/cff/private_dict.rb, line 56 def default_width_x if (width = self[OPERATORS[:default_width_x]]) width.first else DEFAULT_WIDTH_X_DEFAULT end end
encode(_mapping)
click to toggle source
@TODO: use mapping to determine which subroutines are still used. For now, just encode them all.
# File lib/ttfunk/table/cff/private_dict.rb, line 21 def encode(_mapping) EncodedString.new do |result| each do |operator, operands| case OPERATOR_CODES[operator] when :subrs result << encode_subrs else operands.each { |operand| result << encode_operand(operand) } end result << encode_operator(operator) end end end
finalize(private_dict_data)
click to toggle source
# File lib/ttfunk/table/cff/private_dict.rb, line 36 def finalize(private_dict_data) return unless subr_index encoded_subr_index = subr_index.encode encoded_offset = encode_integer32(private_dict_data.length) private_dict_data.resolve_placeholder( :"subrs_#{@table_offset}", encoded_offset ) private_dict_data << encoded_subr_index end
nominal_width_x()
click to toggle source
# File lib/ttfunk/table/cff/private_dict.rb, line 64 def nominal_width_x if (width = self[OPERATORS[:nominal_width_x]]) width.first else DEFAULT_WIDTH_X_NOMINAL end end
subr_index()
click to toggle source
# File lib/ttfunk/table/cff/private_dict.rb, line 49 def subr_index @subr_index ||= if (subr_offset = self[OPERATORS[:subrs]]) SubrIndex.new(file, table_offset + subr_offset.first) end end
Private Instance Methods
encode_subrs()
click to toggle source
# File lib/ttfunk/table/cff/private_dict.rb, line 74 def encode_subrs EncodedString.new.tap do |result| result << Placeholder.new( :"subrs_#{@table_offset}", length: PLACEHOLDER_LENGTH ) end end