1Font::TTF::OS_2(3) User Contributed Perl Documentation Font::TTF::OS_2(3)
2
3
4
6 Font::TTF::OS_2 - the OS/2 table in a TTF font
7
9 The OS/2 table has two versions and forms, one an extension of the
10 other. This module supports both forms and the switching between them.
11
13 No other variables than those in table and those in the standard:
14
15 Version
16 xAvgCharWidth
17 usWeightClass
18 usWidthClass
19 fsType
20 ySubscriptXSize
21 ySubScriptYSize
22 ySubscriptXOffset
23 ySubscriptYOffset
24 ySuperscriptXSize
25 ySuperscriptYSize
26 ySuperscriptXOffset
27 ySuperscriptYOffset
28 yStrikeoutSize
29 yStrikeoutPosition
30 sFamilyClass
31 bFamilyType
32 bSerifStyle
33 bWeight
34 bProportion
35 bContrast
36 bStrokeVariation
37 bArmStyle
38 bLetterform
39 bMidline
40 bXheight
41 ulUnicodeRange1
42 ulUnicodeRange2
43 ulUnicodeRange3
44 ulUnicodeRange4
45 achVendID
46 fsSelection
47 usFirstCharIndex
48 usLastCharIndex
49 sTypoAscender
50 sTypoDescender
51 sTypoLineGap
52 usWinAscent
53 usWinDescent
54 ulCodePageRange1
55 ulCodePageRange2
56 xHeight
57 CapHeight
58 defaultChar
59 breakChar
60 maxLookups
61
62 Notice that versions 0, 1, 2 & 3 of the table are supported. Notice
63 also that the Panose variable has been broken down into its elements.
64
66 $t->read
67 Reads in the various values from disk (see details of OS/2 table)
68
69 $t->out($fh)
70 Writes the table to a file either from memory or by copying.
71
72 $t->XML_element($context, $depth, $key, $value)
73 Tidies up the hex values to output them in hex
74
75 $t->XML_end($context, $tag, %attrs)
76 Now handle them on the way back in
77
78 $t->minsize()
79 Returns the minimum size this table can be. If it is smaller than this,
80 then the table must be bad and should be deleted or whatever.
81
82 $t->update
83 Updates the OS/2 table by getting information from other sources:
84
85 Updates the "firstChar" and "lastChar" values based on the MS table in
86 the cmap.
87
88 Updates the sTypoAscender, sTypoDescender & sTypoLineGap to be the same
89 values as Ascender, Descender and Linegap from the hhea table (assuming
90 it is dirty) and also sets usWinAscent to be the sum of
91 Ascender+Linegap and usWinDescent to be the negative of Descender.
92
93 $t->guessRangeBits (\%map, [$cp_threshold, [%u_threshold]])
94 Set the ulCodePageRange and ulUnicodeRange fields based on characters
95 actually present in the font.
96
97 %map is a hash keyed by USV returning non-zero for characters present
98 (e.g. use {'val'} a from Unicode cmap).
99
100 The two optional parameters are percentage of characters within the
101 codepage or unicode range that need to be present to constitute
102 coverage. A threshold of 0 causes corresponding range bits to be set if
103 any characters are present at all, while a negative value causes the
104 corresponding range bits to be unchanged. Defaults are 50 and 0,
105 respectively.
106
107 For codepage bits, the threshold is percentage of characters between
108 0xC0 and 0xFF that need to be present to constitute coverage). For
109 codepages other than 1252, characters (e.g., punctuation) that are
110 defined identically to cp1252 are ignored for the purposes of this
111 percentage calculation. Looks only for SBCS codepages, not DBCS.
112
113 For Unicode range bits that represent multiple ranges, e.g., bit 29
114 represents:
115
116 Latin Extended Additional 1E00-1EFF
117 Latin Extended-C 2C60-2C7F
118 Latin Extended-D A720-A7FF
119
120 the bit will be set if any of these ranges meet the threshold
121 requirement.
122
124 None known
125
127 Martin Hosken <http://scripts.sil.org/FontUtils>.
128
130 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
131
132 This module is released under the terms of the Artistic License 2.0.
133 For details, see the full text of the license in the file LICENSE.
134
135
136
137perl v5.32.0 2020-07-28 Font::TTF::OS_2(3)