Class: TTFunk::Table::Cff

Inherits:
TTFunk::Table show all
Defined in:
lib/ttfunk/table/cff.rb,
lib/ttfunk/table/cff/dict.rb,
lib/ttfunk/table/cff/path.rb,
lib/ttfunk/table/cff/index.rb,
lib/ttfunk/table/cff/header.rb,
lib/ttfunk/table/cff/charset.rb,
lib/ttfunk/table/cff/charsets.rb,
lib/ttfunk/table/cff/encoding.rb,
lib/ttfunk/table/cff/top_dict.rb,
lib/ttfunk/table/cff/encodings.rb,
lib/ttfunk/table/cff/font_dict.rb,
lib/ttfunk/table/cff/top_index.rb,
lib/ttfunk/table/cff/charstring.rb,
lib/ttfunk/table/cff/font_index.rb,
lib/ttfunk/table/cff/subr_index.rb,
lib/ttfunk/table/cff/fd_selector.rb,
lib/ttfunk/table/cff/private_dict.rb,
lib/ttfunk/table/cff/charsets/expert.rb,
lib/ttfunk/table/cff/one_based_index.rb,
lib/ttfunk/table/cff/encodings/expert.rb,
lib/ttfunk/table/cff/charstrings_index.rb,
lib/ttfunk/table/cff/charsets/iso_adobe.rb,
lib/ttfunk/table/cff/encodings/standard.rb,
lib/ttfunk/table/cff/charsets/expert_subset.rb,
lib/ttfunk/table/cff/charsets/standard_strings.rb

Overview

Compact Font Format (‘CFF `) table

Defined Under Namespace

Modules: Charsets, Encodings Classes: Charset, Charstring, CharstringsIndex, Dict, Encoding, FdSelector, FontDict, FontIndex, Header, Index, OneBasedIndex, Path, PrivateDict, SubrIndex, TopDict, TopIndex

Constant Summary collapse

TAG =

Table tag. The extra space is important.

'CFF '

Instance Attribute Summary collapse

Attributes inherited from TTFunk::Table

#file, #length, #offset

Instance Method Summary collapse

Methods inherited from TTFunk::Table

#exists?, #initialize, #raw

Constructor Details

This class inherits a constructor from TTFunk::Table

Instance Attribute Details

#global_subr_indexTTFunk::Table::Cff::SubrIndex (readonly)

Global subroutine index.



47
48
49
# File 'lib/ttfunk/table/cff.rb', line 47

def global_subr_index
  @global_subr_index
end

#headerTTFunk::Table::Cff::Header (readonly)

Table header.



31
32
33
# File 'lib/ttfunk/table/cff.rb', line 31

def header
  @header
end

#name_indexTTFunk::Table::Cff::Index (readonly)

Name index.



35
36
37
# File 'lib/ttfunk/table/cff.rb', line 35

def name_index
  @name_index
end

#string_indexTTFunk::Table::Cff::OneBasedIndex (readonly)

Strings index.



43
44
45
# File 'lib/ttfunk/table/cff.rb', line 43

def string_index
  @string_index
end

#top_indexTTFunk::Table::Cff::TopIndex (readonly)

Top dict index.



39
40
41
# File 'lib/ttfunk/table/cff.rb', line 39

def top_index
  @top_index
end

Instance Method Details

#encode(subset) ⇒ TTFunk::EncodedString

Encode table.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ttfunk/table/cff.rb', line 60

def encode(subset)
  # Make sure TopDict has an entry for encoding so it could be properly replaced
  top_index[0][TopDict::OPERATORS[:encoding]] = 0

  EncodedString.new do |result|
    result.concat(
      header.encode,
      name_index.encode,
      top_index.encode,
      string_index.encode,
      global_subr_index.encode,
    )

    charmap = subset.new_cmap_table[:charmap]
    top_index[0].finalize(result, charmap)
  end
end

#tagString

Table tag.

Returns:

  • (String)


51
52
53
# File 'lib/ttfunk/table/cff.rb', line 51

def tag
  TAG
end