3 \environment luatex-style
4 \environment luatex-logos
6 \startcomponent luatex-fontloader
8 \startchapter[reference=fontloader,title=
{The fontloader
}]
10 The fontloader library is sort of independent of the rest in the sense that it
11 can load font into a
\LUA\ table that then can be converted into a table suitable
12 for
\TEX. The library is an adapted subset of
\FONTFORGE\ and as such gives a
13 similar view on a font (which has advantages when you want to debug.)
15 \section{Getting quick information on a font
}
17 When you want to locate font by name you need some basic information that is
18 hidden in the font files. For that reason we provide an efficient helper that
19 gets the basic information without loading all of the font. Normally this helper
20 is used to create a font (name) database.
24 fontloader.info(<string> filename)
27 This function returns either
\type {nil
}, or a
\type {table
}, or an array of
28 small tables (in the case of a
\TRUETYPE\ collection). The returned table(s) will
29 contain some fairly interesting information items from the font(s) defined by the
32 \starttabulate[|lT|l|p|
]
33 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
34 \NC fontname
\NC string
\NC the
\POSTSCRIPT\ name of the font
\NC \NR
35 \NC fullname
\NC string
\NC the formal name of the font
\NC \NR
36 \NC familyname
\NC string
\NC the family name this font belongs to
\NC \NR
37 \NC weight
\NC string
\NC a string indicating the
color value of the font
\NC \NR
38 \NC version
\NC string
\NC the internal font version
\NC \NR
39 \NC italicangle
\NC float
\NC the slant angle
\NC \NR
40 \NC units_per_em
\NC number
\NC 1000 for
\POSTSCRIPT-based fonts, usually
2048 for
\TRUETYPE\NC \NR
41 \NC pfminfo
\NC table
\NC (see
\in{section
}[fontloaderpfminfotable
])
\NC \NR
44 Getting information through this function is (sometimes much) more efficient than
45 loading the font properly, and is therefore handy when you want to create a
46 dictionary of available fonts based on a directory contents.
48 \section{Loading an
\OPENTYPE\ or
\TRUETYPE\ file
}
50 If you want to use an
\OPENTYPE\ font, you have to get the metric information
51 from somewhere. Using the
\type {fontloader
} library, the simplest way to get
52 that information is thus:
55 function load_font (filename)
57 local font = fontloader.open(filename)
59 metrics = fontloader.to_table(font)
60 fontloader.close(font)
65 myfont = load_font('/opt/tex/texmf/fonts/data/arial.ttf')
68 The main function call is
71 <userdata> f, <table> w = fontloader.open(<string> filename)
72 <userdata> f, <table> w = fontloader.open(<string> filename, <string> fontname)
75 The first return value is a userdata representation of the font. The second
76 return value is a table containing any warnings and errors reported by fontloader
77 while opening the font. In normal typesetting, you would probably ignore the
78 second argument, but it can be useful for debugging purposes.
80 For
\TRUETYPE\ collections (when filename ends in 'ttc') and
\DFONT\ collections,
81 you have to use a second string argument to specify which font you want from the
82 collection. Use the
\type {fontname
} strings that are returned by
\type
83 {fontloader.info
} for that.
85 To turn the font into a table,
\type {fontloader.to_table
} is used on the font
86 returned by
\type {fontloader.open
}.
89 <table> f = fontloader.to_table(<userdata> font)
92 This table cannot be used directly by
\LUATEX\ and should be turned into another
93 one as described in~
\in {chapter
} [fonts
]. Do not forget to store the
\type
94 {fontname
} value in the
\type {psname
} field of the metrics table to be returned
95 to
\LUATEX, otherwise the font inclusion backend will not be able to find the
96 correct font in the collection.
98 See
\in {section
} [fontloadertables
] for details on the userdata object returned
99 by
\type {fontloader.open()
} and the layout of the
\type {metrics
} table returned
100 by
\type {fontloader.to_table()
}.
102 The font file is parsed and partially interpreted by the font loading routines
103 from
\FONTFORGE. The file format can be
\OPENTYPE,
\TRUETYPE,
\TRUETYPE\
104 Collection,
\CFF, or
\TYPEONE.
106 There are a few advantages to this approach compared to reading the actual font
112 The font is automatically re|-|encoded, so that the
\type {metrics
} table for
113 \TRUETYPE\ and
\OPENTYPE\ fonts is using
\UNICODE\ for the character indices.
117 Many features are pre|-|processed into a format that is easier to handle than
118 just the bare tables would be.
122 \POSTSCRIPT|-|based
\OPENTYPE\ fonts do not store the character height and
123 depth in the font file, so the character boundingbox has to be calculated in
128 In the future, it may be interesting to allow
\LUA\ scripts access to
129 the font program itself, perhaps even creating or changing the font.
134 A loaded font is discarded with:
137 fontloader.close(<userdata> font)
140 \section{Applying a
\quote{feature file
}}
142 You can apply a
\quote{feature file
} to a loaded font:
145 <table> errors = fontloader.apply_featurefile(<userdata> font, <string> filename)
148 A
\quote {feature file
} is a textual representation of the features in an
152 http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
158 http://fontforge.sourceforge.net/featurefile.html
161 for a more detailed description of feature files.
163 If the function fails, the return value is a table containing any errors reported
164 by fontloader while applying the feature file. On success,
\type {nil
} is
167 \section{Applying an
\quote{\AFM\ file
}}
169 You can apply an
\quote {\AFM\ file
} to a loaded font:
172 <table> errors = fontloader.apply_afmfile(<userdata> font, <string> filename)
175 An
\AFM\ file is a textual representation of (some of) the meta information
176 in a
\TYPEONE\ font. See
179 ftp://ftp.math.utah.edu/u/ma/hohn/linux/postscript/
5004.AFM_Spec.pdf
182 for more information about
\AFM\ files.
184 Note: If you
\type {fontloader.open()
} a
\TYPEONE\ file named
\type {font.pfb
},
185 the library will automatically search for and apply
\type {font.afm
} if it exists
186 in the same directory as the file
\type {font.pfb
}. In that case, there is no
187 need for an explicit call to
\type {apply_afmfile()
}.
189 If the function fails, the return value is a table containing any errors reported
190 by fontloader while applying the AFM file. On success,
\type {nil
} is returned.
192 \section[fontloadertables
]{Fontloader font tables
}
194 As mentioned earlier, the return value of
\type {fontloader.open()
} is a userdata
195 object. One way to have access to the actual metrics is to call
\type
196 {fontloader.to_table()
} on this object, returning the table structure that is
197 explained in the following sections. In teh following sections we will not
198 explain each field in detail. Most fields are self descriptive and for the more
199 technical aspects you need to consult the relevant font references.
201 It turns out that the result from
\type {fontloader.to_table()
} sometimes needs
202 very large amounts of memory (depending on the font's complexity and size) so it
203 is possible to access the userdata object directly.
207 All top|-|level keys that would be returned by
\type {to_table()
}
208 can also be accessed directly.
211 The top|-|level key
\quote {glyphs
} returns a
{\it virtual\/
} array that
212 allows indices from
\type {f.glyphmin
} to (
\type {f.glyphmax
}).
215 The items in that virtual array (the actual glyphs) are themselves also
216 userdata objects, and each has accessors for all of the keys explained in the
217 section
\quote {Glyph items
} below.
220 The top|-|level key
\quote {subfonts
} returns an
{\it actual
} array of userdata
221 objects, one for each of the subfonts (or nil, if there are no subfonts).
225 A short example may be helpful. This code generates a printout of all
226 the glyph names in the font
\type {PunkNova.kern.otf
}:
229 local f = fontloader.open('PunkNova.kern.otf')
232 if f.glyphcnt >
0 then
233 for i=f.glyphmin,f.glyphmax do
234 local g = f.glyphs
[i
]
244 In this case, the
\LUATEX\ memory requirement stays below
100MB on the test
245 computer, while the internal structure generated by
\type {to_table()
} needs more
246 than
2GB of memory (the font itself is
6.9MB in disk size).
248 Only the top|-|level font, the subfont table entries, and the glyphs are virtual
249 objects, everything else still produces normal
\LUA\ values and tables.
251 If you want to know the valid fields in a font or glyph structure, call the
\type
252 {fields
} function on an object of a particular type (either glyph or font):
255 <table> fields = fontloader.fields(<userdata> font)
256 <table> fields = fontloader.fields(<userdata> font_glyph)
262 local fields = fontloader.fields(f)
263 local fields = fontloader.fields(f.glyphs
[0])
266 \subsection{Table types
}
268 \subsubsection{Top-level
}
270 The top|-|level keys in the returned table are (the explanations in this part of
271 the documentation are not yet finished):
273 \starttabulate[|lT|l|p|
]
274 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
275 \NC table_version
\NC number
\NC indicates the metrics version (currently~
0.3)
\NC \NR
276 \NC fontname
\NC string
\NC \POSTSCRIPT\ font name
\NC \NR
277 \NC fullname
\NC string
\NC official (human-oriented) font name
\NC \NR
278 \NC familyname
\NC string
\NC family name
\NC \NR
279 \NC weight
\NC string
\NC weight indicator
\NC \NR
280 \NC copyright
\NC string
\NC copyright information
\NC \NR
281 \NC filename
\NC string
\NC the file name
\NC \NR
282 \NC version
\NC string
\NC font version
\NC \NR
283 \NC italicangle
\NC float
\NC slant angle
\NC \NR
284 \NC units_per_em
\NC number
\NC 1000 for
\POSTSCRIPT-based fonts, usually
2048 for
\TRUETYPE\NC \NR
285 \NC ascent
\NC number
\NC height of ascender in
\type {units_per_em
}\NC \NR
286 \NC descent
\NC number
\NC depth of descender in
\type {units_per_em
}\NC \NR
287 \NC upos
\NC float
\NC \NC \NR
288 \NC uwidth
\NC float
\NC \NC \NR
289 \NC uniqueid
\NC number
\NC \NC \NR
290 \NC glyphs
\NC array
\NC \NC \NR
291 \NC glyphcnt
\NC number
\NC number of included glyphs
\NC \NR
292 \NC glyphmax
\NC number
\NC maximum used index the glyphs array
\NC \NR
293 \NC glyphmin
\NC number
\NC minimum used index the glyphs array
\NC \NR
294 \NC notdef_loc
\NC number
\NC location of the
\type {.notdef
} glyph
295 or
\type {-
1} when not present
\NC \NR
296 \NC hasvmetrics
\NC number
\NC \NC \NR
297 \NC onlybitmaps
\NC number
\NC \NC \NR
298 \NC serifcheck
\NC number
\NC \NC \NR
299 \NC isserif
\NC number
\NC \NC \NR
300 \NC issans
\NC number
\NC \NC \NR
301 \NC encodingchanged
\NC number
\NC \NC \NR
302 \NC strokedfont
\NC number
\NC \NC \NR
303 \NC use_typo_metrics
\NC number
\NC \NC \NR
304 \NC weight_width_slope_only
\NC number
\NC \NC \NR
305 \NC head_optimized_for_cleartype
\NC number
\NC \NC \NR
306 \NC uni_interp
\NC enum
\NC \type {unset
},
\type {none
},
\type {adobe
},
307 \type {greek
},
\type {japanese
},
\type {trad_chinese
},
308 \type {simp_chinese
},
\type {korean
},
\type {ams
}\NC \NR
309 \NC origname
\NC string
\NC the file name, as supplied by the user
\NC \NR
310 \NC map
\NC table
\NC \NC \NR
311 \NC private
\NC table
\NC \NC \NR
312 \NC xuid
\NC string
\NC \NC \NR
313 \NC pfminfo
\NC table
\NC \NC \NR
314 \NC names
\NC table
\NC \NC \NR
315 \NC cidinfo
\NC table
\NC \NC \NR
316 \NC subfonts
\NC array
\NC \NC \NR
317 \NC commments
\NC string
\NC \NC \NR
318 \NC fontlog
\NC string
\NC \NC \NR
319 \NC cvt_names
\NC string
\NC \NC \NR
320 \NC anchor_classes
\NC table
\NC \NC \NR
321 \NC ttf_tables
\NC table
\NC \NC \NR
322 \NC ttf_tab_saved
\NC table
\NC \NC \NR
323 \NC kerns
\NC table
\NC \NC \NR
324 \NC vkerns
\NC table
\NC \NC \NR
325 \NC texdata
\NC table
\NC \NC \NR
326 \NC lookups
\NC table
\NC \NC \NR
327 \NC gpos
\NC table
\NC \NC \NR
328 \NC gsub
\NC table
\NC \NC \NR
329 \NC mm
\NC table
\NC \NC \NR
330 \NC chosenname
\NC string
\NC \NC \NR
331 \NC macstyle
\NC number
\NC \NC \NR
332 \NC fondname
\NC string
\NC \NC \NR
333 %NC design_size \NC number \NC \NC \NR
334 \NC fontstyle_id
\NC number
\NC \NC \NR
335 \NC fontstyle_name
\NC table
\NC \NC \NR
336 %NC design_range_bottom \NC number \NC \NC \NR
337 %NC design_range_top \NC number \NC \NC \NR
338 \NC strokewidth
\NC float
\NC \NC \NR
339 \NC mark_classes
\NC table
\NC \NC \NR
340 \NC creationtime
\NC number
\NC \NC \NR
341 \NC modificationtime
\NC number
\NC \NC \NR
342 \NC os2_version
\NC number
\NC \NC \NR
343 \NC sfd_version
\NC number
\NC \NC \NR
344 \NC math
\NC table
\NC \NC \NR
345 \NC validation_state
\NC table
\NC \NC \NR
346 \NC horiz_base
\NC table
\NC \NC \NR
347 \NC vert_base
\NC table
\NC \NC \NR
348 \NC extrema_bound
\NC number
\NC \NC \NR
349 \NC truetype
\NC boolean
\NC signals a
\TRUETYPE\ font
\NC \NR
352 \subsubsection{Glyph items
}
354 The
\type {glyphs
} is an array containing the per|-|character
355 information (quite a few of these are only present if nonzero).
357 \starttabulate[|lT|l|p|
]
358 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
359 \NC name
\NC string
\NC the glyph name
\NC \NR
360 \NC unicode
\NC number
\NC unicode code point, or -
1 \NC \NR
361 \NC boundingbox
\NC array
\NC array of four numbers, see note below
\NC \NR
362 \NC width
\NC number
\NC only for horizontal fonts
\NC \NR
363 \NC vwidth
\NC number
\NC only for vertical fonts
\NC \NR
364 \NC tsidebearing
\NC number
\NC only for vertical ttf/otf fonts, and only if nonzero
\NC \NR
365 \NC lsidebearing
\NC number
\NC only if nonzero and not equal to boundingbox
[1] \NC \NR
366 \NC class
\NC string
\NC one of "none", "base", "ligature", "mark", "component"
367 (if not present, the glyph class is
\quote {automatic
})
\NC \NR
368 \NC kerns
\NC array
\NC only for horizontal fonts, if set
\NC \NR
369 \NC vkerns
\NC array
\NC only for vertical fonts, if set
\NC \NR
370 \NC dependents
\NC array
\NC linear array of glyph name strings, only if nonempty
\NC \NR
371 \NC lookups
\NC table
\NC only if nonempty
\NC \NR
372 \NC ligatures
\NC table
\NC only if nonempty
\NC \NR
373 \NC anchors
\NC table
\NC only if set
\NC \NR
374 \NC comment
\NC string
\NC only if set
\NC \NR
375 \NC tex_height
\NC number
\NC only if set
\NC \NR
376 \NC tex_depth
\NC number
\NC only if set
\NC \NR
377 \NC italic_correction
\NC number
\NC only if set
\NC \NR
378 \NC top_accent
\NC number
\NC only if set
\NC \NR
379 \NC is_extended_shape
\NC number
\NC only if this character is part of a math extension list
\NC \NR
380 \NC altuni
\NC table
\NC alternate
\UNICODE\ items
\NC \NR
381 \NC vert_variants
\NC table
\NC \NC \NR
382 \NC horiz_variants
\NC table
\NC \NC \NR
383 \NC mathkern
\NC table
\NC \NC \NR
386 On
\type {boundingbox
}: The boundingbox information for
\TRUETYPE\ fonts and
387 \TRUETYPE-based
\OTF\ fonts is read directly from the font file.
388 \POSTSCRIPT-based fonts do not have this information, so the boundingbox of
389 traditional
\POSTSCRIPT\ fonts is generated by interpreting the actual bezier
390 curves to find the exact boundingbox. This can be a slow process, so the
391 boundingboxes of
\POSTSCRIPT-based
\OTF\ fonts (and raw
\CFF\ fonts) are
392 calculated using an approximation of the glyph shape based on the actual glyph
393 points only, instead of taking the whole curve into account. This means that
394 glyphs that have missing points at extrema will have a too|-|tight boundingbox,
395 but the processing is so much faster that in our opinion the tradeoff is worth
398 The
\type {kerns
} and
\type {vkerns
} are linear arrays of small hashes:
400 \starttabulate[|lT|l|p|
]
401 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
402 \NC char
\NC string
\NC \NC \NR
403 \NC off
\NC number
\NC \NC \NR
404 \NC lookup
\NC string
\NC \NC \NR
407 The
\type {lookups
} is a hash, based on lookup subtable names, with
408 the value of each key inside that a linear array of small hashes:
410 % TODO: fix this description
411 \starttabulate[|lT|l|p|
]
412 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
413 \NC type
\NC enum
\NC \type {position
},
\type {pair
},
\type
414 {substitution
},
\type {alternate
},
\type
415 {multiple
},
\type {ligature
},
\type {lcaret
},
416 \type {kerning
},
\type {vkerning
},
\type
417 {anchors
},
\type {contextpos
},
\type
418 {contextsub
},
\type {chainpos
},
\type
419 {chainsub
},
\type {reversesub
},
\type {max
},
420 \type {kernback
},
\type {vkernback
} \NC \NR
421 \NC specification
\NC table
\NC extra data
\NC \NR
424 For the first seven values of
\type {type
}, there can be additional
425 sub|-|information, stored in the sub-table
\type {specification
}:
427 \starttabulate[|lT|l|p|
]
428 \NC \rmbf value
\NC \bf type
\NC \bf explanation
\NC \NR
429 \NC position
\NC table
\NC a table of the
\type {offset_specs
} type
\NC \NR
430 \NC pair
\NC table
\NC one string:
\type {paired
}, and an array of one
431 or two
\type {offset_specs
} tables:
\type
433 \NC substitution
\NC table
\NC one string:
\type {variant
} \NC \NR
434 \NC alternate
\NC table
\NC one string:
\type {components
} \NC \NR
435 \NC multiple
\NC table
\NC one string:
\type {components
} \NC \NR
436 \NC ligature
\NC table
\NC two strings:
\type {components
},
\type {char
} \NC \NR
437 \NC lcaret
\NC array
\NC linear array of numbers
\NC \NR
440 Tables for
\type {offset_specs
} contain up to four number|-|valued fields:
\type
441 {x
} (a horizontal offset),
\type {y
} (a vertical offset),
\type {h
} (an advance
442 width correction) and
\type {v
} (an advance height correction).
444 The
\type {ligatures
} is a linear array of small hashes:
446 \starttabulate[|lT|l|p|
]
447 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
448 \NC lig
\NC table
\NC uses the same substructure as a single item in
449 the
\type {lookups
} table explained above
\NC \NR
450 \NC char
\NC string
\NC \NC \NR
451 \NC components
\NC array
\NC linear array of named components
\NC \NR
452 \NC ccnt
\NC number
\NC \NC \NR
455 The
\type {anchor
} table is indexed by a string signifying the anchor type, which
458 \starttabulate[|lT|l|p|
]
459 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
460 \NC mark
\NC table
\NC placement mark
\NC \NR
461 \NC basechar
\NC table
\NC mark for attaching combining items to a base char
\NC \NR
462 \NC baselig
\NC table
\NC mark for attaching combining items to a ligature
\NC \NR
463 \NC basemark
\NC table
\NC generic mark for attaching combining items to connect to
\NC \NR
464 \NC centry
\NC table
\NC cursive entry point
\NC \NR
465 \NC cexit
\NC table
\NC cursive exit point
\NC \NR
468 The content of these is a short array of defined anchors, with the
469 entry keys being the anchor names. For all except
\type {baselig
}, the
470 value is a single table with this definition:
472 \starttabulate[|lT|l|p|
]
473 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
474 \NC x
\NC number
\NC x location
\NC \NR
475 \NC y
\NC number
\NC y location
\NC \NR
476 \NC ttf_pt_index
\NC number
\NC truetype point index, only if given
\NC \NR
479 For
\type {baselig
}, the value is a small array of such anchor sets sets, one for
480 each constituent item of the ligature.
482 For clarification, an anchor table could for example look like this :
487 ['Anchor-
7'
] =
{ ['x'
]=
170,
['y'
]=
1080 }
490 ['Anchor-
1'
] =
{ ['x'
]=
160,
['y'
]=
810 },
491 ['Anchor-
4'
] =
{ ['x'
]=
160,
['y'
]=
800 }
494 [1] =
{ ['Anchor-
2'
] =
{ ['x'
]=
160,
['y'
]=
650 } },
495 [2] =
{ ['Anchor-
2'
] =
{ ['x'
]=
460,
['y'
]=
640 } }
500 Note: The
\type {baselig
} table can be sparse!
502 \subsubsection{map table
}
504 The top|-|level map is a list of encoding mappings. Each of those is a table
507 \starttabulate[|lT|l|p|
]
508 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
509 \NC enccount
\NC number
\NC \NC \NR
510 \NC encmax
\NC number
\NC \NC \NR
511 \NC backmax
\NC number
\NC \NC \NR
512 \NC remap
\NC table
\NC \NC \NR
513 \NC map
\NC array
\NC non|-|linear array of mappings
\NC \NR
514 \NC backmap
\NC array
\NC non|-|linear array of backward mappings
\NC \NR
515 \NC enc
\NC table
\NC \NC \NR
518 The
\type {remap
} table is very small:
520 \starttabulate[|lT|l|p|
]
521 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
522 \NC firstenc
\NC number
\NC \NC \NR
523 \NC lastenc
\NC number
\NC \NC \NR
524 \NC infont
\NC number
\NC \NC \NR
527 The
\type {enc
} table is a bit more verbose:
529 \starttabulate[|lT|l|p|
]
530 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
531 \NC enc_name
\NC string
\NC \NC \NR
532 \NC char_cnt
\NC number
\NC \NC \NR
533 \NC char_max
\NC number
\NC \NC \NR
534 \NC unicode
\NC array
\NC of
\UNICODE\ position numbers
\NC \NR
535 \NC psnames
\NC array
\NC of
\POSTSCRIPT\ glyph names
\NC \NR
536 \NC builtin
\NC number
\NC \NC \NR
537 \NC hidden
\NC number
\NC \NC \NR
538 \NC only_1byte
\NC number
\NC \NC \NR
539 \NC has_1byte
\NC number
\NC \NC \NR
540 \NC has_2byte
\NC number
\NC \NC \NR
541 \NC is_unicodebmp
\NC number
\NC only if nonzero
\NC \NR
542 \NC is_unicodefull
\NC number
\NC only if nonzero
\NC \NR
543 \NC is_custom
\NC number
\NC only if nonzero
\NC \NR
544 \NC is_original
\NC number
\NC only if nonzero
\NC \NR
545 \NC is_compact
\NC number
\NC only if nonzero
\NC \NR
546 \NC is_japanese
\NC number
\NC only if nonzero
\NC \NR
547 \NC is_korean
\NC number
\NC only if nonzero
\NC \NR
548 \NC is_tradchinese
\NC number
\NC only if nonzero
[name?
]\NC \NR
549 \NC is_simplechinese
\NC number
\NC only if nonzero
\NC \NR
550 \NC low_page
\NC number
\NC \NC \NR
551 \NC high_page
\NC number
\NC \NC \NR
552 \NC iconv_name
\NC string
\NC \NC \NR
553 \NC iso_2022_escape
\NC string
\NC \NC \NR
556 \subsubsection{private table
}
558 This is the font's private
\POSTSCRIPT\ dictionary, if any. Keys and values are
561 \subsubsection{cidinfo table
}
563 \starttabulate[|lT|l|p|
]
564 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
565 \NC registry
\NC string
\NC \NC \NR
566 \NC ordering
\NC string
\NC \NC \NR
567 \NC supplement
\NC number
\NC \NC \NR
568 \NC version
\NC number
\NC \NC \NR
571 \subsubsection[fontloaderpfminfotable
]{pfminfo table
}
573 The
\type {pfminfo
} table contains most of the OS/
2 information:
575 \starttabulate[|lT|l|p|
]
576 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
577 \NC pfmset
\NC number
\NC \NC \NR
578 \NC winascent_add
\NC number
\NC \NC \NR
579 \NC windescent_add
\NC number
\NC \NC \NR
580 \NC hheadascent_add
\NC number
\NC \NC \NR
581 \NC hheaddescent_add
\NC number
\NC \NC \NR
582 \NC typoascent_add
\NC number
\NC \NC \NR
583 \NC typodescent_add
\NC number
\NC \NC \NR
584 \NC subsuper_set
\NC number
\NC \NC \NR
585 \NC panose_set
\NC number
\NC \NC \NR
586 \NC hheadset
\NC number
\NC \NC \NR
587 \NC vheadset
\NC number
\NC \NC \NR
588 \NC pfmfamily
\NC number
\NC \NC \NR
589 \NC weight
\NC number
\NC \NC \NR
590 \NC width
\NC number
\NC \NC \NR
591 \NC avgwidth
\NC number
\NC \NC \NR
592 \NC firstchar
\NC number
\NC \NC \NR
593 \NC lastchar
\NC number
\NC \NC \NR
594 \NC fstype
\NC number
\NC \NC \NR
595 \NC linegap
\NC number
\NC \NC \NR
596 \NC vlinegap
\NC number
\NC \NC \NR
597 \NC hhead_ascent
\NC number
\NC \NC \NR
598 \NC hhead_descent
\NC number
\NC \NC \NR
599 \NC os2_typoascent
\NC number
\NC \NC \NR
600 \NC os2_typodescent
\NC number
\NC \NC \NR
601 \NC os2_typolinegap
\NC number
\NC \NC \NR
602 \NC os2_winascent
\NC number
\NC \NC \NR
603 \NC os2_windescent
\NC number
\NC \NC \NR
604 \NC os2_subxsize
\NC number
\NC \NC \NR
605 \NC os2_subysize
\NC number
\NC \NC \NR
606 \NC os2_subxoff
\NC number
\NC \NC \NR
607 \NC os2_subyoff
\NC number
\NC \NC \NR
608 \NC os2_supxsize
\NC number
\NC \NC \NR
609 \NC os2_supysize
\NC number
\NC \NC \NR
610 \NC os2_supxoff
\NC number
\NC \NC \NR
611 \NC os2_supyoff
\NC number
\NC \NC \NR
612 \NC os2_strikeysize
\NC number
\NC \NC \NR
613 \NC os2_strikeypos
\NC number
\NC \NC \NR
614 \NC os2_family_class
\NC number
\NC \NC \NR
615 \NC os2_xheight
\NC number
\NC \NC \NR
616 \NC os2_capheight
\NC number
\NC \NC \NR
617 \NC os2_defaultchar
\NC number
\NC \NC \NR
618 \NC os2_breakchar
\NC number
\NC \NC \NR
619 \NC os2_vendor
\NC string
\NC \NC \NR
620 \NC codepages
\NC table
\NC A two-number array of encoded code pages
\NC \NR
621 \NC unicoderages
\NC table
\NC A four-number array of encoded unicode ranges
\NC \NR
622 \NC panose
\NC table
\NC \NC \NR
625 The
\type {panose
} subtable has exactly
10 string keys:
627 \starttabulate[|lT|l|p|
]
628 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
629 \NC familytype
\NC string
\NC Values as in the
\OPENTYPE\ font
630 specification:
\type {Any
},
\type {No Fit
},
631 \type {Text and Display
},
\type {Script
},
632 \type {Decorative
},
\type {Pictorial
} \NC
634 \NC serifstyle
\NC string
\NC See the
\OPENTYPE\ font specification for
636 \NC weight
\NC string
\NC id.
\NC \NR
637 \NC proportion
\NC string
\NC id.
\NC \NR
638 \NC contrast
\NC string
\NC id.
\NC \NR
639 \NC strokevariation
\NC string
\NC id.
\NC \NR
640 \NC armstyle
\NC string
\NC id.
\NC \NR
641 \NC letterform
\NC string
\NC id.
\NC \NR
642 \NC midline
\NC string
\NC id.
\NC \NR
643 \NC xheight
\NC string
\NC id.
\NC \NR
646 \subsubsection[fontloadernamestable
]{names table
}
648 Each item has two top|-|level keys:
650 \starttabulate[|lT|l|p|
]
651 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
652 \NC lang
\NC string
\NC language for this entry
\NC \NR
653 \NC names
\NC table
\NC \NC \NR
656 The
\type {names
} keys are the actual
\TRUETYPE\ name strings. The possible keys
659 \starttabulate[|lT|p|
]
660 \NC \rmbf key
\NC \bf explanation
\NC \NR
661 \NC copyright
\NC \NC \NR
662 \NC family
\NC \NC \NR
663 \NC subfamily
\NC \NC \NR
664 \NC uniqueid
\NC \NC \NR
665 \NC fullname
\NC \NC \NR
666 \NC version
\NC \NC \NR
667 \NC postscriptname
\NC \NC \NR
668 \NC trademark
\NC \NC \NR
669 \NC manufacturer
\NC \NC \NR
670 \NC designer
\NC \NC \NR
671 \NC descriptor
\NC \NC \NR
672 \NC venderurl
\NC \NC \NR
673 \NC designerurl
\NC \NC \NR
674 \NC license
\NC \NC \NR
675 \NC licenseurl
\NC \NC \NR
676 \NC idontknow
\NC \NC \NR
677 \NC preffamilyname
\NC \NC \NR
678 \NC prefmodifiers
\NC \NC \NR
679 \NC compatfull
\NC \NC \NR
680 \NC sampletext
\NC \NC \NR
681 \NC cidfindfontname
\NC \NC \NR
682 \NC wwsfamily
\NC \NC \NR
683 \NC wwssubfamily
\NC \NC \NR
686 \subsubsection{anchor_classes table
}
688 The anchor_classes classes:
690 \starttabulate[|lT|l|p|
]
691 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
692 \NC name
\NC string
\NC a descriptive id of this anchor class
\NC \NR
693 \NC lookup
\NC string
\NC \NC \NR
694 \NC type
\NC string
\NC one of
\type {mark
},
\type {mkmk
},
\type {curs
},
\type {mklg
} \NC \NR
697 % type is actually a lookup subtype, not a feature name. Officially, these
698 % strings should be gpos_mark2mark etc.
700 \subsubsection{gpos table
}
702 The
\type {gpos
} table has one array entry for each lookup. (The
\type {gpos_
}
703 prefix is somewhat redundant.)
705 \starttabulate[|lT|l|p|
]
706 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
707 \NC type
\NC string
\NC one of
\type {gpos_single
},
\type {gpos_pair
},
708 \type {gpos_cursive
},
\type {gpos_mark2base
},
\crlf
709 \type {gpos_mark2ligature
},
\type
710 {gpos_mark2mark
},
\type {gpos_context
},
\crlf \type
711 {gpos_contextchain
} \NC \NR
712 \NC flags
\NC table
\NC \NC \NR
713 \NC name
\NC string
\NC \NC \NR
714 \NC features
\NC array
\NC \NC \NR
715 \NC subtables
\NC array
\NC \NC \NR
718 The flags table has a true value for each of the lookup flags that is actually
721 \starttabulate[|lT|l|p|
]
722 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
723 \NC r2l
\NC boolean
\NC \NC \NR
724 \NC ignorebaseglyphs
\NC boolean
\NC \NC \NR
725 \NC ignoreligatures
\NC boolean
\NC \NC \NR
726 \NC ignorecombiningmarks
\NC boolean
\NC \NC \NR
727 \NC mark_class
\NC string
\NC \NC \NR
730 The features subtable items of gpos have:
732 \starttabulate[|lT|l|p|
]
733 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
734 \NC tag
\NC string
\NC \NC \NR
735 \NC scripts
\NC table
\NC \NC \NR
738 The scripts table within features has:
740 \starttabulate[|lT|l|p|
]
741 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
742 \NC script
\NC string
\NC \NC \NR
743 \NC langs
\NC array of strings
\NC \NC \NR
746 The subtables table has:
748 \starttabulate[|lT|l|p|
]
749 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
750 \NC name
\NC string
\NC \NC \NR
751 \NC suffix
\NC string
\NC (only if used)
\NC \NR % used by gpos_single to get a default
752 \NC anchor_classes
\NC number
\NC (only if used)
\NC \NR
753 \NC vertical_kerning
\NC number
\NC (only if used)
\NC \NR
754 \NC kernclass
\NC table
\NC (only if used)
\NC \NR
757 The kernclass with subtables table has:
759 \starttabulate[|lT|l|p|
]
760 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
761 \NC firsts
\NC array of strings
\NC \NC \NR
762 \NC seconds
\NC array of strings
\NC \NC \NR
763 \NC lookup
\NC string or array
\NC associated lookup(s)
\NC \NR
764 \NC offsets
\NC array of numbers
\NC \NC \NR
767 Note: the kernclass (as far as we can see) always has one entry so it could be one level
768 deep instead. Also the seconds start at
\type {[2]} which is close to the fontforge
769 internals so we keep that too.
771 \subsubsection{gsub table
}
773 This has identical layout to the
\type {gpos
} table, except for the
776 \starttabulate[|lT|l|p|
]
777 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
778 \NC type
\NC string
\NC one of
\type {gsub_single
},
\type {gsub_multiple
},
779 \type {gsub_alternate
},
\type
780 {gsub_ligature
},
\crlf \type {gsub_context
},
\type
781 {gsub_contextchain
},
\type
782 {gsub_reversecontextchain
} \NC \NR
785 \subsubsection{ttf_tables and ttf_tab_saved tables
}
787 \starttabulate[|lT|l|p|
]
788 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
789 \NC tag
\NC string
\NC \NC \NR
790 \NC len
\NC number
\NC \NC \NR
791 \NC maxlen
\NC number
\NC \NC \NR
792 \NC data
\NC number
\NC \NC \NR
795 \subsubsection{mm table
}
797 \starttabulate[|lT|l|p|
]
798 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
799 \NC axes
\NC table
\NC array of axis names
\NC \NR
800 \NC instance_count
\NC number
\NC \NC \NR
801 \NC positions
\NC table
\NC array of instance positions
802 (\#axes * instances )
\NC \NR
803 \NC defweights
\NC table
\NC array of default weights for instances
\NC \NR
804 \NC cdv
\NC string
\NC \NC \NR
805 \NC ndv
\NC string
\NC \NC \NR
806 \NC axismaps
\NC table
\NC \NC \NR
809 The
\type {axismaps
}:
811 \starttabulate[|lT|l|p|
]
812 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
813 \NC blends
\NC table
\NC an array of blend points
\NC \NR
814 \NC designs
\NC table
\NC an array of design values
\NC \NR
815 \NC min
\NC number
\NC \NC \NR
816 \NC def
\NC number
\NC \NC \NR
817 \NC max
\NC number
\NC \NC \NR
820 \subsubsection{mark_classes table
}
822 The keys in this table are mark class names, and the values are a
823 space|-|separated string of glyph names in this class.
825 \subsubsection{math table
}
827 \starttabulate[|lT|p|
]
828 \NC ScriptPercentScaleDown
\NC \NC \NR
829 \NC ScriptScriptPercentScaleDown
\NC \NC \NR
830 \NC DelimitedSubFormulaMinHeight
\NC \NC \NR
831 \NC DisplayOperatorMinHeight
\NC \NC \NR
832 \NC MathLeading
\NC \NC \NR
833 \NC AxisHeight
\NC \NC \NR
834 \NC AccentBaseHeight
\NC \NC \NR
835 \NC FlattenedAccentBaseHeight
\NC \NC \NR
836 \NC SubscriptShiftDown
\NC \NC \NR
837 \NC SubscriptTopMax
\NC \NC \NR
838 \NC SubscriptBaselineDropMin
\NC \NC \NR
839 \NC SuperscriptShiftUp
\NC \NC \NR
840 \NC SuperscriptShiftUpCramped
\NC \NC \NR
841 \NC SuperscriptBottomMin
\NC \NC \NR
842 \NC SuperscriptBaselineDropMax
\NC \NC \NR
843 \NC SubSuperscriptGapMin
\NC \NC \NR
844 \NC SuperscriptBottomMaxWithSubscript
\NC \NC \NR
845 \NC SpaceAfterScript
\NC \NC \NR
846 \NC UpperLimitGapMin
\NC \NC \NR
847 \NC UpperLimitBaselineRiseMin
\NC \NC \NR
848 \NC LowerLimitGapMin
\NC \NC \NR
849 \NC LowerLimitBaselineDropMin
\NC \NC \NR
850 \NC StackTopShiftUp
\NC \NC \NR
851 \NC StackTopDisplayStyleShiftUp
\NC \NC \NR
852 \NC StackBottomShiftDown
\NC \NC \NR
853 \NC StackBottomDisplayStyleShiftDown
\NC \NC \NR
854 \NC StackGapMin
\NC \NC \NR
855 \NC StackDisplayStyleGapMin
\NC \NC \NR
856 \NC StretchStackTopShiftUp
\NC \NC \NR
857 \NC StretchStackBottomShiftDown
\NC \NC \NR
858 \NC StretchStackGapAboveMin
\NC \NC \NR
859 \NC StretchStackGapBelowMin
\NC \NC \NR
860 \NC FractionNumeratorShiftUp
\NC \NC \NR
861 \NC FractionNumeratorDisplayStyleShiftUp
\NC \NC \NR
862 \NC FractionDenominatorShiftDown
\NC \NC \NR
863 \NC FractionDenominatorDisplayStyleShiftDown
\NC \NC \NR
864 \NC FractionNumeratorGapMin
\NC \NC \NR
865 \NC FractionNumeratorDisplayStyleGapMin
\NC \NC \NR
866 \NC FractionRuleThickness
\NC \NC \NR
867 \NC FractionDenominatorGapMin
\NC \NC \NR
868 \NC FractionDenominatorDisplayStyleGapMin
\NC \NC \NR
869 \NC SkewedFractionHorizontalGap
\NC \NC \NR
870 \NC SkewedFractionVerticalGap
\NC \NC \NR
871 \NC OverbarVerticalGap
\NC \NC \NR
872 \NC OverbarRuleThickness
\NC \NC \NR
873 \NC OverbarExtraAscender
\NC \NC \NR
874 \NC UnderbarVerticalGap
\NC \NC \NR
875 \NC UnderbarRuleThickness
\NC \NC \NR
876 \NC UnderbarExtraDescender
\NC \NC \NR
877 \NC RadicalVerticalGap
\NC \NC \NR
878 \NC RadicalDisplayStyleVerticalGap
\NC \NC \NR
879 \NC RadicalRuleThickness
\NC \NC \NR
880 \NC RadicalExtraAscender
\NC \NC \NR
881 \NC RadicalKernBeforeDegree
\NC \NC \NR
882 \NC RadicalKernAfterDegree
\NC \NC \NR
883 \NC RadicalDegreeBottomRaisePercent
\NC \NC \NR
884 \NC MinConnectorOverlap
\NC \NC \NR
885 \NC FractionDelimiterSize
\NC \NC \NR
886 \NC FractionDelimiterDisplayStyleSize
\NC \NC \NR
889 \subsubsection{validation_state table
}
891 \starttabulate[|lT|p|
]
892 \NC \rmbf key
\NC \bf explanation
\NC \NR
893 \NC bad_ps_fontname
\NC \NC \NR
894 \NC bad_glyph_table
\NC \NC \NR
895 \NC bad_cff_table
\NC \NC \NR
896 \NC bad_metrics_table
\NC \NC \NR
897 \NC bad_cmap_table
\NC \NC \NR
898 \NC bad_bitmaps_table
\NC \NC \NR
899 \NC bad_gx_table
\NC \NC \NR
900 \NC bad_ot_table
\NC \NC \NR
901 \NC bad_os2_version
\NC \NC \NR
902 \NC bad_sfnt_header
\NC \NC \NR
905 \subsubsection{horiz_base and vert_base table
}
907 \starttabulate[|lT|l|p|
]
908 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
909 \NC tags
\NC table
\NC an array of script list tags
\NC \NR
910 \NC scripts
\NC table
\NC \NC \NR
913 The
\type {scripts
} subtable:
915 \starttabulate[|lT|l|p|
]
916 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
917 \NC baseline
\NC table
\NC \NC \NR
918 \NC default_baseline
\NC number
\NC \NC \NR
919 \NC lang
\NC table
\NC \NC \NR
923 The
\type {lang
} subtable:
925 \starttabulate[|lT|l|p|
]
926 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
927 \NC tag
\NC string
\NC a script tag
\NC \NR
928 \NC ascent
\NC number
\NC \NC \NR
929 \NC descent
\NC number
\NC \NC \NR
930 \NC features
\NC table
\NC \NC \NR
933 The
\type {features
} points to an array of tables with the same layout except
934 that in those nested tables, the tag represents a language.
936 \subsubsection{altuni table
}
938 An array of alternate
\UNICODE\ values. Inside that array are hashes with:
940 \starttabulate[|lT|l|p|
]
941 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
942 \NC unicode
\NC number
\NC this glyph is also used for this unicode
\NC \NR
943 \NC variant
\NC number
\NC the alternative is driven by this unicode selector
\NC \NR
946 \subsubsection{vert_variants and horiz_variants table
}
948 \starttabulate[|lT|l|p|
]
949 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
950 \NC variants
\NC string
\NC \NC \NR
951 \NC italic_correction
\NC number
\NC \NC \NR
952 \NC parts
\NC table
\NC \NC \NR
955 The
\type {parts
} table is an array of smaller tables:
957 \starttabulate[|lT|l|p|
]
958 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
959 \NC component
\NC string
\NC \NC \NR
960 \NC extender
\NC number
\NC \NC \NR
961 \NC start
\NC number
\NC \NC \NR
962 \NC end
\NC number
\NC \NC \NR
963 \NC advance
\NC number
\NC \NC \NR
967 \subsubsection{mathkern table
}
969 \starttabulate[|lT|l|p|
]
970 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
971 \NC top_right
\NC table
\NC \NC \NR
972 \NC bottom_right
\NC table
\NC \NC \NR
973 \NC top_left
\NC table
\NC \NC \NR
974 \NC bottom_left
\NC table
\NC \NC \NR
977 Each of the subtables is an array of small hashes with two keys:
979 \starttabulate[|lT|l|p|
]
980 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
981 \NC height
\NC number
\NC \NC \NR
982 \NC kern
\NC number
\NC \NC \NR
985 \subsubsection{kerns table
}
987 Substructure is identical to the per|-|glyph subtable.
989 \subsubsection{vkerns table
}
991 Substructure is identical to the per|-|glyph subtable.
993 \subsubsection{texdata table
}
995 \starttabulate[|lT|l|p|
]
996 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
997 \NC type
\NC string
\NC \type {unset
},
\type {text
},
\type {math
},
\type {mathext
} \NC \NR
998 \NC params
\NC array
\NC 22 font numeric parameters
\NC \NR
1001 \subsubsection{lookups table
}
1003 Top|-|level
\type {lookups
} is quite different from the ones at character level.
1004 The keys in this hash are strings, the values the actual lookups, represented as
1007 \starttabulate[|lT|l|p|
]
1008 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
1009 \NC type
\NC string
\NC \NC \NR
1010 \NC format
\NC enum
\NC one of
\type {glyphs
},
\type {class
},
\type {coverage
},
\type {reversecoverage
} \NC \NR
1011 \NC tag
\NC string
\NC \NC \NR
1012 \NC current_class
\NC array
\NC \NC \NR
1013 \NC before_class
\NC array
\NC \NC \NR
1014 \NC after_class
\NC array
\NC \NC \NR
1015 \NC rules
\NC array
\NC an array of rule items
\NC \NR
1018 Rule items have one common item and one specialized item:
1020 \starttabulate[|lT|l|p|
]
1021 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
1022 \NC lookups
\NC array
\NC a linear array of lookup names
\NC \NR
1023 \NC glyphs
\NC array
\NC only if the parent's format is
\type {glyphs
}\NC \NR
1024 \NC class
\NC array
\NC only if the parent's format is
\type {class
}\NC \NR
1025 \NC coverage
\NC array
\NC only if the parent's format is
\type {coverage
}\NC \NR
1026 \NC reversecoverage
\NC array
\NC only if the parent's format is
\type {reversecoverage
}\NC \NR
1031 \starttabulate[|lT|l|p|
]
1032 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
1033 \NC names
\NC string
\NC \NC \NR
1034 \NC back
\NC string
\NC \NC \NR
1035 \NC fore
\NC string
\NC \NC \NR
1040 \starttabulate[|lT|l|p|
]
1041 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
1042 \NC current
\NC array
\NC of numbers
\NC \NR
1043 \NC before
\NC array
\NC of numbers
\NC \NR
1044 \NC after
\NC array
\NC of numbers
\NC \NR
1049 \starttabulate[|lT|l|p|
]
1050 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
1051 \NC current
\NC array
\NC of strings
\NC \NR
1052 \NC before
\NC array
\NC of strings
\NC \NR
1053 \NC after
\NC array
\NC of strings
\NC \NR
1058 \starttabulate[|lT|l|p|
]
1059 \NC \rmbf key
\NC \bf type
\NC \bf explanation
\NC \NR
1060 \NC current
\NC array
\NC of strings
\NC \NR
1061 \NC before
\NC array
\NC of strings
\NC \NR
1062 \NC after
\NC array
\NC of strings
\NC \NR
1063 \NC replacements
\NC string
\NC \NC \NR