2 # -*- coding: utf-8 -*-
4 # The following script converts a set of chars except "\s", as Ruby defines,
5 # to the character range definition of LuaTeX-ja.
7 # USAGE: ruby __FILE__ ifile rangeNo [> ofile]
9 # Example (in Japanese)
10 # 教育漢字リスト (http://www.aozora.gr.jp/kanji_table/kyouiku_list.zip)
12 # 1. kyoikukanji.txt に対して,コメント部分の先頭に # をつける編集を加える;
13 # 2. ruby chars2defcharrange.rb kyoikukanji.txt 210 > kyoikukanjiChars.tex
17 print "USAGE: ruby ", __FILE__, "ifile rangeNo [> ofile]\n"
31 open(ifile, "r").each_line{|line|
39 # 10 進 unicode code point 配列に変換
40 decs = string.unpack("U*")
43 print "\defcharrange{", rangeNo, "}{"
44 decs.each_with_index{|code, index|
48 print "\"", code.to_s(16)