implemented fonts in ruby wrapper
[swftools.git] / lib / ruby / test.rb
1 require 'gfx'
2
3 pdf = GFX::PDF.new('test.pdf')
4
5 class TestRender < GFX::Device
6     def startpage(width,height)
7         puts "startpage(#{width},#{height})"
8     end
9     def endpage()
10         puts "endpage()"
11     end
12     def setparameter(key,value)
13         puts "setparameter(#{key},#{value})"
14     end
15     def startclip(line)
16         puts "startclip(#{line})"
17     end
18     def endclip()
19         puts "endclip()"
20     end
21     def stroke(line, width, color, cap_style, joint_style, miterLimit)
22         puts "stroke(#{line}, #{width}, #{color}, #{cap_style}, #{joint_style}, #{miterLimit})"
23     end
24     def fill(line, color)
25         puts "fill(#{line}, #{color})"
26     end
27     def fillbitmap(line, img, imgcoord2devcoord, cxform)
28         puts "fillbitmap(#{line}, #{img}, #{imgcoord2devcoord}, #{cxform})"
29     end
30     def fillgradient(dev, line, gradient, type, gradcoord2devcoord)
31         puts "fillgradient(#{line}, #{gradient}, #{type}, #{gradcoord2devcoord})"
32     end
33     def addfont(font)
34         p @lastfont === font
35         @lastfont = font
36         puts "addfont(#{font})"
37     end
38     def drawchar(font, glyph, color, matrix)
39         puts "drawchar(#{font}, #{glyph}, #{color}, #{matrix})"
40     end
41     def drawlink(line, action)
42         puts "drawchar(#{line}, #{action})"
43     end
44 end
45
46 r = TestRender.new
47 pdf.each_page do |page|
48     puts "#{page.nr} #{page.width}x#{page.height}"
49     page.render(r)
50 end
51