summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja/tool/table_ivd_aj1.lua
blob: cf898a47b21c0f35da38440254e18540e48a96d5 (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
print([[
return {
version = 2,
table_ivd_aj1 = {]])

local f = io.open('IVD_Sequences.txt')
local t, maxcid = {}, 0
local s = f:read()
while s do
    if s:match('#') then
	print('-- ' .. s)
    elseif s:match('Adobe.Japan.') then
	local c1,c2,c3 = s:match('(%x+)%s+(%x+);%s+Adobe.Japan.;%s+CID%+(%d+)')
	c1, c2, c3 = tonumber(c1, 16), tonumber(c2, 16), tonumber(c3)
	if c2 and c2>=0xE0100 then
	    c2 = c2 - 0xE00FF
	    if maxcid<c3 then maxcid = c3 end
	    t[c3] = c2*0x200000+c1
	end
    end
    s = f:read()
end
f:close()

for i=1,maxcid do
    print(' ' .. tostring(t[i] or false) .. ',')
end


-- ( 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 '}' )
print([[}}]])