2 \documentclass{article}
4 \usepackage{luaotfload,booktabs,array,luacode,longtable}
5 \usepackage[scale=0.8]{geometry}
8 \ifdefined\myfontname\else
10 \message{@Name of the font to test = }
11 \read-1 to\myfontname \global\let\myfontname\myfontname
14 \font\test=\myfontname\space at 12pt
16 ident = fonts.hashes.identifiers[font.current()]
21 \def\FMT#1#2{{\oalign{\test\char#1\crcr\rm\tiny\hss#2\hss\crcr}}}
22 \def\OUT#1{\leavevmode\hbox to 7em{{\test\char"#1}\ ({\tt U+#1})\hss}}%"
24 {\noindent\Large\bf \myfontname\\\null\hfill (%
25 \directlua{tex.sprint(ident.fullname)}%
32 local fl = fontloader.open(ident.filename)
33 local ft = fontloader.to_table(fl)
35 local ivs, ivsi = {}, {}
37 local function add_ivs_table(tg)
38 for gu, gv in pairs(tg) do
41 for _,at in pairs(ga) do
42 local bu, vs = at.unicode, (at.variant or 0)-0xE0100
43 if vs>=0 and vs<0xF0 then
44 if not ivs[bu] then ivs[bu] = {}; ivsi[1+#ivsi]=bu end
46 for _,v in pairs(ivs[bu]) do
47 if v[1]==vs then uniq_flag = false; break end
49 if uniq_flag then ivs[bu][1+#(ivs[bu])] = { vs, gv.name } end
56 add_ivs_table(ft.glyphs)
58 for _,v in pairs(ft.subfonts) do
59 add_ivs_table(v.glyphs)
64 local unicodes = ident.resources.unicodes
65 local sort = table.sort
66 local sortfn = function (a,b) return a[1]<b[1] end
68 for _,v in pairs(ivsi) do
70 tex.sprint('\\OUT{' .. string.format('%X', v) .. '}\\ ')
71 for _, cn in pairs(ivs[v]) do
72 tex.sprint('\\FMT{' .. tostring(unicodes[cn[2]]) .. '}{' .. cn[1] .. '}' )