summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/luatex/luatexja/tool/ivslist.tex
blob: 0e0a71246158de70fab3a3e27d7a1a53234db1de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%#!lualatex
\documentclass{article}
\batchmode
\usepackage{luaotfload,booktabs,array,luacode,longtable}
\usepackage[scale=0.8]{geometry}
\errorstopmode

\ifdefined\myfontname\else
{\newlinechar=`@
\message{@Name of the font to test = }
\read-1 to\myfontname \global\let\myfontname\myfontname
\message{@}}
\fi
\font\test=\myfontname\space at 12pt
{\test\begin{luacode}
  ident = fonts.hashes.identifiers[font.current()]
\end{luacode}
}


\def\FMT#1#2{{\oalign{\test\char#1\crcr\rm\tiny\hss#2\hss\crcr}}}
\def\OUT#1{\leavevmode\hbox to 7em{{\test\char"#1}\ ({\tt U+#1})\hss}}%"
\begin{document}
{\noindent\Large\bf \myfontname\\\null\hfill (%
  \directlua{tex.sprint(ident.fullname)}%
)}

\bigskip
\baselineskip18pt

\begin{luacode}
local t = ident.shared.rawdata
t = t and t.resources
t = t and t.variants
local ivs, ivsi = {}, {}
for i,v in pairs(t) do
  if i>=0xE0100 then
    for j,w in pairs(v) do
       if not ivs[j] then table.insert(ivsi,j); ivs[j]=ivs[j] or {}; end
       table.insert(ivs[j],{i-0xE0100,w})
    end
  end
end
local sort = table.sort
local sortfn = function (a,b) return a[1]<b[1] end
sort(ivsi)
for _,v in pairs(ivsi) do
   sort(ivs[v], sortfn)
   tex.sprint('\\OUT{' .. string.format('%X', v) .. '}\\ ')
   for _, cn in pairs(ivs[v]) do
     tex.sprint('\\FMT{' .. tostring(cn[2]) .. '}{' .. cn[1] .. '}' )
   end
   tex.sprint('\\par')
end
\end{luacode}


\end{document}