OSDN Git Service

Implemented \euc, \jis, and so on in luatex-compat.sty.
[luatex-ja/luatexja.git] / tool / jisx0213table.rb
1 #!/usr/bin/ruby
2
3
4 count = 1
5 print "luatexbase.provides_module({\n"
6 print "  name = 'luatexja.jisx0213'})\n"
7 print "module('luatexja.jisx0213', package.seeall)\n"
8 print "table_jisx0213_2004 = {\n"
9 print "-- [index: (men-1)*0x10000 + kuten] = ucs_code\n"
10 open("jisx0213-2004-8bit-std.txt", "r").each_line {|line|
11   if line =~ /#/
12     line = $`
13   end
14   if line =~ /^0x\.*$/
15     next
16   end
17   if line =~ /0x([0-9A-F]+)\s+U\+([0-9A-F]+)\s+.*$/
18     jxcode = $1.hex - 0x2020
19     if jxcode > 0x8000 
20       jxcode = jxcode - 0x8080 + 0x10000
21     end
22     ucscode = $2
23     print  "  [0x", jxcode.to_s(16), "]=0x", ucscode, ",\n"
24     count += 1
25   end
26 }
27 print "}"
28