OSDN Git Service

update documentation (WIP)
[luatex-ja/luatexja.git] / tool / table_ivd_aj1.lua
1 print([[
2 local f = false
3 return {
4 version = 3,
5 table_ivd_aj1 = {]])
6
7 local f = io.open('IVD_Sequences.txt')
8 local t, maxcid = {}, 0
9 local s = f:read()
10 while s do
11     if s:match('#') then
12         print('-- ' .. s)
13     elseif s:match('Adobe.Japan.') then
14         local c1,c2,c3 = s:match('(%x+)%s+(%x+);%s+Adobe.Japan.;%s+CID%+(%d+)')
15         c1, c2, c3 = tonumber(c1, 16), tonumber(c2, 16), tonumber(c3)
16         if c2 and c2>=0xE0100 then
17             c2 = c2 - 0xE00FF
18             if maxcid<c3 then maxcid = c3 end
19             t[c3] = c2*0x200000+c1
20         end
21     end
22     s = f:read()
23 end
24 f:close()
25
26 local s={}
27 for i=1,maxcid do
28     s[#s+1] = t[i] and string.format('0x%x', t[i]) or 'f'
29     if #s==10 then print(" " .. table.concat(s, ",") .. ','); s={} end
30 end
31 print(" " .. table.concat(s, ","))
32
33 -- ( echo 'luatexja.otf.ivd_aj1 = {' ; grep 'Adobe-Japan1' IVD_Sequences.txt|sed 's/\([0-9A-F][0-9A-F]*\) \([0-9A-F][0-9A-F]*\)\;.*CID.\([0-9][0-9]*\)$/[\3]=\{0x\1,0x\2\},/' ; echo '}' )
34 print([[}}]])
35