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