Class: TTFunk::Table::Maxp
- Inherits:
-
TTFunk::Table
- Object
- TTFunk::Table
- TTFunk::Table::Maxp
- Defined in:
- lib/ttfunk/table/maxp.rb
Overview
Maximum Profile (‘maxp`) table
Constant Summary collapse
- DEFAULT_MAX_COMPONENT_DEPTH =
Default maximum levels of recursion.
1
- MAX_V1_TABLE_LENGTH =
Size of full table version 1.
32
Instance Attribute Summary collapse
-
#max_component_contours ⇒ Integer
readonly
Maximum contours in a composite glyph.
-
#max_component_depth ⇒ Integer
readonly
Maximum levels of recursion.
-
#max_component_elements ⇒ Integer
readonly
Maximum number of components referenced at “top level” for any composite glyph.
-
#max_component_points ⇒ Integer
readonly
Maximum points in a composite glyph.
-
#max_contours ⇒ Integer
readonly
Maximum contours in a non-composite glyph.
-
#max_function_defs ⇒ Integer
readonly
Number of FDEFs.
-
#max_instruction_defs ⇒ Integer
readonly
Number of IDEFs.
-
#max_points ⇒ Integer
readonly
Maximum points in a non-composite glyph.
-
#max_size_of_instructions ⇒ Integer
readonly
Maximum byte count for glyph instructions.
-
#max_stack_elements ⇒ Integer
readonly
Maximum stack depth across Font Program, CVT Program and all glyph instructions.
-
#max_storage ⇒ Integer
readonly
Number of Storage Area locations.
-
#max_twilight_points ⇒ Integer
readonly
Maximum points used in Z0.
-
#max_zones ⇒ Integer
readonly
Maximum zones.
-
#num_glyphs ⇒ Integer
readonly
The number of glyphs in the font.
-
#version ⇒ Integer
readonly
Table version.
Attributes inherited from TTFunk::Table
Class Method Summary collapse
-
.encode(maxp, new2old_glyph) ⇒ String
Encode table.
Methods inherited from TTFunk::Table
#exists?, #initialize, #raw, #tag
Constructor Details
This class inherits a constructor from TTFunk::Table
Instance Attribute Details
#max_component_contours ⇒ Integer (readonly)
Maximum contours in a composite glyph.
37 38 39 |
# File 'lib/ttfunk/table/maxp.rb', line 37 def max_component_contours @max_component_contours end |
#max_component_depth ⇒ Integer (readonly)
Maximum levels of recursion.
77 78 79 |
# File 'lib/ttfunk/table/maxp.rb', line 77 def max_component_depth @max_component_depth end |
#max_component_elements ⇒ Integer (readonly)
Maximum number of components referenced at “top level” for any composite glyph.
73 74 75 |
# File 'lib/ttfunk/table/maxp.rb', line 73 def max_component_elements @max_component_elements end |
#max_component_points ⇒ Integer (readonly)
Maximum points in a composite glyph.
33 34 35 |
# File 'lib/ttfunk/table/maxp.rb', line 33 def max_component_points @max_component_points end |
#max_contours ⇒ Integer (readonly)
Maximum contours in a non-composite glyph.
29 30 31 |
# File 'lib/ttfunk/table/maxp.rb', line 29 def max_contours @max_contours end |
#max_function_defs ⇒ Integer (readonly)
Number of FDEFs.
55 56 57 |
# File 'lib/ttfunk/table/maxp.rb', line 55 def max_function_defs @max_function_defs end |
#max_instruction_defs ⇒ Integer (readonly)
Number of IDEFs.
59 60 61 |
# File 'lib/ttfunk/table/maxp.rb', line 59 def max_instruction_defs @max_instruction_defs end |
#max_points ⇒ Integer (readonly)
Maximum points in a non-composite glyph.
25 26 27 |
# File 'lib/ttfunk/table/maxp.rb', line 25 def max_points @max_points end |
#max_size_of_instructions ⇒ Integer (readonly)
Maximum byte count for glyph instructions.
68 69 70 |
# File 'lib/ttfunk/table/maxp.rb', line 68 def max_size_of_instructions @max_size_of_instructions end |
#max_stack_elements ⇒ Integer (readonly)
Maximum stack depth across Font Program, CVT Program and all glyph instructions.
64 65 66 |
# File 'lib/ttfunk/table/maxp.rb', line 64 def max_stack_elements @max_stack_elements end |
#max_storage ⇒ Integer (readonly)
Number of Storage Area locations.
51 52 53 |
# File 'lib/ttfunk/table/maxp.rb', line 51 def max_storage @max_storage end |
#max_twilight_points ⇒ Integer (readonly)
Maximum points used in Z0.
47 48 49 |
# File 'lib/ttfunk/table/maxp.rb', line 47 def max_twilight_points @max_twilight_points end |
#max_zones ⇒ Integer (readonly)
Maximum zones.
-
1 if instructions do not use the twilight zone (Z0)
-
2 if instructions do use Z0
43 44 45 |
# File 'lib/ttfunk/table/maxp.rb', line 43 def max_zones @max_zones end |
#num_glyphs ⇒ Integer (readonly)
The number of glyphs in the font.
21 22 23 |
# File 'lib/ttfunk/table/maxp.rb', line 21 def num_glyphs @num_glyphs end |
#version ⇒ Integer (readonly)
Table version.
17 18 19 |
# File 'lib/ttfunk/table/maxp.rb', line 17 def version @version end |
Class Method Details
.encode(maxp, new2old_glyph) ⇒ String
Encode table.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/ttfunk/table/maxp.rb', line 86 def encode(maxp, new2old_glyph) ''.b.tap do |table| num_glyphs = new2old_glyph.length table << [maxp.version, num_glyphs].pack('Nn') if maxp.version == 0x10000 stats = stats_for(maxp, glyphs_from_ids(maxp, new2old_glyph.values)) table << [ stats[:max_points], stats[:max_contours], stats[:max_component_points], stats[:max_component_contours], # these all come from the fpgm and cvt tables, which # we don't support at the moment maxp.max_zones, maxp.max_twilight_points, maxp.max_storage, maxp.max_function_defs, maxp.max_instruction_defs, maxp.max_stack_elements, stats[:max_size_of_instructions], stats[:max_component_elements], stats[:max_component_depth], ].pack('n*') end end end |