rghost-ruby1.9-beta 0.8.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. data/lib/rghost.rb +18 -0
  2. data/lib/rghost/border.rb +44 -0
  3. data/lib/rghost/callback.rb +58 -0
  4. data/lib/rghost/circle.rb +102 -0
  5. data/lib/rghost/color.rb +175 -0
  6. data/lib/rghost/constants.rb +626 -0
  7. data/lib/rghost/convert.rb +43 -0
  8. data/lib/rghost/cursor.rb +124 -0
  9. data/lib/rghost/dash.rb +59 -0
  10. data/lib/rghost/document.rb +546 -0
  11. data/lib/rghost/document_callback_facade.rb +64 -0
  12. data/lib/rghost/dsc_entry.rb +20 -0
  13. data/lib/rghost/dynamic_document_callback.rb +15 -0
  14. data/lib/rghost/eps.rb +31 -0
  15. data/lib/rghost/font.rb +48 -0
  16. data/lib/rghost/font_map.rb +54 -0
  17. data/lib/rghost/frame.rb +105 -0
  18. data/lib/rghost/function.rb +38 -0
  19. data/lib/rghost/gif.rb +41 -0
  20. data/lib/rghost/graphic.rb +26 -0
  21. data/lib/rghost/grid/base_grid.rb +228 -0
  22. data/lib/rghost/grid/callback_facade.rb +136 -0
  23. data/lib/rghost/grid/csv_grid.rb +51 -0
  24. data/lib/rghost/grid/dynamic_callback.rb +12 -0
  25. data/lib/rghost/grid/field_format.rb +43 -0
  26. data/lib/rghost/grid/grid.rb +15 -0
  27. data/lib/rghost/grid/header.rb +120 -0
  28. data/lib/rghost/grid/matrix.rb +10 -0
  29. data/lib/rghost/grid/rails_grid.rb +74 -0
  30. data/lib/rghost/grid/static_callback.rb +13 -0
  31. data/lib/rghost/grid/style/border_lines.rb +44 -0
  32. data/lib/rghost/grid/style/bottom_lines.rb +28 -0
  33. data/lib/rghost/grid/style/old_forms.rb +28 -0
  34. data/lib/rghost/grid/style/style.rb +8 -0
  35. data/lib/rghost/gs_alone.rb +25 -0
  36. data/lib/rghost/helpers.rb +13 -0
  37. data/lib/rghost/horizontal_line.rb +45 -0
  38. data/lib/rghost/how_to.rb +75 -0
  39. data/lib/rghost/image.rb +26 -0
  40. data/lib/rghost/jpeg.rb +39 -0
  41. data/lib/rghost/line.rb +89 -0
  42. data/lib/rghost/line_width.rb +28 -0
  43. data/lib/rghost/load.rb +43 -0
  44. data/lib/rghost/newpath.rb +19 -0
  45. data/lib/rghost/paper.rb +147 -0
  46. data/lib/rghost/parse_text.rb +53 -0
  47. data/lib/rghost/pdf_security.rb +36 -0
  48. data/lib/rghost/point.rb +23 -0
  49. data/lib/rghost/point_with_command.rb +17 -0
  50. data/lib/rghost/polygon.rb +75 -0
  51. data/lib/rghost/ps/AdobeExpert.enc +258 -0
  52. data/lib/rghost/ps/AdobeLatinEncoding.enc +258 -0
  53. data/lib/rghost/ps/Bengali.enc +386 -0
  54. data/lib/rghost/ps/CodePage1250.enc +258 -0
  55. data/lib/rghost/ps/CodePage1251.enc +258 -0
  56. data/lib/rghost/ps/CodePage1252.enc +258 -0
  57. data/lib/rghost/ps/CodePage1253.enc +258 -0
  58. data/lib/rghost/ps/CodePage1254.enc +258 -0
  59. data/lib/rghost/ps/CodePage1256.enc +258 -0
  60. data/lib/rghost/ps/CodePage1257.enc +258 -0
  61. data/lib/rghost/ps/CodePage1258.enc +258 -0
  62. data/lib/rghost/ps/CodePage874.enc +258 -0
  63. data/lib/rghost/ps/Fontmap +5 -0
  64. data/lib/rghost/ps/IsoLatin.enc +352 -0
  65. data/lib/rghost/ps/MacCentralEuropean.enc +258 -0
  66. data/lib/rghost/ps/MacCyrillice.desnc +258 -0
  67. data/lib/rghost/ps/MacGreek.enc +258 -0
  68. data/lib/rghost/ps/MacHebrew.enc +258 -0
  69. data/lib/rghost/ps/TeX-CorkEncoding.enc +258 -0
  70. data/lib/rghost/ps/TeX-LGR-Greek.enc +258 -0
  71. data/lib/rghost/ps/TeX-T2AModified2Encoding.enc +258 -0
  72. data/lib/rghost/ps/TeX-T2BAdobeEncoding.enc +258 -0
  73. data/lib/rghost/ps/TeX-T2CAdobeEncoding.enc +258 -0
  74. data/lib/rghost/ps/TeX-X2AdobeEncoding.enc +258 -0
  75. data/lib/rghost/ps/TeX-XL2encoding.enc +258 -0
  76. data/lib/rghost/ps/TeXMathExtensionEncoding.enc +258 -0
  77. data/lib/rghost/ps/TeXMathItalicEncoding.enc +258 -0
  78. data/lib/rghost/ps/TeXMathSymbolEncoding.enc +258 -0
  79. data/lib/rghost/ps/US-ASCII.enc +258 -0
  80. data/lib/rghost/ps/UTF-8.enc +3 -0
  81. data/lib/rghost/ps/_cusor.ps +46 -0
  82. data/lib/rghost/ps/basic.ps +25 -0
  83. data/lib/rghost/ps/begin_document.ps +8 -0
  84. data/lib/rghost/ps/callbacks.ps +175 -0
  85. data/lib/rghost/ps/code128.font +344 -0
  86. data/lib/rghost/ps/code39.font +195 -0
  87. data/lib/rghost/ps/cursor.ps +106 -0
  88. data/lib/rghost/ps/datagrid.ps +55 -0
  89. data/lib/rghost/ps/developer.ps +237 -0
  90. data/lib/rghost/ps/ean.font +150 -0
  91. data/lib/rghost/ps/eps.ps +42 -0
  92. data/lib/rghost/ps/font.ps +38 -0
  93. data/lib/rghost/ps/frame.ps +16 -0
  94. data/lib/rghost/ps/gif.ps +150 -0
  95. data/lib/rghost/ps/horizontal_line.ps +4 -0
  96. data/lib/rghost/ps/i25.font +103 -0
  97. data/lib/rghost/ps/jpeg.ps +122 -0
  98. data/lib/rghost/ps/link.ps +22 -0
  99. data/lib/rghost/ps/paper.ps +8 -0
  100. data/lib/rghost/ps/rect_link.ps +17 -0
  101. data/lib/rghost/ps/rectangle.ps +5 -0
  102. data/lib/rghost/ps/rghost_default_template.eps +1532 -0
  103. data/lib/rghost/ps/row.ps +4 -0
  104. data/lib/rghost/ps/show.ps +21 -0
  105. data/lib/rghost/ps/table_callbacks.ps +96 -0
  106. data/lib/rghost/ps/text.ps +63 -0
  107. data/lib/rghost/ps/textarea.ps +11 -0
  108. data/lib/rghost/ps/type.ps +1 -0
  109. data/lib/rghost/ps/unit.ps +3 -0
  110. data/lib/rghost/ps/vertical_line.ps +12 -0
  111. data/lib/rghost/ps/virtual_pages.ps +55 -0
  112. data/lib/rghost/ps_facade.rb +253 -0
  113. data/lib/rghost/ps_object.rb +55 -0
  114. data/lib/rghost/rectangle_link.rb +65 -0
  115. data/lib/rghost/rgengine.so +0 -0
  116. data/lib/rghost/ruby_ghost_config.rb +243 -0
  117. data/lib/rghost/ruby_ghost_engine.rb +156 -0
  118. data/lib/rghost/ruby_ghost_version.rb +8 -0
  119. data/lib/rghost/ruby_to_ps.rb +78 -0
  120. data/lib/rghost/scale.rb +29 -0
  121. data/lib/rghost/shape_content.rb +23 -0
  122. data/lib/rghost/show.rb +88 -0
  123. data/lib/rghost/static_document_callback.rb +18 -0
  124. data/lib/rghost/text.rb +44 -0
  125. data/lib/rghost/text_in.rb +51 -0
  126. data/lib/rghost/text_link_in.rb +42 -0
  127. data/lib/rghost/textarea.rb +88 -0
  128. data/lib/rghost/units.rb +82 -0
  129. data/lib/rghost/variable.rb +12 -0
  130. data/lib/rghost/vertical_line.rb +37 -0
  131. data/lib/rghost/virtual_pages.rb +42 -0
  132. metadata +185 -0
