OSDN Git Service

ltj-jfont.lua etc.: use data of UTR#50
[luatex-ja/luatexja.git] / tool / function_utr50.lua
1 local utr_revision = 17
2 print('  local function rotate_in_utr50(i)')
3 print('  -- UTR#50 revision ' ..  utr_revision)
4 local fh = io.open('VerticalOrientation-' .. utr_revision .. '.txt')
5 local t = {}
6
7 for c in fh:lines() do
8     if c:match('(%x+)%.%.(%x+)%s+;%sT-[rR]') then
9         local b, e = c:match('(%x+)%.%.(%x+)%s+;')
10         b, e = tonumber(b,16), tonumber(e,16)
11         for i=b,e do t[i]=true end
12     elseif c:match('(%x+)%s+;%sT-[rR]') then
13         local b = c:match('(%x+)%s+;')
14         t[tonumber(b,16)]=true
15     end
16 end
17
18 fh:close()
19 local b, v
20 for i=0,0x10ffff do
21     if t[i] then
22         if not v then 
23             b, v = i, true
24         else
25             e=i
26         end
27     else
28         if v then print(string.format('    if (0x%04X<=i)and(i<0x%04X) then return true end', b,i)); v = false; end
29     end
30 end
31 print('  end')
32