n.c.
[chise/ruby.git] / chise / csf.rb
index e29c219..593b495 100755 (executable)
@@ -1,8 +1,7 @@
 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
 
 require "sgl"
-#require "kconv"
-require "uconv"
+require "chise/iconv"
 require "chise/config"
 
 module StrokeFont
@@ -18,14 +17,17 @@ module StrokeFont
       @strokes = Strokes.new
     end
     attr_reader :strokes
+
     def move_to_x(x) @x = x; @nx = x; end
     def draw_to_x(x) @nx = x; drawline; @x = @nx; @y = @ny; end
     def next_x_to(x) @nx = x; end
     def move_to_y(y) @y = y; @ny = y; end
     def draw_to_y(y) @ny = y; drawline; @x = @nx; @y = @ny; end
+
     def drawline()
       @strokes.add_line(t(@x), t(@y), t(@nx), t(@ny))
     end
+
     def t(a) a*DEST_WIDTH/ORG_WIDTH; end
   end
 
@@ -64,10 +66,12 @@ module StrokeFont
       @strokes = nil
     end
     attr_reader :strokes
+
     def parse()
       return if @strokes
       @strokes = CSFParser.parse(@stroke_str)
     end
+
     def init
       parse if @strokes.nil?
     end
@@ -82,6 +86,7 @@ module StrokeFont
       @rend = StrokesRenderer.new
       @rend.hsv = [50, 100, 100]
     end
+
     def read_file()
       open(@file) {|f|
        while(line = f.gets)
@@ -92,6 +97,7 @@ module StrokeFont
        end
       }
     end
+
     def init(code)
       glyph = @glyphs[code]
       return if glyph == nil
@@ -99,21 +105,24 @@ module StrokeFont
       glyph.parse
       @rend.set_strokes(glyph.strokes)
     end
+
     def draw(code) #\88ø\90\94\82É\82ÍJIS\82ð\90\94\92l\89»\82µ\82½\82à\82Ì\82ª\82Í\82¢\82é
       glyph = @glyphs[code]
       return if glyph == nil
       @rend.draw
     end
+
     def print(code)
       jis = JISX0208.new
       char = jis.get_char(code)
       printf("[%s][%04x]\n", char.nil? ? "nil" : char.map_sjis, code)
     end
+
     def ucs_to_jis(ucs)
       char = Character.get(ucs)
       j = char.japanese_jisx0208
       return j
     end
-  end
 
+  end
 end