Explore the internal font table
From LuaTeXWiki
Explore an internal font table
Let us define a macro
\def\studyfont#1{\directlua0{ function printtable (ind,tableau,prof) local k,l texio.write_nl(string.rep("...",prof) .. ind .. " -> {") prof=prof+1 for k,l in pairs(tableau) do if (type(l)=="table") then printtable(k,l,prof) else texio.write_nl(string.rep("...",prof) .. k .. " -> " .. tostring(l)) end end texio.write_nl(string.rep("...",prof-1) .. "}") end for i,f in font.each() do if (f.name=="#1") then printtable("#1",f,0) end end }}
and apply it to cmr10 for example. (The font.each() has been added by Taco in checkout 573.) Here is what we get:
cmr10 -> { ...checksum -> 1274110073 ...type -> real ...characters -> { ......1 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 546135 ......} ......2 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 509726 ......} ......3 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 455111 ......} ......4 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 436908 ......} ......5 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 491521 ......} ......6 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 473316 ......} ......7 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 509726 ......} ......8 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 473316 ......} ......9 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 509726 ......} ......10 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 473316 ......} ......11 -> { .........kerns -> { ............63 -> 50973 ............93 -> 50973 ............39 -> 50973 ............33 -> 50973 ............41 -> 50973 .........} .........italic -> 50973 .........ligatures -> { ............105 -> { ...............char -> 14 ...............type -> 0 ............} ............108 -> { ...............char -> 15 ...............type -> 0 ............} .........} .........height -> 455111 .........depth -> 0 .........used -> false .........width -> 382295 ......}
Glyph 11, namely the "ff" ligature has several kernings as well as two ligatures: one with i and one with l.
...another 1095 lines... ......127 -> { .........italic -> 0 .........height -> 437688 .........depth -> 0 .........used -> false .........width -> 327681 ......} ......0 -> { .........italic -> 0 .........height -> 447828 .........depth -> 0 .........used -> false .........width -> 409601 ......} ...} ...parameters -> { ......x_height -> 282168 ......space_stretch -> 109226 ......extra_space -> 0 ......space -> 218453 ......quad -> 655361 ......space_shrink -> 72818 ......slant -> 0 ...} ...embedding -> unknown ...encodingbytes -> 0 ...direction -> -1 ...name -> cmr10 ...size -> 655360 ...used -> false ...format -> unknown ...designsize -> 655360 ...area -> }
If you want to explore the internal font table you have just defined but not yet used, then do not forget to write a \relax after the font definition:
\font\x=something \studyfont{something}
will NOT WORK. But:
\font\x=something\relax \studyfont{something}
will work. (Thanks Taco for the hint!)