@@ -0,0 +1,8 @@
1
+ module RGhost::VERSION #:nodoc:
2
+ MAJOR = 0
3
+ MINOR = 8
4
+ TINY = 7
5
+ DATE=1244286414
6
+ STRING = [MAJOR, MINOR, TINY].join('.')
7
+
8
+ end
@@ -0,0 +1,78 @@
1
+ #Converts Ruby types to Postscript types
2
+ module RGhost::RubyToPs
3
+
4
+
5
+ def to_string(value)
6
+ #ps escape
7
+ value=pack_string(value)
8
+ ps_str=ps_escape(value)
9
+
10
+ "(#{ps_str}) "
11
+
12
+ end
13
+
14
+ def pack_string(s)
15
+ if RGhost::Config::GS[:charset_convert]
16
+ RGhost::Config::GS[:charset_convert].call(s.to_s).to_s
17
+ else
18
+ s
19
+ end
20
+ end
21
+
22
+
23
+ def ps_escape(value)
24
+ #value.to_s.gsub(/\(/,'\\(').gsub(/\)/,"\\)").gsub(/\\/,"\134")
25
+ value.to_s.gsub(/(\(|\)|\\)/,'\\\\\1')
26
+ end
27
+
28
+ def to_bool(value)
29
+ value ? "true":"false"
30
+ end
31
+
32
+ def to_string_array(arr)
33
+
34
+ "[#{arr.map{|a| to_string(a.to_s) }}] "
35
+ end
36
+
37
+ def to_array(arr)
38
+ return "[ ]" unless arr
39
+ ps_arr=[]
40
+ arr.each do |a|
41
+ ps_arr << case a
42
+ when TrueClass,FalseClass then to_bool(a)
43
+ when Numeric then a
44
+ when Proc then a.to_s
45
+ when Array then to_array(a)
46
+ else
47
+ to_string(a.to_s)
48
+ end
49
+ end
50
+ "[#{ps_arr.join(' ')}] "
51
+ end
52
+
53
+ def hash_to_array(hash)
54
+ to_string_array(hash.values)
55
+ end
56
+
57
+ def array_to_stack(arr)
58
+ "#{arr.join(' ')} "
59
+ end
60
+
61
+ def string_eval(str)
62
+ str=pack_string(str)
63
+ return "(#{ps_escape(str)}) show " unless str =~ /%/
64
+
65
+ s=str.scan(/([^%][a-z]*[^%]|\d+%?)|(%[^\s%]+%)/).flatten.compact
66
+ #puts s
67
+ tudo=""
68
+ s.each do |v|
69
+ case v
70
+ when /^%/ then tudo << "#{v.gsub(/%/,'')} to_s show "
71
+ else
72
+ tudo << "(#{ps_escape(v)}) show "
73
+ end
74
+ end
75
+ tudo
76
+ end
77
+ end
78
+
@@ -0,0 +1,29 @@
1
+ require "rghost/ps_object"
2
+ #Scales objects
3
+
4
+ class RGhost::Scale < RGhost::PsObject
5
+ #===Examples
6
+ # doc.scale(1,1) #default document scale
7
+ #
8
+ #link:images/scale01.png
9
+ #
10
+ # doc.scale(1,3)
11
+ #
12
+ #link:images/scale02.png
13
+ #
14
+ # doc.scale(3,3)
15
+ #
16
+ #link:images/scale03.png
17
+ def initialize(sx,sy)
18
+ super("#{sx} #{sy} scale")
19
+ end
20
+ #Scale proportionally by value in percent
21
+ #===Example
22
+ # doc.zoom(300) # 300% the same that scale(3,3)
23
+ def self.zoom(value=100)
24
+
25
+ RGhost::Scale.new(value/100.0,value/100.0)
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,23 @@
1
+ #Responsible for fill shapes
2
+ class RGhost::ShapeContent < RGhost::PsObject
3
+
4
+ DEFAULT_OPTIONS={
5
+ :fill => true, :color => "#F0FFFF"
6
+
7
+ }
8
+ #You can use parameter :color(facade for Color.create) or disable using :fill => false
9
+ def initialize(options={})
10
+ super(""){}
11
+ @options = DEFAULT_OPTIONS.dup.merge(options)
12
+ end
13
+
14
+ def ps
15
+ p=RGhost::PsObject.new
16
+ p.raw :gsave
17
+ p.set RGhost::Color.create(@options[:color]) if @options[:color]
18
+ p.raw :fill if @options[:fill]
19
+ p.raw :grestore
20
+ p
21
+ end
22
+
23
+ end
@@ -0,0 +1,88 @@
1
+ require "rghost/ps_object"
2
+ require "rghost/ruby_to_ps" #to_string
3
+
4
+ #Writes a text on the current row or point with align.
5
+ class RGhost::Show < RGhost::PsObject
6
+
7
+ attr_accessor :text, :align, :tag
8
+ DEFAULT_OPTIONS={:tag => :default_font, :align => :show_left}
9
+ include RGhost::RubyToPs
10
+ #===Options
11
+ #
12
+ #* <tt>:tag or :with</tt> - Use predefined tag
13
+ #* <tt>:color</tt> - Override color of the tag
14
+ #* <tt>:align</tt> - Align of the text
15
+ #===Examples
16
+ #The vertical line is the current point. For align by point
17
+ # doc.moveto :x => 3, :y => 4
18
+ # doc.show "Foo Bar Baz", :align => :show_left #default
19
+ #link:images/show01.png
20
+ #
21
+ # doc.moveto :x => 3, :y => 4
22
+ # doc.show "Foo Bar Baz", :align => :show_center
23
+ #link:images/show02.png
24
+ #
25
+ # doc.moveto :x => 3, :y => 4
26
+ # doc.show "Foo Bar Baz", :align => :show_right
27
+ #link:images/show03.png
28
+ #
29
+ #For the the current row it's not necessary positioned using moveto. Like below
30
+ # doc.show "Foo Bar Baz", :align => :show_right
31
+ #Now justification in page
32
+ #
33
+ # doc.show "Foo Bar Baz", :align => :page_left
34
+ #
35
+ #link:images/show04.png
36
+ #
37
+ # doc.show "Foo Bar Baz", :align => :page_center
38
+ #
39
+ #link:images/show05.png
40
+ #
41
+ # doc.show "Foo Bar Baz", :align => :page_right
42
+ #
43
+ #link:images/show06.png
44
+ #
45
+ #====Overrinding tag's color
46
+ #
47
+ # doc.show "Foo Bar Baz", :with => :my_italic, :align => :page_center, :color => :red
48
+ #
49
+ #link:images/show07.png
50
+ #
51
+ #Many tags per row
52
+ # doc=Document.new
53
+ # doc.define_tags do
54
+ # tag :font1, :name => 'Helvetica', :size => 10, :color => '#F34811'
55
+ # tag :font2, :name => 'Times', :size => 14, :color => '#A4297A'
56
+ # tag :font3, :name => 'TimesBold', :size => 18, :color => '#AA3903'
57
+ # end
58
+ #
59
+ # doc.show "foo bar baz ", :with => :font1
60
+ # doc.show "qux quux ", :with => :font2
61
+ # doc.show "corge ", :with => :font3
62
+ # doc.show "grault garply ",:with => :font2
63
+ # doc.show "qux quux", :with => :font1
64
+ #
65
+ #link:images/show08.png
66
+
67
+
68
+
69
+ def initialize(text,options={ :align=>:show_left, :tag => :default_font, :color => 0 } )
70
+ @text = text
71
+ @options=DEFAULT_OPTIONS.dup.merge(options)
72
+ end
73
+
74
+ def ps
75
+ rtext=RGhost::PsObject.new
76
+ #rtext.raw Color.create(@options[:color] || 0)
77
+ if @options[:with] || @options[:tag]
78
+ f="_#{@options[:with] || @options[:tag]}"
79
+ rtext.raw f
80
+ end
81
+ rtext.raw RGhost::Color.create(@options[:color]) if @options[:color]
82
+ rtext.raw to_string(@text)
83
+ rtext.raw @options[:align]
84
+
85
+ rtext.graphic_scope
86
+ end
87
+
88
+ end
@@ -0,0 +1,18 @@
1
+ require "rghost/ps_object"
2
+ require 'rghost/function'
3
+
4
+ class RGhost::StaticDocumentCallback < RGhost::Function #:nodoc:
5
+ ACCEPT=[:before_document_create,
6
+ :first_page,
7
+ :last_page,
8
+ :after_document_create
9
+ ]
10
+
11
+ def initialize(name,&block)
12
+ raise NameError.new("#{name} no accept in #{self.class}") unless ACCEPT.include? name
13
+ super(name,&block)
14
+ end
15
+
16
+
17
+ end
18
+
@@ -0,0 +1,44 @@
1
+ require "rghost/ps_object"
2
+ require "rghost/units"
3
+ require "rghost/font"
4
+ require "rghost/ruby_to_ps"
5
+ #Wraps the text so as the it fits on the page(:area_x). Wrapping happens at whitespace characters without hyphenation.
6
+ #Additionally you can make use of predefined tag and the special tag <br/> to break row. You can disable the parse with second parameter tag_parse=false.
7
+ #===Examples
8
+ # doc=Document.new
9
+ # doc.define_tags do
10
+ # tag :font1, :name => 'Helvetica', :size => 10, :color => '#F34811'
11
+ # tag :font2, :name => 'Times', :size => 11, :color => '#A4297A'
12
+ # tag :font3, :name => 'TimesBold', :size => 12, :color => '#AA3903'
13
+ # end
14
+ # my_text="<font1>foo, bar, baz</font1>,<font2>qux, quux</font2>, corge, grault, garply, waldo, <font3>fred, plugh,</font3> xyzzy,<br/> thud, bing"
15
+ # doc.text my_text
16
+ #
17
+ #link:images/text01.png
18
+ #
19
+ #===Without parse
20
+ # text="<font1>foo, bar, baz</font1>,<font2>qux, quux</font2>, corge, grault, garply, waldo, <font3>fred, plugh,</font3> xyzzy,<br/> thud, bing"
21
+ # doc.text text,false
22
+ #
23
+ #link:images/text02.png
24
+ class RGhost::Text < RGhost::PsObject
25
+ include RGhost::RubyToPs
26
+ include RGhost::ParseText
27
+ attr_reader :rows
28
+
29
+ def initialize(text,tag_parse=true)
30
+ super("")
31
+ @text=text
32
+ @tag_parse=tag_parse
33
+ @options={:text_align => :left}
34
+ end
35
+
36
+ def ps
37
+ text_to_ps #from RGhost::ParseText
38
+ end
39
+
40
+
41
+
42
+
43
+ end
44
+
@@ -0,0 +1,51 @@
1
+ require "rghost/ps_object"
2
+ require "rghost/cursor"
3
+ require "rghost/ruby_to_ps"
4
+ #TextIn is a helper to combine the cursor positioning and text output into one step.
5
+ class RGhost::TextIn < RGhost::PsObject
6
+ include RGhost::RubyToPs
7
+ DEFAULT_OPTIONS={:x=> :limit_left,:y=> :current_row, :tag => :default_font, :write => "Ruby Ghost API - current_row = %row% "}
8
+ #===Options
9
+ #* <tt>:x and :y</tt> - Initial position.
10
+ #* <tt>:tag or :with</tt> - Use predefined tag.
11
+ #* <tt>:color</tt> - Override color of the tag.
12
+ #* <tt>:text or :write</tt> - The text.
13
+ #===Examples
14
+ # doc=RGhost::Document.new
15
+ # doc.text_in :x => 3, :y => 4, :write => "Foo Bar Baz", :tag => :h1
16
+ #====Rotating
17
+ # doc.newpath do
18
+ # translate :x => 3, :y=> 4
19
+ # rotate 45
20
+ # text_in :x => 0, :y => 0, :write => "Foo Bar Baz1", :tag => :font2
21
+ # end
22
+ #====Eval postscript internal
23
+ #TextIn will eval postscript internal variables you pass in between % signs. Sounds complex, huh? Let's see an example:
24
+ # doc.text_in :x=> 3.5, :y=> 5.5, :text => "this is %row% row and current page %current_page%"
25
+ def initialize(options={})
26
+
27
+ @options=DEFAULT_OPTIONS.dup.merge(options)
28
+ end
29
+
30
+ def ps
31
+ text=RGhost::PsObject.new
32
+ text.set RGhost::Cursor.moveto(@options)
33
+ #text.raw "currentfont"
34
+ #text.raw "currentrgbcolor"
35
+ text.raw RGhost::Color.create(@options[:color]) if @options[:color]
36
+ f="_#{@options[:with] || @options[:tag] || :default_font}"
37
+ text.raw f
38
+ #text.call @options[:with] || @options[:tag] || :default_font
39
+
40
+ text.raw string_eval(@options[:text] || @options[:write] )
41
+ #text.raw "setrgbcolor"
42
+ #text.raw "setfont"
43
+ text.graphic_scope
44
+ #text.set PsObject.new(@options[:text])
45
+
46
+
47
+
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,42 @@
1
+ require "rghost/ps_object"
2
+ require "rghost/cursor"
3
+ require "rghost/ruby_to_ps"
4
+ #TextLinkIn is a helper to combine the cursor positioning and text with hyperlink output into one step as TextIn.
5
+ #It works only PDF format
6
+ class RGhost::TextLinkIn < RGhost::PsObject
7
+ include RGhost::RubyToPs
8
+ DEFAULT_OPTIONS={:x=> :limit_left,:y=> :current_row, :tag => :default_font, :color => :blue,:label => "RGhost API", :url => 'http://rghost.rubyforge.org'}
9
+ #===Options
10
+ #* <tt>:x and :y</tt> - Initial position.
11
+ #* <tt>:tag or :with</tt> - Use predefined tag.
12
+ #* <tt>:color</tt> - Override color of the tag.
13
+ #* <tt>:label</tt> - The text.
14
+ #* <tt>:url</tt> - Hyperlink.
15
+ #===Examples
16
+ # doc=RGhost::Document.new
17
+ # doc.text_link "Shairon at Hashcode", :url => "http://www.hashcode.eti.br", :color => :blue, :x => 3, :y => 4, :tag => :h1
18
+ #====Rotating
19
+ # doc.newpath do
20
+ # translate :x => 3, :y=> 4
21
+ # rotate 45
22
+ # text_link "RGhost website", :url => "http://rghost.rubyforge.org", :x => 0, :y => 0, :tag => :font2
23
+ # end
24
+ def initialize(options={})
25
+
26
+ @options=DEFAULT_OPTIONS.dup.merge(options)
27
+ end
28
+
29
+ def ps
30
+ text=RGhost::PsObject.new
31
+ text.set RGhost::Cursor.moveto(@options)
32
+ text.raw RGhost::Color.create(@options[:color]) if @options[:color]
33
+ f="_#{@options[:with] || @options[:tag] || :default_font}"
34
+ text.raw f
35
+ text.raw "/:link_str #{to_string(@options[:label])} def /:link_uri #{to_string(@options[:url])} def :link_make "
36
+ text.ps
37
+
38
+
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,88 @@
1
+ require "rghost/ps_object"
2
+ require "rghost/units"
3
+ require "rghost/font"
4
+ require "rghost/ruby_to_ps"
5
+ require 'rghost/parse_text'
6
+ #TextArea wraps the text so as the it fits in a box of a given width. Wrapping happens at whitespace characters without hyphenation.
7
+ #Additionally you can make use of predefined tag and the special tag <br/> to break row.
8
+ #The alignment can be left, right and centered.
9
+ #
10
+ #PS: It not jumps pages.
11
+
12
+ class RGhost::TextArea < RGhost::PsObject
13
+ include RGhost::RubyToPs
14
+ include RGhost::ParseText
15
+
16
+ DEFAULT_OPTIONS={
17
+ :width => :area_x,
18
+ :row_height => :row_height,
19
+ :x=> :limit_left,
20
+ :y=> :current_row,
21
+ :text_align => :left
22
+
23
+ }
24
+
25
+ #===Options
26
+ #* <tt>:x and :y</tt> - Initial position.
27
+ #* <tt>:row_height</tt> - Row height :)
28
+ #* <tt>:with</tt> - Max wide of the text
29
+ #* <tt>:text_align</tt> - Align of the text in the virtual box using :left, :right and :center.
30
+ #===Examples
31
+ # doc=RGhost::Document.new
32
+ # my_text="<font1>foo, bar, baz</font1><font2>qux, quux</font2>, corge, grault, garply, waldo, <font3>fred, plugh,</font3> xyzzy,<br/> thud, bing"
33
+ # doc.text_area my_text
34
+ #
35
+ #link:images/text_area01.png
36
+ #
37
+ # doc.text_area my_text, :width =>3
38
+ #
39
+ #link:images/text_area02.png
40
+ #
41
+ # doc.text_area my_text, :width =>3, :text_align => :center
42
+ #
43
+ #link:images/text_area03.png
44
+ #
45
+ # doc.text_area my_text, :width =>3, :text_align => :right
46
+ #
47
+ #link:images/text_area04.png
48
+ #
49
+ # doc.text_area my_text, :width =>3, :text_align => :right, :x => 3
50
+ #
51
+ #link:images/text_area05.png
52
+ #
53
+ # doc.text_area my_text, :width =>3, :text_align => :right, :x => 3, :row_height => 0.6
54
+ #
55
+ #link:images/text_area06.png
56
+
57
+ def initialize(text,options={},tag_parse=true)
58
+ super("")
59
+ @text=text
60
+ @tag_parse=tag_parse
61
+ options||={}
62
+ @options=DEFAULT_OPTIONS.dup.merge(options)
63
+
64
+ end
65
+
66
+ def ps
67
+ bw=RGhost::Units::parse(@options[:width])
68
+ ta=@options[:text_align]
69
+ rh=RGhost::Units::parse(@options[:row_height])
70
+
71
+ graph=RGhost::Graphic.new do
72
+ set RGhost::Variable.new(':bw',bw)
73
+ set RGhost::Variable.new('text_align',"/#{ta}")
74
+ # set Variable.new(':rp',rp)
75
+ set RGhost::Variable.new(':rh',rh)
76
+ end
77
+ graph.set RGhost::Cursor.translate(@options)
78
+ graph.set RGhost::Cursor.moveto(:x => 0, :y =>0)
79
+ #graph.raw ":text_area #{text_to_ps} :text_proc"
80
+ graph.raw text_to_ps
81
+ graph
82
+ #final_text=text_to_ps
83
+
84
+ end
85
+
86
+
87
+ end
88
+