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.

Source Code
lib/ttfunk/table/cff.rb, line 47
47
def global_subr_index
48
  @global_subr_index
49
end

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

Table header.

Source Code
lib/ttfunk/table/cff.rb, line 31
31
def header
32
  @header
33
end

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

Name index.

Source Code
lib/ttfunk/table/cff.rb, line 35
35
def name_index
36
  @name_index
37
end

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

Strings index.

Source Code
lib/ttfunk/table/cff.rb, line 43
43
def string_index
44
  @string_index
45
end

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

Top dict index.

Source Code
lib/ttfunk/table/cff.rb, line 39
39
def top_index
40
  @top_index
41
end

Instance Method Details

#encode(subset) ⇒ TTFunk::EncodedString

Encode table.

Source Code
lib/ttfunk/table/cff.rb, line 60
60
def encode(subset)
61
  # Make sure TopDict has an entry for encoding so it could be properly replaced
62
  top_index[0][TopDict::OPERATORS[:encoding]] = 0
63
64
  EncodedString.new do |result|
65
    result.concat(
66
      header.encode,
67
      name_index.encode,
68
      top_index.encode,
69
      string_index.encode,
70
      global_subr_index.encode,
71
    )
72
73
    charmap = subset.new_cmap_table[:charmap]
74
    top_index[0].finalize(result, charmap)
75
  end
76
end

#tagString

Table tag.

Returns:

  • (String)
Source Code
lib/ttfunk/table/cff.rb, line 51
51
def tag
52
  TAG
53
end