]> Lady’s Gitweb - OldStandard/blob - fonttable.lua
d50a3146807247d19382e8fbe3fc2d090e385985
[OldStandard] / fonttable.lua
1 -- the following is adapted from https://tex.stackexchange.com/a/380780
2 ft = {}
3 function ft.print_glyphs(maxCols,maxChars)
4 local id = font.current()
5 local fnt = font.getfont(id)
6 local col = 1
7 local maxU4 = 15*(16^3+16^2+16+1)
8 a = {}
9 for k, v in pairs(fnt.characters) do
10 a [#a + 1] = k
11 end
12 table.sort(a)
13 for i, k in ipairs(a) do
14 if i >= maxChars then break end
15 if col == 1 then
16 if k > maxU4 then
17 tex.sprint(string.format("U+%06x", k))
18 else
19 tex.sprint(string.format("U+%04x", k))
20 end
21 tex.sprint("&")
22 end
23 if (i) then
24 tex.sprint(string.format([[\char%i]], k))
25 else
26 tex.sprint("~")
27 end
28 if col == maxCols then
29 tex.sprint([[\\\cline{2-]] .. maxCols+1 .. "} ")
30 col = 1
31 else
32 tex.sprint("&")
33 col = col + 1
34 end
35 end
36 end
This page took 0.338445 seconds and 3 git commands to generate.