# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
require "sgl"
-#require "kconv"
-require "uconv"
+require "chise/iconv"
require "chise/config"
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
@strokes = nil
end
attr_reader :strokes
+
def parse()
return if @strokes
@strokes = CSFParser.parse(@stroke_str)
end
+
def init
parse if @strokes.nil?
end
@rend = StrokesRenderer.new
@rend.hsv = [50, 100, 100]
end
+
def read_file()
open(@file) {|f|
while(line = f.gets)
end
}
end
+
def init(code)
glyph = @glyphs[code]
return if glyph == nil
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