| 1 |
% language=uk |
| 2 |
|
| 3 |
\environment luatex-style |
| 4 |
|
| 5 |
\startcomponent luatex-fontloader |
| 6 |
|
| 7 |
\startchapter[reference=fontloader,title={The fontloader}] |
| 8 |
|
| 9 |
\topicindex {fonts+loading} |
| 10 |
|
| 11 |
The fontloader library is sort of independent of the rest in the sense that it |
| 12 |
can load font into a \LUA\ table that then can be converted into a table suitable |
| 13 |
for \TEX. The library is an adapted subset of \FONTFORGE\ and as such gives a |
| 14 |
similar view on a font (which has advantages when you want to debug). We will not |
| 15 |
discuss \OPENTYPE\ in detail here as the \MICROSOFT\ website offers enough |
| 16 |
information about it. The tables returned by the loader are not that far from the |
| 17 |
standard. We have no plans to extend the loader (it may even become an external |
| 18 |
module at some time). |
| 19 |
|
| 20 |
\startsection[title={Getting quick information on a font}][library=fontloader] |
| 21 |
|
| 22 |
\topicindex {fonts+information} |
| 23 |
|
| 24 |
\libindex{info} |
| 25 |
|
| 26 |
When you want to locate font by name you need some basic information that is |
| 27 |
hidden in the font files. For that reason we provide an efficient helper that |
| 28 |
gets the basic information without loading all of the font. Normally this helper |
| 29 |
is used to create a font (name) database. |
| 30 |
|
| 31 |
\startfunctioncall |
| 32 |
<table> info = |
| 33 |
fontloader.info(<string> filename) |
| 34 |
\stopfunctioncall |
| 35 |
|
| 36 |
This function returns either \type {nil}, or a \type {table}, or an array of |
| 37 |
small tables (in the case of a \TRUETYPE\ collection). The returned table(s) will |
| 38 |
contain some fairly interesting information items from the font(s) defined by the |
| 39 |
file: |
| 40 |
|
| 41 |
\starttabulate[|l|l|p|] |
| 42 |
\DB key \BC type \BC explanation \NC \NR |
| 43 |
\TB |
| 44 |
\NC \type{fontname} \NC string \NC the \POSTSCRIPT\ name of the font\NC \NR |
| 45 |
\NC \type{fullname} \NC string \NC the formal name of the font\NC \NR |
| 46 |
\NC \type{familyname} \NC string \NC the family name this font belongs to\NC \NR |
| 47 |
\NC \type{weight} \NC string \NC a string indicating the color value of the font\NC \NR |
| 48 |
\NC \type{version} \NC string \NC the internal font version\NC \NR |
| 49 |
\NC \type{italicangle} \NC float \NC the slant angle\NC \NR |
| 50 |
\NC \type{units_per_em} \NC number \NC 1000 for \POSTSCRIPT-based fonts, usually 2048 for \TRUETYPE\NC \NR |
| 51 |
\NC \type{pfminfo} \NC table \NC (see \in{section}[fontloaderpfminfotable])\NC \NR |
| 52 |
\LL |
| 53 |
\stoptabulate |
| 54 |
|
| 55 |
Getting information through this function is (sometimes much) more efficient than |
| 56 |
loading the font properly, and is therefore handy when you want to create a |
| 57 |
dictionary of available fonts based on a directory contents. |
| 58 |
|
| 59 |
\stopsection |
| 60 |
|
| 61 |
\startsection[title={Loading an \OPENTYPE\ or \TRUETYPE\ file}][library=fontloader] |
| 62 |
|
| 63 |
\topicindex {\OPENTYPE} |
| 64 |
\topicindex {\TRUETYPE} |
| 65 |
|
| 66 |
\libindex{open} |
| 67 |
\libindex{close} |
| 68 |
\libindex{to_table} |
| 69 |
|
| 70 |
If you want to use an \OPENTYPE\ font, you have to get the metric information |
| 71 |
from somewhere. Using the \type {fontloader} library, the simplest way to get |
| 72 |
that information is thus: |
| 73 |
|
| 74 |
\starttyping |
| 75 |
function load_font (filename) |
| 76 |
local metrics = nil |
| 77 |
local font = fontloader.open(filename) |
| 78 |
if font then |
| 79 |
metrics = fontloader.to_table(font) |
| 80 |
fontloader.close(font) |
| 81 |
end |
| 82 |
return metrics |
| 83 |
end |
| 84 |
|
| 85 |
myfont = load_font('/opt/tex/texmf/fonts/data/arial.ttf') |
| 86 |
\stoptyping |
| 87 |
|
| 88 |
The main function call is |
| 89 |
|
| 90 |
\startfunctioncall |
| 91 |
<userdata> f, <table> w = fontloader.open(<string> filename) |
| 92 |
<userdata> f, <table> w = fontloader.open(<string> filename, <string> fontname) |
| 93 |
\stopfunctioncall |
| 94 |
|
| 95 |
The first return value is a userdata representation of the font. The second |
| 96 |
return value is a table containing any warnings and errors reported by fontloader |
| 97 |
while opening the font. In normal typesetting, you would probably ignore the |
| 98 |
second argument, but it can be useful for debugging purposes. |
| 99 |
|
| 100 |
For \TRUETYPE\ collections (when filename ends in 'ttc') and \DFONT\ collections, |
| 101 |
you have to use a second string argument to specify which font you want from the |
| 102 |
collection. Use the \type {fontname} strings that are returned by \type |
| 103 |
{fontloader.info} for that. |
| 104 |
|
| 105 |
To turn the font into a table, \type {fontloader.to_table} is used on the font |
| 106 |
returned by \type {fontloader.open}. |
| 107 |
|
| 108 |
\startfunctioncall |
| 109 |
<table> f = fontloader.to_table(<userdata> font) |
| 110 |
\stopfunctioncall |
| 111 |
|
| 112 |
This table cannot be used directly by \LUATEX\ and should be turned into another |
| 113 |
one as described in~\in {chapter} [fonts]. Do not forget to store the \type |
| 114 |
{fontname} value in the \type {psname} field of the metrics table to be returned |
| 115 |
to \LUATEX, otherwise the font inclusion backend will not be able to find the |
| 116 |
correct font in the collection. |
| 117 |
|
| 118 |
See \in {section} [fontloadertables] for details on the userdata object returned |
| 119 |
by \type {fontloader.open} and the layout of the \type {metrics} table returned |
| 120 |
by \type {fontloader.to_table}. |
| 121 |
|
| 122 |
The font file is parsed and partially interpreted by the font loading routines |
| 123 |
from \FONTFORGE. The file format can be \OPENTYPE, \TRUETYPE, \TRUETYPE\ |
| 124 |
Collection, \CFF, or \TYPEONE. |
| 125 |
|
| 126 |
There are a few advantages to this approach compared to reading the actual font |
| 127 |
file ourselves: |
| 128 |
|
| 129 |
\startitemize |
| 130 |
|
| 131 |
\startitem |
| 132 |
The font is automatically re|-|encoded, so that the \type {metrics} table for |
| 133 |
\TRUETYPE\ and \OPENTYPE\ fonts is using \UNICODE\ for the character indices. |
| 134 |
\stopitem |
| 135 |
|
| 136 |
\startitem |
| 137 |
Many features are pre|-|processed into a format that is easier to handle than |
| 138 |
just the bare tables would be. |
| 139 |
\stopitem |
| 140 |
|
| 141 |
\startitem |
| 142 |
\POSTSCRIPT|-|based \OPENTYPE\ fonts do not store the character height and |
| 143 |
depth in the font file, so the character boundingbox has to be calculated in |
| 144 |
some way. |
| 145 |
\stopitem |
| 146 |
|
| 147 |
\stopitemize |
| 148 |
|
| 149 |
A loaded font is discarded with: |
| 150 |
|
| 151 |
\startfunctioncall |
| 152 |
fontloader.close(<userdata> font) |
| 153 |
\stopfunctioncall |
| 154 |
|
| 155 |
\stopsection |
| 156 |
|
| 157 |
\startsection[title={Applying a \quote{feature file}}][library=fontloader] |
| 158 |
|
| 159 |
\libindex{apply_featurefile} |
| 160 |
|
| 161 |
You can apply a \quote{feature file} to a loaded font: |
| 162 |
|
| 163 |
\startfunctioncall |
| 164 |
<table> errors = fontloader.apply_featurefile(<userdata> font, <string> filename) |
| 165 |
\stopfunctioncall |
| 166 |
|
| 167 |
A \quote {feature file} is a textual representation of the features in an |
| 168 |
\OPENTYPE\ font. See |
| 169 |
|
| 170 |
\starttyping |
| 171 |
http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html |
| 172 |
\stoptyping |
| 173 |
|
| 174 |
and |
| 175 |
|
| 176 |
\starttyping |
| 177 |
http://fontforge.sourceforge.net/featurefile.html |
| 178 |
\stoptyping |
| 179 |
|
| 180 |
for a more detailed description of feature files. |
| 181 |
|
| 182 |
If the function fails, the return value is a table containing any errors reported |
| 183 |
by fontloader while applying the feature file. On success, \type {nil} is |
| 184 |
returned. |
| 185 |
|
| 186 |
\stopsection |
| 187 |
|
| 188 |
\startsection[title={Applying an \quote{\AFM\ file}}][library=fontloader] |
| 189 |
|
| 190 |
\topicindex {\TYPEONE} |
| 191 |
|
| 192 |
\libindex{apply_afmfile} |
| 193 |
|
| 194 |
You can apply an \quote {\AFM\ file} to a loaded font: |
| 195 |
|
| 196 |
\startfunctioncall |
| 197 |
<table> errors = fontloader.apply_afmfile(<userdata> font, <string> filename) |
| 198 |
\stopfunctioncall |
| 199 |
|
| 200 |
An \AFM\ file is a textual representation of (some of) the meta information |
| 201 |
in a \TYPEONE\ font. See |
| 202 |
|
| 203 |
\starttyping |
| 204 |
ftp://ftp.math.utah.edu/u/ma/hohn/linux/postscript/5004.AFM_Spec.pdf |
| 205 |
\stoptyping |
| 206 |
|
| 207 |
for more information about \AFM\ files. |
| 208 |
|
| 209 |
Note: If you \type {fontloader.open} a \TYPEONE\ file named \type {font.pfb}, |
| 210 |
the library will automatically search for and apply \type {font.afm} if it exists |
| 211 |
in the same directory as the file \type {font.pfb}. In that case, there is no |
| 212 |
need for an explicit call to \type {apply_afmfile()}. |
| 213 |
|
| 214 |
If the function fails, the return value is a table containing any errors reported |
| 215 |
by fontloader while applying the AFM file. On success, \type {nil} is returned. |
| 216 |
|
| 217 |
\stopsection |
| 218 |
|
| 219 |
\startsection[title={Fontloader font tables},reference=fontloadertables][library=fontloader] |
| 220 |
|
| 221 |
\topicindex {fontloader+tables} |
| 222 |
|
| 223 |
\libindex{fields} |
| 224 |
|
| 225 |
As mentioned earlier, the return value of \type {fontloader.open} is a userdata |
| 226 |
object. One way to have access to the actual metrics is to call \type |
| 227 |
{fontloader.to_table} on this object, returning the table structure that is |
| 228 |
explained in the following sections. In the following sections we will not |
| 229 |
explain each field in detail. Most fields are self descriptive and for the more |
| 230 |
technical aspects you need to consult the relevant font references. |
| 231 |
|
| 232 |
It turns out that the result from \type {fontloader.to_table} sometimes needs |
| 233 |
very large amounts of memory (depending on the font's complexity and size) so it |
| 234 |
is possible to access the userdata object directly. |
| 235 |
|
| 236 |
\startitemize |
| 237 |
\startitem |
| 238 |
All top|-|level keys that would be returned by \type {to_table()} |
| 239 |
can also be accessed directly. |
| 240 |
\stopitem |
| 241 |
\startitem |
| 242 |
The top|-|level key \quote {glyphs} returns a {\it virtual\/} array that |
| 243 |
allows indices from \type {f.glyphmin} to (\type {f.glyphmax}). |
| 244 |
\stopitem |
| 245 |
\startitem |
| 246 |
The items in that virtual array (the actual glyphs) are themselves also |
| 247 |
userdata objects, and each has accessors for all of the keys explained in the |
| 248 |
section \quote {Glyph items} below. |
| 249 |
\stopitem |
| 250 |
\startitem |
| 251 |
The top|-|level key \quote {subfonts} returns an {\it actual} array of userdata |
| 252 |
objects, one for each of the subfonts (or nil, if there are no subfonts). |
| 253 |
\stopitem |
| 254 |
\stopitemize |
| 255 |
|
| 256 |
A short example may be helpful. This code generates a printout of all |
| 257 |
the glyph names in the font \type {PunkNova.kern.otf}: |
| 258 |
|
| 259 |
\starttyping |
| 260 |
local f = fontloader.open('PunkNova.kern.otf') |
| 261 |
print (f.fontname) |
| 262 |
local i = 0 |
| 263 |
if f.glyphcnt > 0 then |
| 264 |
for i=f.glyphmin,f.glyphmax do |
| 265 |
local g = f.glyphs[i] |
| 266 |
if g then |
| 267 |
print(g.name) |
| 268 |
end |
| 269 |
i = i + 1 |
| 270 |
end |
| 271 |
end |
| 272 |
fontloader.close(f) |
| 273 |
\stoptyping |
| 274 |
|
| 275 |
In this case, the \LUATEX\ memory requirement stays below 100MB on the test |
| 276 |
computer, while the internal structure generated by \type {to_table()} needs more |
| 277 |
than 2GB of memory (the font itself is 6.9MB in disk size). |
| 278 |
|
| 279 |
Only the top|-|level font, the subfont table entries, and the glyphs are virtual |
| 280 |
objects, everything else still produces normal \LUA\ values and tables. |
| 281 |
|
| 282 |
If you want to know the valid fields in a font or glyph structure, call the \type |
| 283 |
{fields} function on an object of a particular type (either glyph or font): |
| 284 |
|
| 285 |
\startfunctioncall |
| 286 |
<table> fields = fontloader.fields(<userdata> font) |
| 287 |
<table> fields = fontloader.fields(<userdata> font_glyph) |
| 288 |
\stopfunctioncall |
| 289 |
|
| 290 |
For instance: |
| 291 |
|
| 292 |
\startfunctioncall |
| 293 |
local fields = fontloader.fields(f) |
| 294 |
local fields = fontloader.fields(f.glyphs[0]) |
| 295 |
\stopfunctioncall |
| 296 |
|
| 297 |
\stopsection |
| 298 |
|
| 299 |
\startsection[title={Table types}][library=fontloader] |
| 300 |
|
| 301 |
\startsubsection[title={The main table}] |
| 302 |
|
| 303 |
The top|-|level keys in the returned table are (the explanations in this part of |
| 304 |
the documentation are not yet finished): |
| 305 |
|
| 306 |
\starttabulate[|l|l|p|] |
| 307 |
\DB key \BC type \NC explanation \NC \NR |
| 308 |
\TB |
| 309 |
\NC \type{table_version} \NC string \NC indicates the metrics version (currently~0.3)\NC \NR |
| 310 |
\NC \type{fontname} \NC string \NC \POSTSCRIPT\ font name\NC \NR |
| 311 |
\NC \type{fullname} \NC string \NC official (human-oriented) font name\NC \NR |
| 312 |
\NC \type{familyname} \NC string \NC family name\NC \NR |
| 313 |
\NC \type{weight} \NC string \NC weight indicator\NC \NR |
| 314 |
\NC \type{copyright} \NC string \NC copyright information\NC \NR |
| 315 |
\NC \type{filename} \NC string \NC the file name\NC \NR |
| 316 |
\NC \type{version} \NC string \NC font version\NC \NR |
| 317 |
\NC \type{italicangle} \NC float \NC slant angle\NC \NR |
| 318 |
\NC \type{units_per_em} \NC number \NC 1000 for \POSTSCRIPT-based fonts, usually 2048 for \TRUETYPE\NC \NR |
| 319 |
\NC \type{ascent} \NC number \NC height of ascender in \type {units_per_em}\NC \NR |
| 320 |
\NC \type{descent} \NC number \NC depth of descender in \type {units_per_em}\NC \NR |
| 321 |
\NC \type{upos} \NC float \NC \NC \NR |
| 322 |
\NC \type{uwidth} \NC float \NC \NC \NR |
| 323 |
\NC \type{uniqueid} \NC number \NC \NC \NR |
| 324 |
\NC \type{glyphs} \NC array \NC \NC \NR |
| 325 |
\NC \type{glyphcnt} \NC number \NC number of included glyphs\NC \NR |
| 326 |
\NC \type{glyphmax} \NC number \NC maximum used index the glyphs array\NC \NR |
| 327 |
\NC \type{glyphmin} \NC number \NC minimum used index the glyphs array\NC \NR |
| 328 |
\NC \type{notdef_loc} \NC number \NC location of the \type {.notdef} glyph |
| 329 |
or \type {-1} when not present \NC \NR |
| 330 |
\NC \type{hasvmetrics} \NC number \NC \NC \NR |
| 331 |
\NC \type{onlybitmaps} \NC number \NC \NC \NR |
| 332 |
\NC \type{serifcheck} \NC number \NC \NC \NR |
| 333 |
\NC \type{isserif} \NC number \NC \NC \NR |
| 334 |
\NC \type{issans} \NC number \NC \NC \NR |
| 335 |
\NC \type{encodingchanged} \NC number \NC \NC \NR |
| 336 |
\NC \type{strokedfont} \NC number \NC \NC \NR |
| 337 |
\NC \type{use_typo_metrics} \NC number \NC \NC \NR |
| 338 |
\NC \type{weight_width_slope_only} \NC number \NC \NC \NR |
| 339 |
\NC \type{head_optimized_for_cleartype} \NC number \NC \NC \NR |
| 340 |
\NC \type{uni_interp} \NC enum \NC \nod {unset}, \type {none}, \type {adobe}, |
| 341 |
\type {greek}, \type {japanese}, \type {trad_chinese}, |
| 342 |
\type {simp_chinese}, \type {korean}, \type {ams}\NC \NR |
| 343 |
\NC \type{origname} \NC string \NC the file name, as supplied by the user\NC \NR |
| 344 |
\NC \type{map} \NC table \NC \NC \NR |
| 345 |
\NC \type{private} \NC table \NC \NC \NR |
| 346 |
\NC \type{xuid} \NC string \NC \NC \NR |
| 347 |
\NC \type{pfminfo} \NC table \NC \NC \NR |
| 348 |
\NC \type{names} \NC table \NC \NC \NR |
| 349 |
\NC \type{cidinfo} \NC table \NC \NC \NR |
| 350 |
\NC \type{subfonts} \NC array \NC \NC \NR |
| 351 |
\NC \type{commments} \NC string \NC \NC \NR |
| 352 |
\NC \type{fontlog} \NC string \NC \NC \NR |
| 353 |
\NC \type{cvt_names} \NC string \NC \NC \NR |
| 354 |
\NC \type{anchor_classes} \NC table \NC \NC \NR |
| 355 |
\NC \type{ttf_tables} \NC table \NC \NC \NR |
| 356 |
\NC \type{ttf_tab_saved} \NC table \NC \NC \NR |
| 357 |
\NC \type{kerns} \NC table \NC \NC \NR |
| 358 |
\NC \type{vkerns} \NC table \NC \NC \NR |
| 359 |
\NC \type{texdata} \NC table \NC \NC \NR |
| 360 |
\NC \type{lookups} \NC table \NC \NC \NR |
| 361 |
\NC \type{gpos} \NC table \NC \NC \NR |
| 362 |
\NC \type{gsub} \NC table \NC \NC \NR |
| 363 |
\NC \type{mm} \NC table \NC \NC \NR |
| 364 |
\NC \type{chosenname} \NC string \NC \NC \NR |
| 365 |
\NC \type{macstyle} \NC number \NC \NC \NR |
| 366 |
\NC \type{fondname} \NC string \NC \NC \NR |
| 367 |
%NC \type{design_size} \NC number \NC \NC \NR |
| 368 |
\NC \type{fontstyle_id} \NC number \NC \NC \NR |
| 369 |
\NC \type{fontstyle_name} \NC table \NC \NC \NR |
| 370 |
%NC \type{design_range_bottom} \NC number \NC \NC \NR |
| 371 |
%NC \type{design_range_top} \NC number \NC \NC \NR |
| 372 |
\NC \type{strokewidth} \NC float \NC \NC \NR |
| 373 |
\NC \type{mark_classes} \NC table \NC \NC \NR |
| 374 |
\NC \type{creationtime} \NC number \NC \NC \NR |
| 375 |
\NC \type{modificationtime} \NC number \NC \NC \NR |
| 376 |
\NC \type{os2_version} \NC number \NC \NC \NR |
| 377 |
\NC \type{math} \NC table \NC \NC \NR |
| 378 |
\NC \type{validation_state} \NC table \NC \NC \NR |
| 379 |
\NC \type{horiz_base} \NC table \NC \NC \NR |
| 380 |
\NC \type{vert_base} \NC table \NC \NC \NR |
| 381 |
\NC \type{extrema_bound} \NC number \NC \NC \NR |
| 382 |
\NC \type{truetype} \NC boolean \NC signals a \TRUETYPE\ font \NC \NR |
| 383 |
\LL |
| 384 |
\stoptabulate |
| 385 |
|
| 386 |
\stopsubsection |
| 387 |
|
| 388 |
\startsubsection[title={\type {glyphs}}] |
| 389 |
|
| 390 |
The \type {glyphs} is an array containing the per|-|character |
| 391 |
information (quite a few of these are only present if non|-|zero). |
| 392 |
|
| 393 |
\starttabulate[|l|l|p|] |
| 394 |
\DB key \BC type \BC explanation \NC \NR |
| 395 |
\TB |
| 396 |
\NC \type{name} \NC string \NC the glyph name \NC \NR |
| 397 |
\NC \type{unicode} \NC number \NC unicode code point, or -1 \NC \NR |
| 398 |
\NC \type{boundingbox} \NC array \NC array of four numbers, see note below \NC \NR |
| 399 |
\NC \type{width} \NC number \NC only for horizontal fonts \NC \NR |
| 400 |
\NC \type{vwidth} \NC number \NC only for vertical fonts \NC \NR |
| 401 |
\NC \type{tsidebearing} \NC number \NC only for vertical ttf/otf fonts, and only if non|-|zero \NC \NR |
| 402 |
\NC \type{lsidebearing} \NC number \NC only if non|-|zero and not equal to boundingbox[1] \NC \NR |
| 403 |
\NC \type{class} \NC string \NC one of "none", "base", "ligature", "mark", "component" |
| 404 |
(if not present, the glyph class is \quote {automatic}) \NC \NR |
| 405 |
\NC \type{kerns} \NC array \NC only for horizontal fonts, if set \NC \NR |
| 406 |
\NC \type{vkerns} \NC array \NC only for vertical fonts, if set \NC \NR |
| 407 |
\NC \type{dependents} \NC array \NC linear array of glyph name strings, only if nonempty\NC \NR |
| 408 |
\NC \type{lookups} \NC table \NC only if nonempty \NC \NR |
| 409 |
\NC \type{ligatures} \NC table \NC only if nonempty \NC \NR |
| 410 |
\NC \type{anchors} \NC table \NC only if set \NC \NR |
| 411 |
\NC \type{comment} \NC string \NC only if set \NC \NR |
| 412 |
\NC \type{tex_height} \NC number \NC only if set \NC \NR |
| 413 |
\NC \type{tex_depth} \NC number \NC only if set \NC \NR |
| 414 |
\NC \type{italic_correction} \NC number \NC only if set \NC \NR |
| 415 |
\NC \type{top_accent} \NC number \NC only if set \NC \NR |
| 416 |
\NC \type{is_extended_shape} \NC number \NC only if this character is part of a math extension list \NC \NR |
| 417 |
\NC \type{altuni} \NC table \NC alternate \UNICODE\ items \NC \NR |
| 418 |
\NC \type{vert_variants} \NC table \NC \NC \NR |
| 419 |
\NC \type{horiz_variants} \NC table \NC \NC \NR |
| 420 |
\NC \type{mathkern} \NC table \NC \NC \NR |
| 421 |
\LL |
| 422 |
\stoptabulate |
| 423 |
|
| 424 |
On \type {boundingbox}: The boundingbox information for \TRUETYPE\ fonts and |
| 425 |
\TRUETYPE-based \OTF\ fonts is read directly from the font file. |
| 426 |
\POSTSCRIPT-based fonts do not have this information, so the boundingbox of |
| 427 |
traditional \POSTSCRIPT\ fonts is generated by interpreting the actual bezier |
| 428 |
curves to find the exact boundingbox. This can be a slow process, so the |
| 429 |
boundingboxes of \POSTSCRIPT-based \OTF\ fonts (and raw \CFF\ fonts) are |
| 430 |
calculated using an approximation of the glyph shape based on the actual glyph |
| 431 |
points only, instead of taking the whole curve into account. This means that |
| 432 |
glyphs that have missing points at extrema will have a too|-|tight boundingbox, |
| 433 |
but the processing is so much faster that in our opinion the tradeoff is worth |
| 434 |
it. |
| 435 |
|
| 436 |
The \type {kerns} and \type {vkerns} are linear arrays of small hashes: |
| 437 |
|
| 438 |
\starttabulate[|l|l|p|] |
| 439 |
\DB key \BC type \BC explanation \NC \NR |
| 440 |
\TB |
| 441 |
\NC \type{char} \NC string \NC \NC \NR |
| 442 |
\NC \type{off} \NC number \NC \NC \NR |
| 443 |
\NC \type{lookup} \NC string \NC \NC \NR |
| 444 |
\LL |
| 445 |
\stoptabulate |
| 446 |
|
| 447 |
The \type {lookups} is a hash, based on lookup subtable names, with |
| 448 |
the value of each key inside that a linear array of small hashes: |
| 449 |
|
| 450 |
% TODO: fix this description |
| 451 |
|
| 452 |
\starttabulate[|l|l|p|] |
| 453 |
\DB key \BC type \BC explanation \NC \NR |
| 454 |
\TB |
| 455 |
\NC \type{type} \NC enum \NC \type {position}, \type {pair}, \type |
| 456 |
{substitution}, \type {alternate}, \type |
| 457 |
{multiple}, \type {ligature}, \type |
| 458 |
{lcaret}, \cbk {kerning}, \type {vkerning}, |
| 459 |
\type {anchors}, \type {contextpos}, \type |
| 460 |
{contextsub}, \type {chainpos}, \type |
| 461 |
{chainsub}, \type {reversesub}, \type |
| 462 |
{max}, \type {kernback}, \type {vkernback} |
| 463 |
\NC \NR |
| 464 |
\NC \type{specification} \NC table \NC extra data \NC \NR |
| 465 |
\LL |
| 466 |
\stoptabulate |
| 467 |
|
| 468 |
For the first seven values of \type {type}, there can be additional |
| 469 |
sub|-|information, stored in the sub-table \type {specification}: |
| 470 |
|
| 471 |
\starttabulate[|l|l|p|] |
| 472 |
\DB value \BC type \BC explanation \NC \NR |
| 473 |
\TB |
| 474 |
\NC \type{position} \NC table \NC a table of the \type {offset_specs} type \NC \NR |
| 475 |
\NC \type{pair} \NC table \NC one string: \type {paired}, and an array of one |
| 476 |
or two \type {offset_specs} tables: \type {offsets} \NC \NR |
| 477 |
\NC \type{substitution} \NC table \NC one string: \type {variant} \NC \NR |
| 478 |
\NC \type{alternate} \NC table \NC one string: \type {components} \NC \NR |
| 479 |
\NC \type{multiple} \NC table \NC one string: \type {components} \NC \NR |
| 480 |
\NC \type{ligature} \NC table \NC two strings: \type {components}, \type {char} \NC \NR |
| 481 |
\NC \type{lcaret} \NC array \NC linear array of numbers \NC \NR |
| 482 |
\LL |
| 483 |
\stoptabulate |
| 484 |
|
| 485 |
Tables for \type {offset_specs} contain up to four number|-|valued fields: \type |
| 486 |
{x} (a horizontal offset), \type {y} (a vertical offset), \type {h} (an advance |
| 487 |
width correction) and \type {v} (an advance height correction). |
| 488 |
|
| 489 |
The \type {ligatures} is a linear array of small hashes: |
| 490 |
|
| 491 |
\starttabulate[|l|l|p|] |
| 492 |
\DB key \BC type \BC explanation \NC \NR |
| 493 |
\TB |
| 494 |
\NC \type{lig} \NC table \NC uses the same substructure as a single item in |
| 495 |
the \type {lookups} table explained above \NC \NR |
| 496 |
\NC \type{char} \NC string \NC \NC \NR |
| 497 |
\NC \type{components} \NC array \NC linear array of named components \NC \NR |
| 498 |
\NC \type{ccnt} \NC number \NC \NC \NR |
| 499 |
\LL |
| 500 |
\stoptabulate |
| 501 |
|
| 502 |
The \type {anchor} table is indexed by a string signifying the anchor type, which |
| 503 |
is one of: |
| 504 |
|
| 505 |
\starttabulate[|l|l|p|] |
| 506 |
\DB key \BC type \BC explanation \NC \NR |
| 507 |
\TB |
| 508 |
\NC \type{mark} \NC table \NC placement mark \NC \NR |
| 509 |
\NC \type{basechar} \NC table \NC mark for attaching combining items to a base char \NC \NR |
| 510 |
\NC \type{baselig} \NC table \NC mark for attaching combining items to a ligature \NC \NR |
| 511 |
\NC \type{basemark} \NC table \NC generic mark for attaching combining items to connect to \NC \NR |
| 512 |
\NC \type{centry} \NC table \NC cursive entry point \NC \NR |
| 513 |
\NC \type{cexit} \NC table \NC cursive exit point \NC \NR |
| 514 |
\LL |
| 515 |
\stoptabulate |
| 516 |
|
| 517 |
The content of these is a short array of defined anchors, with the |
| 518 |
entry keys being the anchor names. For all except \type {baselig}, the |
| 519 |
value is a single table with this definition: |
| 520 |
|
| 521 |
\starttabulate[|l|l|p|] |
| 522 |
\DB key \BC type \BC explanation \NC \NR |
| 523 |
\TB |
| 524 |
\NC \type{x} \NC number \NC x location \NC \NR |
| 525 |
\NC \type{y} \NC number \NC y location \NC \NR |
| 526 |
\NC \type{ttf_pt_index} \NC number \NC truetype point index, only if given \NC \NR |
| 527 |
\LL |
| 528 |
\stoptabulate |
| 529 |
|
| 530 |
For \type {baselig}, the value is a small array of such anchor sets sets, one for |
| 531 |
each constituent item of the ligature. |
| 532 |
|
| 533 |
For clarification, an anchor table could for example look like this : |
| 534 |
|
| 535 |
\starttyping |
| 536 |
['anchor'] = { |
| 537 |
['basemark'] = { |
| 538 |
['Anchor-7'] = { ['x']=170, ['y']=1080 } |
| 539 |
}, |
| 540 |
['mark'] ={ |
| 541 |
['Anchor-1'] = { ['x']=160, ['y']=810 }, |
| 542 |
['Anchor-4'] = { ['x']=160, ['y']=800 } |
| 543 |
}, |
| 544 |
['baselig'] = { |
| 545 |
[1] = { ['Anchor-2'] = { ['x']=160, ['y']=650 } }, |
| 546 |
[2] = { ['Anchor-2'] = { ['x']=460, ['y']=640 } } |
| 547 |
} |
| 548 |
} |
| 549 |
\stoptyping |
| 550 |
|
| 551 |
Note: The \type {baselig} table can be sparse! |
| 552 |
|
| 553 |
\stopsubsection |
| 554 |
|
| 555 |
\startsubsection[title={\type {map}}] |
| 556 |
|
| 557 |
The top|-|level map is a list of encoding mappings. Each of those is a table |
| 558 |
itself. |
| 559 |
|
| 560 |
\starttabulate[|l|l|p|] |
| 561 |
\DB key \BC type \BC explanation \NC \NR |
| 562 |
\TB |
| 563 |
\NC \type{enccount} \NC number \NC \NC \NR |
| 564 |
\NC \type{encmax} \NC number \NC \NC \NR |
| 565 |
\NC \type{backmax} \NC number \NC \NC \NR |
| 566 |
\NC \type{remap} \NC table \NC \NC \NR |
| 567 |
\NC \type{map} \NC array \NC non|-|linear array of mappings\NC \NR |
| 568 |
\NC \type{backmap} \NC array \NC non|-|linear array of backward mappings\NC \NR |
| 569 |
\NC \type{enc} \NC table \NC \NC \NR |
| 570 |
\LL |
| 571 |
\stoptabulate |
| 572 |
|
| 573 |
The \type {remap} table is very small: |
| 574 |
|
| 575 |
\starttabulate[|l|l|p|] |
| 576 |
\DB key \BC type \BC explanation \NC \NR |
| 577 |
\TB |
| 578 |
\NC \type{firstenc} \NC number \NC \NC \NR |
| 579 |
\NC \type{lastenc} \NC number \NC \NC \NR |
| 580 |
\NC \type{infont} \NC number \NC \NC \NR |
| 581 |
\LL |
| 582 |
\stoptabulate |
| 583 |
|
| 584 |
The \type {enc} table is a bit more verbose: |
| 585 |
|
| 586 |
\starttabulate[|l|l|p|] |
| 587 |
\DB key \BC type \BC explanation \NC \NR |
| 588 |
\TB |
| 589 |
\NC \type{enc_name} \NC string \NC \NC \NR |
| 590 |
\NC \type{char_cnt} \NC number \NC \NC \NR |
| 591 |
\NC \type{char_max} \NC number \NC \NC \NR |
| 592 |
\NC \type{unicode} \NC array \NC of \UNICODE\ position numbers\NC \NR |
| 593 |
\NC \type{psnames} \NC array \NC of \POSTSCRIPT\ glyph names\NC \NR |
| 594 |
\NC \type{builtin} \NC number \NC \NC \NR |
| 595 |
\NC \type{hidden} \NC number \NC \NC \NR |
| 596 |
\NC \type{only_1byte} \NC number \NC \NC \NR |
| 597 |
\NC \type{has_1byte} \NC number \NC \NC \NR |
| 598 |
\NC \type{has_2byte} \NC number \NC \NC \NR |
| 599 |
\NC \type{is_unicodebmp} \NC number \NC only if non|-|zero\NC \NR |
| 600 |
\NC \type{is_unicodefull} \NC number \NC only if non|-|zero\NC \NR |
| 601 |
\NC \type{is_custom} \NC number \NC only if non|-|zero\NC \NR |
| 602 |
\NC \type{is_original} \NC number \NC only if non|-|zero\NC \NR |
| 603 |
\NC \type{is_compact} \NC number \NC only if non|-|zero\NC \NR |
| 604 |
\NC \type{is_japanese} \NC number \NC only if non|-|zero\NC \NR |
| 605 |
\NC \type{is_korean} \NC number \NC only if non|-|zero\NC \NR |
| 606 |
\NC \type{is_tradchinese} \NC number \NC only if non|-|zero [name?]\NC \NR |
| 607 |
\NC \type{is_simplechinese} \NC number \NC only if non|-|zero\NC \NR |
| 608 |
\NC \type{low_page} \NC number \NC \NC \NR |
| 609 |
\NC \type{high_page} \NC number \NC \NC \NR |
| 610 |
\NC \type{iconv_name} \NC string \NC \NC \NR |
| 611 |
\NC \type{iso_2022_escape} \NC string \NC \NC \NR |
| 612 |
\LL |
| 613 |
\stoptabulate |
| 614 |
|
| 615 |
\stopsubsection |
| 616 |
|
| 617 |
\startsubsection[title={\type {private}}] |
| 618 |
|
| 619 |
This is the font's private \POSTSCRIPT\ dictionary, if any. Keys and values are |
| 620 |
both strings. |
| 621 |
|
| 622 |
\stopsubsection |
| 623 |
|
| 624 |
\startsubsection[title={\type {cidinfo}}] |
| 625 |
|
| 626 |
\starttabulate[|l|l|p|] |
| 627 |
\DB key \BC type \BC explanation \NC \NR |
| 628 |
\TB |
| 629 |
\NC \type{registry} \NC string \NC \NC \NR |
| 630 |
\NC \type{ordering} \NC string \NC \NC \NR |
| 631 |
\NC \type{supplement} \NC number \NC \NC \NR |
| 632 |
\NC \type{version} \NC number \NC \NC \NR |
| 633 |
\LL |
| 634 |
\stoptabulate |
| 635 |
|
| 636 |
\stopsubsection |
| 637 |
|
| 638 |
\startsubsection[reference=fontloaderpfminfotable,title={\type {pfminfo}}] |
| 639 |
|
| 640 |
The \type {pfminfo} table contains most of the OS/2 information: |
| 641 |
|
| 642 |
\starttabulate[|l|l|p|] |
| 643 |
\DB key \BC type \BC explanation \NC \NR |
| 644 |
\TB |
| 645 |
\NC \type{pfmset} \NC number \NC \NC \NR |
| 646 |
\NC \type{winascent_add} \NC number \NC \NC \NR |
| 647 |
\NC \type{windescent_add} \NC number \NC \NC \NR |
| 648 |
\NC \type{hheadascent_add} \NC number \NC \NC \NR |
| 649 |
\NC \type{hheaddescent_add} \NC number \NC \NC \NR |
| 650 |
\NC \type{typoascent_add} \NC number \NC \NC \NR |
| 651 |
\NC \type{typodescent_add} \NC number \NC \NC \NR |
| 652 |
\NC \type{subsuper_set} \NC number \NC \NC \NR |
| 653 |
\NC \type{panose_set} \NC number \NC \NC \NR |
| 654 |
\NC \type{hheadset} \NC number \NC \NC \NR |
| 655 |
\NC \type{vheadset} \NC number \NC \NC \NR |
| 656 |
\NC \type{pfmfamily} \NC number \NC \NC \NR |
| 657 |
\NC \type{weight} \NC number \NC \NC \NR |
| 658 |
\NC \type{width} \NC number \NC \NC \NR |
| 659 |
\NC \type{avgwidth} \NC number \NC \NC \NR |
| 660 |
\NC \type{firstchar} \NC number \NC \NC \NR |
| 661 |
\NC \type{lastchar} \NC number \NC \NC \NR |
| 662 |
\NC \type{fstype} \NC number \NC \NC \NR |
| 663 |
\NC \type{linegap} \NC number \NC \NC \NR |
| 664 |
\NC \type{vlinegap} \NC number \NC \NC \NR |
| 665 |
\NC \type{hhead_ascent} \NC number \NC \NC \NR |
| 666 |
\NC \type{hhead_descent} \NC number \NC \NC \NR |
| 667 |
\NC \type{os2_typoascent} \NC number \NC \NC \NR |
| 668 |
\NC \type{os2_typodescent} \NC number \NC \NC \NR |
| 669 |
\NC \type{os2_typolinegap} \NC number \NC \NC \NR |
| 670 |
\NC \type{os2_winascent} \NC number \NC \NC \NR |
| 671 |
\NC \type{os2_windescent} \NC number \NC \NC \NR |
| 672 |
\NC \type{os2_subxsize} \NC number \NC \NC \NR |
| 673 |
\NC \type{os2_subysize} \NC number \NC \NC \NR |
| 674 |
\NC \type{os2_subxoff} \NC number \NC \NC \NR |
| 675 |
\NC \type{os2_subyoff} \NC number \NC \NC \NR |
| 676 |
\NC \type{os2_supxsize} \NC number \NC \NC \NR |
| 677 |
\NC \type{os2_supysize} \NC number \NC \NC \NR |
| 678 |
\NC \type{os2_supxoff} \NC number \NC \NC \NR |
| 679 |
\NC \type{os2_supyoff} \NC number \NC \NC \NR |
| 680 |
\NC \type{os2_strikeysize} \NC number \NC \NC \NR |
| 681 |
\NC \type{os2_strikeypos} \NC number \NC \NC \NR |
| 682 |
\NC \type{os2_family_class} \NC number \NC \NC \NR |
| 683 |
\NC \type{os2_xheight} \NC number \NC \NC \NR |
| 684 |
\NC \type{os2_capheight} \NC number \NC \NC \NR |
| 685 |
\NC \type{os2_defaultchar} \NC number \NC \NC \NR |
| 686 |
\NC \type{os2_breakchar} \NC number \NC \NC \NR |
| 687 |
\NC \type{os2_vendor} \NC string \NC \NC \NR |
| 688 |
\NC \type{codepages} \NC table \NC A two-number array of encoded code pages \NC \NR |
| 689 |
\NC \type{unicoderages} \NC table \NC A four-number array of encoded unicode ranges \NC \NR |
| 690 |
\NC \type{panose} \NC table \NC \NC \NR |
| 691 |
\LL |
| 692 |
\stoptabulate |
| 693 |
|
| 694 |
The \type {panose} subtable has exactly 10 string keys: |
| 695 |
|
| 696 |
\starttabulate[|l|l|p|] |
| 697 |
\DB key \BC type \BC explanation \NC \NR |
| 698 |
\TB |
| 699 |
\NC \type{familytype} \NC string \NC Values as in the \OPENTYPE\ font |
| 700 |
specification: \type {Any}, \type {No Fit}, |
| 701 |
\type {Text and Display}, \type {Script}, |
| 702 |
\type {Decorative}, \type {Pictorial} \NC |
| 703 |
\NR |
| 704 |
\NC \type{serifstyle} \NC string \NC See the \OPENTYPE\ font specification for |
| 705 |
values \NC \NR |
| 706 |
\NC \type{weight} \NC string \NC idem \NC \NR |
| 707 |
\NC \type{proportion} \NC string \NC idem \NC \NR |
| 708 |
\NC \type{contrast} \NC string \NC idem \NC \NR |
| 709 |
\NC \type{strokevariation} \NC string \NC idem \NC \NR |
| 710 |
\NC \type{armstyle} \NC string \NC idem \NC \NR |
| 711 |
\NC \type{letterform} \NC string \NC idem \NC \NR |
| 712 |
\NC \type{midline} \NC string \NC idem \NC \NR |
| 713 |
\NC \type{xheight} \NC string \NC idem \NC \NR |
| 714 |
\LL |
| 715 |
\stoptabulate |
| 716 |
|
| 717 |
\stopsubsection |
| 718 |
|
| 719 |
\startsubsection[reference=fontloadernamestable,title={\type {names}}] |
| 720 |
|
| 721 |
Each item has two top|-|level keys: |
| 722 |
|
| 723 |
\starttabulate[|l|l|p|] |
| 724 |
\DB key \BC type \BC explanation \NC \NR |
| 725 |
\TB |
| 726 |
\NC \type{lang} \NC string \NC language for this entry \NC \NR |
| 727 |
\NC \type{names} \NC table \NC \NC \NR |
| 728 |
\LL |
| 729 |
\stoptabulate |
| 730 |
|
| 731 |
The \type {names} keys are the actual \TRUETYPE\ name strings. The possible keys |
| 732 |
are: \type {copyright}, \type {family}, \type {subfamily}, \type {uniqueid}, |
| 733 |
\type {fullname}, \type {version}, \type {postscriptname}, \type {trademark}, |
| 734 |
\type {manufacturer}, \type {designer}, \type {descriptor}, \type {venderurl}, |
| 735 |
\type {designerurl}, \type {license}, \type {licenseurl}, \type {idontknow}, |
| 736 |
\type {preffamilyname}, \type {prefmodifiers}, \type {compatfull}, \type |
| 737 |
{sampletext}, \type {cidfindfontname}, \type {wwsfamily} and \type |
| 738 |
{wwssubfamily}. |
| 739 |
|
| 740 |
\stopsubsection |
| 741 |
|
| 742 |
\startsubsection[title={\type {anchor_classes}}] |
| 743 |
|
| 744 |
The anchor_classes classes: |
| 745 |
|
| 746 |
\starttabulate[|l|l|p|] |
| 747 |
\DB key \BC type \BC explanation \NC \NR |
| 748 |
\TB |
| 749 |
\NC \type{name} \NC string \NC a descriptive id of this anchor class\NC \NR |
| 750 |
\NC \type{lookup} \NC string \NC \NC \NR |
| 751 |
\NC \type{type} \NC string \NC one of \nod {mark}, \type {mkmk}, \type {curs}, \type {mklg} \NC \NR |
| 752 |
\LL |
| 753 |
\stoptabulate |
| 754 |
|
| 755 |
% type is actually a lookup subtype, not a feature name. Officially, these |
| 756 |
% strings should be gpos_mark2mark etc. |
| 757 |
|
| 758 |
\stopsubsection |
| 759 |
|
| 760 |
\startsubsection[title={\type {gpos}}] |
| 761 |
|
| 762 |
The \type {gpos} table has one array entry for each lookup. (The \type {gpos_} |
| 763 |
prefix is somewhat redundant.) |
| 764 |
|
| 765 |
\starttabulate[|l|l|p|] |
| 766 |
\DB key \BC type \BC explanation \NC \NR |
| 767 |
\TB |
| 768 |
\NC \type{type} \NC string \NC one of \type {gpos_single}, \type {gpos_pair}, |
| 769 |
\type {gpos_cursive}, \type {gpos_mark2base},\crlf |
| 770 |
\type {gpos_mark2ligature}, \type {gpos_mark2mark}, \type {gpos_context},\crlf \type {gpos_contextchain} \NC \NR |
| 771 |
\NC \type{flags} \NC table \NC \NC \NR |
| 772 |
\NC \type{name} \NC string \NC \NC \NR |
| 773 |
\NC \type{features} \NC array \NC \NC \NR |
| 774 |
\NC \type{subtables} \NC array \NC \NC \NR |
| 775 |
\LL |
| 776 |
\stoptabulate |
| 777 |
|
| 778 |
The flags table has a true value for each of the lookup flags that is actually |
| 779 |
set: |
| 780 |
|
| 781 |
\starttabulate[|l|l|p|] |
| 782 |
\DB key \BC type \BC explanation \NC \NR |
| 783 |
\TB |
| 784 |
\NC \type{r2l} \NC boolean \NC \NC \NR |
| 785 |
\NC \type{ignorebaseglyphs} \NC boolean \NC \NC \NR |
| 786 |
\NC \type{ignoreligatures} \NC boolean \NC \NC \NR |
| 787 |
\NC \type{ignorecombiningmarks} \NC boolean \NC \NC \NR |
| 788 |
\NC \type{mark_class} \NC string \NC \NC \NR |
| 789 |
\LL |
| 790 |
\stoptabulate |
| 791 |
|
| 792 |
The features subtable items of gpos have: |
| 793 |
|
| 794 |
\starttabulate[|l|l|p|] |
| 795 |
\DB key \BC type \BC explanation \NC \NR |
| 796 |
\TB |
| 797 |
\NC \type{tag} \NC string \NC \NC \NR |
| 798 |
\NC \type{scripts} \NC table \NC \NC \NR |
| 799 |
\LL |
| 800 |
\stoptabulate |
| 801 |
|
| 802 |
The scripts table within features has: |
| 803 |
|
| 804 |
\starttabulate[|l|l|p|] |
| 805 |
\DB key \BC type \BC explanation \NC \NR |
| 806 |
\TB |
| 807 |
\NC \type{script} \NC string \NC \NC \NR |
| 808 |
\NC \type{langs} \NC array of strings \NC \NC \NR |
| 809 |
\LL |
| 810 |
\stoptabulate |
| 811 |
|
| 812 |
The subtables table has: |
| 813 |
|
| 814 |
\starttabulate[|l|l|p|] |
| 815 |
\DB key \BC type \BC explanation \NC \NR |
| 816 |
\TB |
| 817 |
\NC \type{name} \NC string \NC \NC \NR |
| 818 |
\NC \type{suffix} \NC string \NC (only if used)\NC \NR % used by gpos_single to get a default |
| 819 |
\NC \type{anchor_classes} \NC number \NC (only if used)\NC \NR |
| 820 |
\NC \type{vertical_kerning} \NC number \NC (only if used)\NC \NR |
| 821 |
\NC \type{kernclass} \NC table \NC (only if used)\NC \NR |
| 822 |
\LL |
| 823 |
\stoptabulate |
| 824 |
|
| 825 |
The kernclass with subtables table has: |
| 826 |
|
| 827 |
\starttabulate[|l|l|p|] |
| 828 |
\DB key \BC type \BC explanation \NC \NR |
| 829 |
\TB |
| 830 |
\NC \type{firsts} \NC array of strings \NC \NC \NR |
| 831 |
\NC \type{seconds} \NC array of strings \NC \NC \NR |
| 832 |
\NC \type{lookup} \NC string or array \NC associated lookup(s) \NC \NR |
| 833 |
\NC \type{offsets} \NC array of numbers \NC \NC \NR |
| 834 |
\LL |
| 835 |
\stoptabulate |
| 836 |
|
| 837 |
Note: the kernclass (as far as we can see) always has one entry so it could be one level |
| 838 |
deep instead. Also the seconds start at \type {[2]} which is close to the fontforge |
| 839 |
internals so we keep that too. |
| 840 |
|
| 841 |
\stopsubsection |
| 842 |
|
| 843 |
\startsubsection[title={\type {gsub}}] |
| 844 |
|
| 845 |
This has identical layout to the \type {gpos} table, except for the |
| 846 |
type: |
| 847 |
|
| 848 |
\starttabulate[|l|l|p|] |
| 849 |
\DB key \BC type \BC explanation \NC \NR |
| 850 |
\TB |
| 851 |
\NC \type{type} \NC string \NC one of \type {gsub_single}, \type {gsub_multiple}, |
| 852 |
\type {gsub_alternate}, \type {gsub_ligature},\crlf |
| 853 |
\type {gsub_context}, \type {gsub_contextchain}, |
| 854 |
\type {gsub_reversecontextchain} \NC \NR |
| 855 |
\LL |
| 856 |
\stoptabulate |
| 857 |
|
| 858 |
\stopsubsection |
| 859 |
|
| 860 |
\startsubsection[title={\type {ttf_tables} and \type {ttf_tab_saved}}] |
| 861 |
|
| 862 |
\starttabulate[|l|l|p|] |
| 863 |
\DB key \BC type \BC explanation \NC \NR |
| 864 |
\TB |
| 865 |
\NC \type{tag} \NC string \NC \NC \NR |
| 866 |
\NC \type{len} \NC number \NC \NC \NR |
| 867 |
\NC \type{maxlen} \NC number \NC \NC \NR |
| 868 |
\NC \type{data} \NC number \NC \NC \NR |
| 869 |
\LL |
| 870 |
\stoptabulate |
| 871 |
|
| 872 |
\stopsubsection |
| 873 |
|
| 874 |
\startsubsection[title={\type {mm}}] |
| 875 |
|
| 876 |
\starttabulate[|l|l|p|] |
| 877 |
\DB key \BC type \BC explanation \NC \NR |
| 878 |
\TB |
| 879 |
\NC \type{axes} \NC table \NC array of axis names \NC \NR |
| 880 |
\NC \type{instance_count} \NC number \NC \NC \NR |
| 881 |
\NC \type{positions} \NC table \NC array of instance positions |
| 882 |
(\#axes * instances )\NC \NR |
| 883 |
\NC \type{defweights} \NC table \NC array of default weights for instances \NC \NR |
| 884 |
\NC \type{cdv} \NC string \NC \NC \NR |
| 885 |
\NC \type{ndv} \NC string \NC \NC \NR |
| 886 |
\NC \type{axismaps} \NC table \NC \NC \NR |
| 887 |
\LL |
| 888 |
\stoptabulate |
| 889 |
|
| 890 |
The \type {axismaps}: |
| 891 |
|
| 892 |
\starttabulate[|l|l|p|] |
| 893 |
\DB key \BC type \BC explanation \NC \NR |
| 894 |
\TB |
| 895 |
\NC \type{blends} \NC table \NC an array of blend points \NC \NR |
| 896 |
\NC \type{designs} \NC table \NC an array of design values \NC \NR |
| 897 |
\NC \type{min} \NC number \NC \NC \NR |
| 898 |
\NC \type{def} \NC number \NC \NC \NR |
| 899 |
\NC \type{max} \NC number \NC \NC \NR |
| 900 |
\LL |
| 901 |
\stoptabulate |
| 902 |
|
| 903 |
\stopsubsection |
| 904 |
|
| 905 |
\startsubsection[title={\type {mark_classes}}] |
| 906 |
|
| 907 |
The keys in this table are mark class names, and the values are a |
| 908 |
space|-|separated string of glyph names in this class. |
| 909 |
|
| 910 |
\stopsubsection |
| 911 |
|
| 912 |
\startsubsection[title={\type {math}}] |
| 913 |
|
| 914 |
The math table has the variables that are also discussed in the chapter about |
| 915 |
math: \type {ScriptPercentScaleDown}, \type {ScriptScriptPercentScaleDown}, \type |
| 916 |
{DelimitedSubFormulaMinHeight}, \type {DisplayOperatorMinHeight}, \type |
| 917 |
{MathLeading}, \type {AxisHeight}, \type {AccentBaseHeight}, \type |
| 918 |
{FlattenedAccentBaseHeight}, \type {SubscriptShiftDown}, \type {SubscriptTopMax}, |
| 919 |
\type {SubscriptBaselineDropMin}, \type {SuperscriptShiftUp}, \type |
| 920 |
{SuperscriptShiftUpCramped}, \type {SuperscriptBottomMin}, \type |
| 921 |
{SuperscriptBaselineDropMax}, \type {SubSuperscriptGapMin}, \type |
| 922 |
{SuperscriptBottomMaxWithSubscript}, \type {SpaceAfterScript}, \type |
| 923 |
{UpperLimitGapMin}, \type {UpperLimitBaselineRiseMin}, \type {LowerLimitGapMin}, |
| 924 |
\type {LowerLimitBaselineDropMin}, \type {StackTopShiftUp}, \type |
| 925 |
{StackTopDisplayStyleShiftUp}, \type {StackBottomShiftDown}, \type |
| 926 |
{StackBottomDisplayStyleShiftDown}, \type {StackGapMin}, \type |
| 927 |
{StackDisplayStyleGapMin}, \type {StretchStackTopShiftUp}, \type |
| 928 |
{StretchStackBottomShiftDown}, \type {StretchStackGapAboveMin}, \type |
| 929 |
{StretchStackGapBelowMin}, \type {FractionNumeratorShiftUp}, \type |
| 930 |
{FractionNumeratorDisplayStyleShiftUp}, \type {FractionDenominatorShiftDown}, |
| 931 |
\type {FractionDenominatorDisplayStyleShiftDown}, \type |
| 932 |
{FractionNumeratorGapMin}, \type {FractionNumeratorDisplayStyleGapMin} \type |
| 933 |
{FractionRuleThickness}, \type {FractionDenominatorGapMin}, \type |
| 934 |
{FractionDenominatorDisplayStyleGapMin}, \type {SkewedFractionHorizontalGap}, |
| 935 |
\type {SkewedFractionVerticalGap}, \type {OverbarVerticalGap}, \type |
| 936 |
{OverbarRuleThickness}, \type {OverbarExtraAscender}, \type |
| 937 |
{UnderbarVerticalGap}, \type {UnderbarRuleThickness}, \type |
| 938 |
{UnderbarExtraDescender}, \type {RadicalVerticalGap}, \type |
| 939 |
{RadicalDisplayStyleVerticalGap}, \type {RadicalRuleThickness}, \type |
| 940 |
{RadicalExtraAscender}, \type {RadicalKernBeforeDegree}, \type |
| 941 |
{RadicalKernAfterDegree}, \type {RadicalDegreeBottomRaisePercent}, \type |
| 942 |
{MinConnectorOverlap}, \type {FractionDelimiterSize} and \type |
| 943 |
{FractionDelimiterDisplayStyleSize}. |
| 944 |
|
| 945 |
\stopsubsection |
| 946 |
|
| 947 |
\startsubsection[title={\type {validation_state}}] |
| 948 |
|
| 949 |
This is just a bonus table with keys: \type {bad_ps_fontname}, \type {bad_glyph_table}, \type {bad_cff_table}, \type {bad_metrics_table}, \type {bad_cmap_table}, \type {bad_bitmaps_table}, \type {bad_gx_table}, \type {bad_ot_table}, \type {bad_os2_version} and \type {bad_sfnt_header}. |
| 950 |
|
| 951 |
\stopsubsection |
| 952 |
|
| 953 |
\startsubsection[title={\type {horiz_base} and \type {vert_base}}] |
| 954 |
|
| 955 |
\starttabulate[|l|l|p|] |
| 956 |
\DB key \BC type \BC explanation \NC \NR |
| 957 |
\TB |
| 958 |
\NC \type{tags} \NC table \NC an array of script list tags\NC \NR |
| 959 |
\NC \type{scripts} \NC table \NC \NC \NR |
| 960 |
\LL |
| 961 |
\stoptabulate |
| 962 |
|
| 963 |
The \type {scripts} subtable: |
| 964 |
|
| 965 |
\starttabulate[|l|l|p|] |
| 966 |
\DB key \BC type \BC explanation \NC \NR |
| 967 |
\TB |
| 968 |
\NC \type{baseline} \NC table \NC \NC \NR |
| 969 |
\NC \type{default_baseline} \NC number \NC \NC \NR |
| 970 |
\NC \type{lang} \NC table \NC \NC \NR |
| 971 |
\LL |
| 972 |
\stoptabulate |
| 973 |
|
| 974 |
The \type {lang} subtable: |
| 975 |
|
| 976 |
\starttabulate[|l|l|p|] |
| 977 |
\DB key \BC type \BC explanation \NC \NR |
| 978 |
\TB |
| 979 |
\NC \type{tag} \NC string \NC a script tag \NC \NR |
| 980 |
\NC \type{ascent} \NC number \NC \NC \NR |
| 981 |
\NC \type{descent} \NC number \NC \NC \NR |
| 982 |
\NC \type{features} \NC table \NC \NC \NR |
| 983 |
\LL |
| 984 |
\stoptabulate |
| 985 |
|
| 986 |
The \type {features} points to an array of tables with the same layout except |
| 987 |
that in those nested tables, the tag represents a language. |
| 988 |
|
| 989 |
\stopsubsection |
| 990 |
|
| 991 |
\startsubsection[title={\type {altuni}}] |
| 992 |
|
| 993 |
An array of alternate \UNICODE\ values. Inside that array are hashes with: |
| 994 |
|
| 995 |
\starttabulate[|l|l|p|] |
| 996 |
\DB key \BC type \BC explanation \NC \NR |
| 997 |
\TB |
| 998 |
\NC \type{unicode} \NC number \NC this glyph is also used for this unicode \NC \NR |
| 999 |
\NC \type{variant} \NC number \NC the alternative is driven by this unicode selector \NC \NR |
| 1000 |
\LL |
| 1001 |
\stoptabulate |
| 1002 |
|
| 1003 |
\stopsubsection |
| 1004 |
|
| 1005 |
\startsubsection[title={\type {vert_variants} and \type {horiz_variants}}] |
| 1006 |
|
| 1007 |
\starttabulate[|l|l|p|] |
| 1008 |
\DB key \BC type \BC explanation \NC \NR |
| 1009 |
\TB |
| 1010 |
\NC \type{variants} \NC string \NC \NC \NR |
| 1011 |
\NC \type{italic_correction} \NC number \NC \NC \NR |
| 1012 |
\NC \type{parts} \NC table \NC \NC \NR |
| 1013 |
\LL |
| 1014 |
\stoptabulate |
| 1015 |
|
| 1016 |
The \type {parts} table is an array of smaller tables: |
| 1017 |
|
| 1018 |
\starttabulate[|l|l|p|] |
| 1019 |
\DB key \BC type \BC explanation \NC \NR |
| 1020 |
\TB |
| 1021 |
\NC \type{component} \NC string \NC \NC \NR |
| 1022 |
\NC \type{extender} \NC number \NC \NC \NR |
| 1023 |
\NC \type{start} \NC number \NC \NC \NR |
| 1024 |
\NC \type{end} \NC number \NC \NC \NR |
| 1025 |
\NC \type{advance} \NC number \NC \NC \NR |
| 1026 |
\LL |
| 1027 |
\stoptabulate |
| 1028 |
|
| 1029 |
\stopsubsection |
| 1030 |
|
| 1031 |
\startsubsection[title={\type {mathkern}}] |
| 1032 |
|
| 1033 |
\starttabulate[|l|l|p|] |
| 1034 |
\DB key \BC type \BC explanation \NC \NR |
| 1035 |
\TB |
| 1036 |
\NC \type{top_right} \NC table \NC \NC \NR |
| 1037 |
\NC \type{bottom_right} \NC table \NC \NC \NR |
| 1038 |
\NC \type{top_left} \NC table \NC \NC \NR |
| 1039 |
\NC \type{bottom_left} \NC table \NC \NC \NR |
| 1040 |
\LL |
| 1041 |
\stoptabulate |
| 1042 |
|
| 1043 |
Each of the subtables is an array of small hashes with two keys: |
| 1044 |
|
| 1045 |
\starttabulate[|l|l|p|] |
| 1046 |
\DB key \BC type \BC explanation \NC \NR |
| 1047 |
\TB |
| 1048 |
\NC \type{height} \NC number \NC \NC \NR |
| 1049 |
\NC \type{kern} \NC number \NC \NC \NR |
| 1050 |
\LL |
| 1051 |
\stoptabulate |
| 1052 |
|
| 1053 |
\stopsubsection |
| 1054 |
|
| 1055 |
\startsubsection[title={\type {kerns}}] |
| 1056 |
|
| 1057 |
Substructure is identical to the per|-|glyph subtable. |
| 1058 |
|
| 1059 |
\stopsubsection |
| 1060 |
|
| 1061 |
\startsubsection[title={\type {vkerns}}] |
| 1062 |
|
| 1063 |
Substructure is identical to the per|-|glyph subtable. |
| 1064 |
|
| 1065 |
\stopsubsection |
| 1066 |
|
| 1067 |
\startsubsection[title={\type {texdata}}] |
| 1068 |
|
| 1069 |
\starttabulate[|l|l|p|] |
| 1070 |
\DB key \BC type \BC explanation \NC \NR |
| 1071 |
\TB |
| 1072 |
\NC \type{type} \NC string \NC \nod {unset}, \type {text}, \nod {math}, \type {mathext} \NC \NR |
| 1073 |
\NC \type{params} \NC array \NC 22 font numeric parameters \NC \NR |
| 1074 |
\LL |
| 1075 |
\stoptabulate |
| 1076 |
|
| 1077 |
\stopsubsection |
| 1078 |
|
| 1079 |
\startsubsection[title={\type {lookups}}] |
| 1080 |
|
| 1081 |
Top|-|level \type {lookups} is quite different from the ones at character level. |
| 1082 |
The keys in this hash are strings, the values the actual lookups, represented as |
| 1083 |
dictionary tables. |
| 1084 |
|
| 1085 |
\starttabulate[|l|l|p|] |
| 1086 |
\DB key \BC type \BC explanation \NC \NR |
| 1087 |
\TB |
| 1088 |
\NC \type{type} \NC string \NC \NC \NR |
| 1089 |
\NC \type{format} \NC enum \NC one of \type {glyphs}, \type {class}, \type {coverage}, |
| 1090 |
\type {reversecoverage} \NC \NR |
| 1091 |
\NC \type{tag} \NC string \NC \NC \NR |
| 1092 |
\NC \type{current_class} \NC array \NC \NC \NR |
| 1093 |
\NC \type{before_class} \NC array \NC \NC \NR |
| 1094 |
\NC \type{after_class} \NC array \NC \NC \NR |
| 1095 |
\NC \type{rules} \NC array \NC an array of rule items\NC \NR |
| 1096 |
\LL |
| 1097 |
\stoptabulate |
| 1098 |
|
| 1099 |
Rule items have one common item and one specialized item: |
| 1100 |
|
| 1101 |
\starttabulate[|l|l|p|] |
| 1102 |
\DB key \BC type \BC explanation \NC \NR |
| 1103 |
\TB |
| 1104 |
\NC \type{lookups} \NC array \NC a linear array of lookup names \NC \NR |
| 1105 |
\NC \type{glyphs} \NC array \NC only if the parent's format is \type {glyphs} \NC \NR |
| 1106 |
\NC \type{class} \NC array \NC only if the parent's format is \type {class} \NC \NR |
| 1107 |
\NC \type{coverage} \NC array \NC only if the parent's format is \type {coverage} \NC \NR |
| 1108 |
\NC \type{reversecoverage} \NC array \NC only if the parent's format is \type {reversecoverage} \NC \NR |
| 1109 |
\LL |
| 1110 |
\stoptabulate |
| 1111 |
|
| 1112 |
A glyph table is: |
| 1113 |
|
| 1114 |
\starttabulate[|l|l|p|] |
| 1115 |
\DB key \BC type \BC explanation \NC \NR |
| 1116 |
\TB |
| 1117 |
\NC \type{names} \NC string \NC \NC \NR |
| 1118 |
\NC \type{back} \NC string \NC \NC \NR |
| 1119 |
\NC \type{fore} \NC string \NC \NC \NR |
| 1120 |
\LL |
| 1121 |
\stoptabulate |
| 1122 |
|
| 1123 |
A class table is: |
| 1124 |
|
| 1125 |
\starttabulate[|l|l|p|] |
| 1126 |
\DB key \BC type \BC explanation \NC \NR |
| 1127 |
\TB |
| 1128 |
\NC \type{current} \NC array \NC of numbers \NC \NR |
| 1129 |
\NC \type{before} \NC array \NC of numbers \NC \NR |
| 1130 |
\NC \type{after} \NC array \NC of numbers \NC \NR |
| 1131 |
\LL |
| 1132 |
\stoptabulate |
| 1133 |
|
| 1134 |
for coverage: |
| 1135 |
|
| 1136 |
\starttabulate[|l|l|p|] |
| 1137 |
\DB key \BC type \BC explanation \NC \NR |
| 1138 |
\TB |
| 1139 |
\NC \type{current} \NC array \NC of strings \NC \NR |
| 1140 |
\NC \type{before} \NC array \NC of strings \NC \NR |
| 1141 |
\NC \type{after} \NC array \NC of strings \NC \NR |
| 1142 |
\LL |
| 1143 |
\stoptabulate |
| 1144 |
|
| 1145 |
and for reverse coverage: |
| 1146 |
|
| 1147 |
\starttabulate[|l|l|p|] |
| 1148 |
\DB key \BC type \BC explanation \NC \NR |
| 1149 |
\TB |
| 1150 |
\NC \type{current} \NC array \NC of strings \NC \NR |
| 1151 |
\NC \type{before} \NC array \NC of strings \NC \NR |
| 1152 |
\NC \type{after} \NC array \NC of strings \NC \NR |
| 1153 |
\NC \type{replacements} \NC string \NC \NC \NR |
| 1154 |
\LL |
| 1155 |
\stoptabulate |
| 1156 |
|
| 1157 |
\stopsubsection |
| 1158 |
|
| 1159 |
\stopsection |
| 1160 |
|
| 1161 |
\stopchapter |
| 1162 |
|
| 1163 |
\stopcomponent |