rghost 0.7.4 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (447) hide show
  1. data/lib/rghost/border.rb +44 -0
  2. data/lib/rghost/callback.rb +25 -22
  3. data/lib/rghost/circle.rb +102 -0
  4. data/lib/rghost/color.rb +81 -56
  5. data/lib/rghost/constants.rb +599 -589
  6. data/lib/rghost/convert.rb +26 -7
  7. data/lib/rghost/cursor.rb +90 -58
  8. data/lib/rghost/dash.rb +59 -0
  9. data/lib/rghost/document.rb +334 -311
  10. data/lib/rghost/document_callback_facade.rb +64 -0
  11. data/lib/rghost/dsc_entry.rb +12 -12
  12. data/lib/rghost/dynamic_document_callback.rb +6 -18
  13. data/lib/rghost/eps.rb +17 -8
  14. data/lib/rghost/font.rb +19 -23
  15. data/lib/rghost/font_map.rb +40 -0
  16. data/lib/rghost/frame.rb +105 -0
  17. data/lib/rghost/function.rb +19 -21
  18. data/lib/rghost/gif.rb +22 -9
  19. data/lib/rghost/graphic.rb +3 -3
  20. data/lib/rghost/grid/base_grid.rb +218 -0
  21. data/lib/rghost/grid/callback_facade.rb +136 -0
  22. data/lib/rghost/grid/csv_grid.rb +50 -0
  23. data/lib/rghost/{data_grid → grid}/dynamic_callback.rb +2 -2
  24. data/lib/rghost/grid/field_format.rb +43 -0
  25. data/lib/rghost/grid/grid.rb +15 -0
  26. data/lib/rghost/grid/header.rb +120 -0
  27. data/lib/rghost/grid/matrix.rb +10 -0
  28. data/lib/rghost/grid/rails_grid.rb +70 -0
  29. data/lib/rghost/{data_grid → grid}/static_callback.rb +4 -4
  30. data/lib/rghost/grid/style/border_lines.rb +46 -0
  31. data/lib/rghost/grid/style/bottom_lines.rb +30 -0
  32. data/lib/rghost/grid/style/old_forms.rb +30 -0
  33. data/lib/rghost/grid/style/style.rb +8 -0
  34. data/lib/rghost/gs_alone.rb +7 -5
  35. data/lib/rghost/helpers.rb +4 -4
  36. data/lib/rghost/horizontal_line.rb +35 -19
  37. data/lib/rghost/how_to.rb +75 -0
  38. data/lib/rghost/image.rb +8 -8
  39. data/lib/rghost/jpeg.rb +21 -8
  40. data/lib/rghost/line.rb +66 -17
  41. data/lib/rghost/line_width.rb +19 -8
  42. data/lib/rghost/load.rb +24 -22
  43. data/lib/rghost/newpath.rb +8 -7
  44. data/lib/rghost/paper.rb +100 -41
  45. data/lib/rghost/parse_text.rb +53 -0
  46. data/lib/rghost/point.rb +9 -8
  47. data/lib/rghost/point_with_command.rb +5 -5
  48. data/lib/rghost/polygon.rb +75 -0
  49. data/lib/rghost/ps/AdobeExpert.enc +0 -0
  50. data/lib/rghost/ps/AdobeLatinEncoding.enc +0 -0
  51. data/lib/rghost/ps/Bengali.enc +0 -0
  52. data/lib/rghost/ps/CodePage1250.enc +0 -0
  53. data/lib/rghost/ps/CodePage1251.enc +0 -0
  54. data/lib/rghost/ps/CodePage1252.enc +0 -0
  55. data/lib/rghost/ps/CodePage1253.enc +0 -0
  56. data/lib/rghost/ps/CodePage1254.enc +0 -0
  57. data/lib/rghost/ps/CodePage1256.enc +0 -0
  58. data/lib/rghost/ps/CodePage1257.enc +0 -0
  59. data/lib/rghost/ps/CodePage1258.enc +0 -0
  60. data/lib/rghost/ps/CodePage874.enc +0 -0
  61. data/lib/rghost/ps/Fontmap +5 -0
  62. data/lib/rghost/ps/IsoLatin.enc +0 -0
  63. data/lib/rghost/ps/MacCentralEuropean.enc +0 -0
  64. data/lib/rghost/ps/{MacCyrillice.enc → MacCyrillice.desnc} +0 -0
  65. data/lib/rghost/ps/MacGreek.enc +0 -0
  66. data/lib/rghost/ps/MacHebrew.enc +0 -0
  67. data/lib/rghost/ps/TeX-CorkEncoding.enc +0 -0
  68. data/lib/rghost/ps/TeX-LGR-Greek.enc +0 -0
  69. data/lib/rghost/ps/TeX-T2AModified2Encoding.enc +0 -0
  70. data/lib/rghost/ps/TeX-T2BAdobeEncoding.enc +0 -0
  71. data/lib/rghost/ps/TeX-T2CAdobeEncoding.enc +0 -0
  72. data/lib/rghost/ps/TeX-X2AdobeEncoding.enc +0 -0
  73. data/lib/rghost/ps/TeX-XL2encoding.enc +0 -0
  74. data/lib/rghost/ps/TeXMathExtensionEncoding.enc +0 -0
  75. data/lib/rghost/ps/TeXMathItalicEncoding.enc +0 -0
  76. data/lib/rghost/ps/TeXMathSymbolEncoding.enc +0 -0
  77. data/lib/rghost/ps/US-ASCII.enc +0 -0
  78. data/lib/rghost/ps/UTF-8.enc +0 -0
  79. data/lib/rghost/ps/__datagrid.ps +52 -0
  80. data/lib/rghost/ps/_cusor.ps +46 -0
  81. data/lib/rghost/ps/basic.ps +12 -1
  82. data/lib/rghost/ps/begin_document.ps +1 -0
  83. data/lib/rghost/ps/callbacks.ps +32 -3
  84. data/lib/rghost/ps/code128.font +0 -0
  85. data/lib/rghost/ps/code39.font +0 -0
  86. data/lib/rghost/ps/cursor.ps +77 -13
  87. data/lib/rghost/ps/datagrid.ps +4 -1
  88. data/lib/rghost/ps/developer.ps +237 -0
  89. data/lib/rghost/ps/ean.font +0 -0
  90. data/lib/rghost/ps/eps.ps +0 -0
  91. data/lib/rghost/ps/font.ps +8 -1
  92. data/lib/rghost/ps/frame.ps +16 -0
  93. data/lib/rghost/ps/gif.ps +0 -0
  94. data/lib/rghost/ps/horizontal_line.ps +4 -3
  95. data/lib/rghost/ps/i25.font +0 -0
  96. data/lib/rghost/ps/jpeg.ps +0 -0
  97. data/lib/rghost/ps/paper.ps +0 -0
  98. data/lib/rghost/ps/rectangle.ps +0 -0
  99. data/lib/rghost/ps/rghost_default_template.eps +1532 -0
  100. data/lib/rghost/ps/row.ps +0 -0
  101. data/lib/rghost/ps/show.ps +2 -1
  102. data/lib/rghost/ps/table_callbacks.ps +0 -0
  103. data/lib/rghost/ps/text.ps +63 -0
  104. data/lib/rghost/ps/textarea.ps +1 -1
  105. data/lib/rghost/ps/type.ps +0 -0
  106. data/lib/rghost/ps/unit.ps +0 -0
  107. data/lib/rghost/ps/vertical_line.ps +2 -4
  108. data/lib/rghost/ps/virtual_pages.ps +55 -0
  109. data/lib/rghost/ps_facade.rb +256 -0
  110. data/lib/rghost/ps_object.rb +24 -20
  111. data/lib/rghost/rgengine.so +0 -0
  112. data/lib/rghost/ruby_ghost_config.rb +224 -16
  113. data/lib/rghost/ruby_ghost_engine.rb +32 -55
  114. data/lib/rghost/ruby_ghost_version.rb +8 -0
  115. data/lib/rghost/ruby_to_ps.rb +52 -78
  116. data/lib/rghost/scale.rb +22 -7
  117. data/lib/rghost/shape_content.rb +23 -0
  118. data/lib/rghost/show.rb +77 -20
  119. data/lib/rghost/static_document_callback.rb +3 -7
  120. data/lib/rghost/text.rb +44 -0
  121. data/lib/rghost/text_in.rb +36 -14
  122. data/lib/rghost/textarea.rb +66 -93
  123. data/lib/rghost/units.rb +45 -44
  124. data/lib/rghost/variable.rb +4 -4
  125. data/lib/rghost/vertical_line.rb +27 -19
  126. data/lib/rghost/virtual_pages.rb +42 -0
  127. data/lib/rghost.rb +16 -2
  128. metadata +153 -500
  129. data/lib/rghost/arc.rb +0 -39
  130. data/lib/rghost/barcode.rb +0 -40
  131. data/lib/rghost/data_grid/basic_grid.rb +0 -136
  132. data/lib/rghost/data_grid/csv_grid.rb +0 -27
  133. data/lib/rghost/data_grid/data_grid.rb +0 -14
  134. data/lib/rghost/data_grid/field_format.rb +0 -60
  135. data/lib/rghost/data_grid/grid.rb +0 -18
  136. data/lib/rghost/data_grid/header.rb +0 -111
  137. data/lib/rghost/data_grid/rails_grid.rb +0 -62
  138. data/lib/rghost/data_grid/style/border_lines.rb +0 -47
  139. data/lib/rghost/data_grid/style/bottom_lines.rb +0 -30
  140. data/lib/rghost/data_grid/style/old_forms.rb +0 -30
  141. data/lib/rghost/data_grid/style/style.rb +0 -8
  142. data/lib/rghost/doc/classes/Arc.html +0 -200
  143. data/lib/rghost/doc/classes/Arc.src/M000049.html +0 -18
  144. data/lib/rghost/doc/classes/Arc.src/M000050.html +0 -23
  145. data/lib/rghost/doc/classes/Barcode.html +0 -214
  146. data/lib/rghost/doc/classes/Barcode.src/M000001.html +0 -19
  147. data/lib/rghost/doc/classes/Barcode.src/M000002.html +0 -18
  148. data/lib/rghost/doc/classes/Barcode.src/M000003.html +0 -19
  149. data/lib/rghost/doc/classes/Barcode.src/M000004.html +0 -27
  150. data/lib/rghost/doc/classes/CMYK.html +0 -209
  151. data/lib/rghost/doc/classes/CMYK.src/M000047.html +0 -18
  152. data/lib/rghost/doc/classes/CMYK.src/M000048.html +0 -24
  153. data/lib/rghost/doc/classes/Callback.html +0 -220
  154. data/lib/rghost/doc/classes/Callback.src/M000071.html +0 -21
  155. data/lib/rghost/doc/classes/Callback.src/M000072.html +0 -26
  156. data/lib/rghost/doc/classes/Color.html +0 -175
  157. data/lib/rghost/doc/classes/Color.src/M000028.html +0 -33
  158. data/lib/rghost/doc/classes/Constants/Colors.html +0 -129
  159. data/lib/rghost/doc/classes/Constants/Devices.html +0 -163
  160. data/lib/rghost/doc/classes/Constants/Devices.src/M000168.html +0 -22
  161. data/lib/rghost/doc/classes/Constants/Fonts.html +0 -144
  162. data/lib/rghost/doc/classes/Constants/Papers.html +0 -124
  163. data/lib/rghost/doc/classes/Constants.html +0 -120
  164. data/lib/rghost/doc/classes/Convert.html +0 -189
  165. data/lib/rghost/doc/classes/Convert.src/M000067.html +0 -20
  166. data/lib/rghost/doc/classes/Convert.src/M000068.html +0 -24
  167. data/lib/rghost/doc/classes/Cursor.html +0 -330
  168. data/lib/rghost/doc/classes/Cursor.src/M000031.html +0 -21
  169. data/lib/rghost/doc/classes/Cursor.src/M000032.html +0 -21
  170. data/lib/rghost/doc/classes/Cursor.src/M000033.html +0 -20
  171. data/lib/rghost/doc/classes/Cursor.src/M000034.html +0 -18
  172. data/lib/rghost/doc/classes/Cursor.src/M000035.html +0 -18
  173. data/lib/rghost/doc/classes/Cursor.src/M000036.html +0 -19
  174. data/lib/rghost/doc/classes/Cursor.src/M000037.html +0 -22
  175. data/lib/rghost/doc/classes/Cursor.src/M000038.html +0 -18
  176. data/lib/rghost/doc/classes/Cursor.src/M000039.html +0 -18
  177. data/lib/rghost/doc/classes/DSCEntry.html +0 -173
  178. data/lib/rghost/doc/classes/DSCEntry.src/M000059.html +0 -19
  179. data/lib/rghost/doc/classes/DSCEntry.src/M000060.html +0 -19
  180. data/lib/rghost/doc/classes/DataGrid/BasicGrid.html +0 -343
  181. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000140.html +0 -27
  182. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000141.html +0 -26
  183. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000142.html +0 -22
  184. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000143.html +0 -19
  185. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000144.html +0 -26
  186. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000145.html +0 -34
  187. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000146.html +0 -18
  188. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000147.html +0 -37
  189. data/lib/rghost/doc/classes/DataGrid/BasicGrid.src/M000148.html +0 -26
  190. data/lib/rghost/doc/classes/DataGrid/CSVGrid.html +0 -152
  191. data/lib/rghost/doc/classes/DataGrid/CSVGrid.src/M000139.html +0 -32
  192. data/lib/rghost/doc/classes/DataGrid/DynamicCallback.html +0 -158
  193. data/lib/rghost/doc/classes/DataGrid/DynamicCallback.src/M000149.html +0 -19
  194. data/lib/rghost/doc/classes/DataGrid/FieldFormat/Custom.html +0 -176
  195. data/lib/rghost/doc/classes/DataGrid/FieldFormat/Custom.src/M000136.html +0 -18
  196. data/lib/rghost/doc/classes/DataGrid/FieldFormat/Custom.src/M000137.html +0 -18
  197. data/lib/rghost/doc/classes/DataGrid/FieldFormat/Custom.src/M000138.html +0 -18
  198. data/lib/rghost/doc/classes/DataGrid/FieldFormat.html +0 -216
  199. data/lib/rghost/doc/classes/DataGrid/FieldFormat.src/M000131.html +0 -19
  200. data/lib/rghost/doc/classes/DataGrid/FieldFormat.src/M000132.html +0 -18
  201. data/lib/rghost/doc/classes/DataGrid/FieldFormat.src/M000133.html +0 -23
  202. data/lib/rghost/doc/classes/DataGrid/FieldFormat.src/M000134.html +0 -18
  203. data/lib/rghost/doc/classes/DataGrid/FieldFormat.src/M000135.html +0 -22
  204. data/lib/rghost/doc/classes/DataGrid/Grid.html +0 -148
  205. data/lib/rghost/doc/classes/DataGrid/Grid.src/M000160.html +0 -19
  206. data/lib/rghost/doc/classes/DataGrid/Header.html +0 -367
  207. data/lib/rghost/doc/classes/DataGrid/Header.src/M000150.html +0 -26
  208. data/lib/rghost/doc/classes/DataGrid/Header.src/M000151.html +0 -25
  209. data/lib/rghost/doc/classes/DataGrid/Header.src/M000152.html +0 -24
  210. data/lib/rghost/doc/classes/DataGrid/Header.src/M000153.html +0 -19
  211. data/lib/rghost/doc/classes/DataGrid/Header.src/M000154.html +0 -18
  212. data/lib/rghost/doc/classes/DataGrid/Header.src/M000155.html +0 -18
  213. data/lib/rghost/doc/classes/DataGrid/Header.src/M000156.html +0 -18
  214. data/lib/rghost/doc/classes/DataGrid/Header.src/M000157.html +0 -18
  215. data/lib/rghost/doc/classes/DataGrid/Header.src/M000158.html +0 -19
  216. data/lib/rghost/doc/classes/DataGrid/Header.src/M000159.html +0 -19
  217. data/lib/rghost/doc/classes/DataGrid/RailsGrid.html +0 -234
  218. data/lib/rghost/doc/classes/DataGrid/RailsGrid.src/M000161.html +0 -27
  219. data/lib/rghost/doc/classes/DataGrid/RailsGrid.src/M000162.html +0 -23
  220. data/lib/rghost/doc/classes/DataGrid/RailsGrid.src/M000163.html +0 -18
  221. data/lib/rghost/doc/classes/DataGrid/StaticCallback.html +0 -158
  222. data/lib/rghost/doc/classes/DataGrid/StaticCallback.src/M000164.html +0 -19
  223. data/lib/rghost/doc/classes/DataGrid/Style/BorderLines.html +0 -137
  224. data/lib/rghost/doc/classes/DataGrid/Style/BorderLines.src/M000128.html +0 -55
  225. data/lib/rghost/doc/classes/DataGrid/Style/BottomLines.html +0 -137
  226. data/lib/rghost/doc/classes/DataGrid/Style/BottomLines.src/M000129.html +0 -38
  227. data/lib/rghost/doc/classes/DataGrid/Style/OldForms.html +0 -137
  228. data/lib/rghost/doc/classes/DataGrid/Style/OldForms.src/M000130.html +0 -38
  229. data/lib/rghost/doc/classes/DataGrid/Style.html +0 -113
  230. data/lib/rghost/doc/classes/DataGrid.html +0 -133
  231. data/lib/rghost/doc/classes/Document.html +0 -990
  232. data/lib/rghost/doc/classes/Document.src/M000075.html +0 -32
  233. data/lib/rghost/doc/classes/Document.src/M000076.html +0 -18
  234. data/lib/rghost/doc/classes/Document.src/M000077.html +0 -29
  235. data/lib/rghost/doc/classes/Document.src/M000078.html +0 -33
  236. data/lib/rghost/doc/classes/Document.src/M000079.html +0 -20
  237. data/lib/rghost/doc/classes/Document.src/M000080.html +0 -21
  238. data/lib/rghost/doc/classes/Document.src/M000081.html +0 -18
  239. data/lib/rghost/doc/classes/Document.src/M000082.html +0 -19
  240. data/lib/rghost/doc/classes/Document.src/M000083.html +0 -21
  241. data/lib/rghost/doc/classes/Document.src/M000084.html +0 -22
  242. data/lib/rghost/doc/classes/Document.src/M000085.html +0 -18
  243. data/lib/rghost/doc/classes/Document.src/M000086.html +0 -18
  244. data/lib/rghost/doc/classes/Document.src/M000087.html +0 -18
  245. data/lib/rghost/doc/classes/Document.src/M000088.html +0 -18
  246. data/lib/rghost/doc/classes/Document.src/M000089.html +0 -19
  247. data/lib/rghost/doc/classes/Document.src/M000090.html +0 -18
  248. data/lib/rghost/doc/classes/Document.src/M000091.html +0 -18
  249. data/lib/rghost/doc/classes/Document.src/M000092.html +0 -18
  250. data/lib/rghost/doc/classes/Document.src/M000093.html +0 -18
  251. data/lib/rghost/doc/classes/Document.src/M000094.html +0 -18
  252. data/lib/rghost/doc/classes/Document.src/M000095.html +0 -18
  253. data/lib/rghost/doc/classes/Document.src/M000096.html +0 -18
  254. data/lib/rghost/doc/classes/Document.src/M000097.html +0 -18
  255. data/lib/rghost/doc/classes/Document.src/M000098.html +0 -18
  256. data/lib/rghost/doc/classes/Document.src/M000099.html +0 -18
  257. data/lib/rghost/doc/classes/Document.src/M000100.html +0 -18
  258. data/lib/rghost/doc/classes/Document.src/M000101.html +0 -18
  259. data/lib/rghost/doc/classes/Document.src/M000102.html +0 -18
  260. data/lib/rghost/doc/classes/Document.src/M000103.html +0 -18
  261. data/lib/rghost/doc/classes/Document.src/M000104.html +0 -18
  262. data/lib/rghost/doc/classes/Document.src/M000105.html +0 -18
  263. data/lib/rghost/doc/classes/Document.src/M000106.html +0 -18
  264. data/lib/rghost/doc/classes/Document.src/M000107.html +0 -18
  265. data/lib/rghost/doc/classes/Document.src/M000108.html +0 -18
  266. data/lib/rghost/doc/classes/Document.src/M000109.html +0 -18
  267. data/lib/rghost/doc/classes/Document.src/M000110.html +0 -18
  268. data/lib/rghost/doc/classes/Document.src/M000111.html +0 -20
  269. data/lib/rghost/doc/classes/Document.src/M000112.html +0 -19
  270. data/lib/rghost/doc/classes/Document.src/M000113.html +0 -19
  271. data/lib/rghost/doc/classes/DynamicDocumentCallback.html +0 -175
  272. data/lib/rghost/doc/classes/DynamicDocumentCallback.src/M000022.html +0 -19
  273. data/lib/rghost/doc/classes/Eps.html +0 -168
  274. data/lib/rghost/doc/classes/Eps.src/M000063.html +0 -20
  275. data/lib/rghost/doc/classes/Eps.src/M000064.html +0 -20
  276. data/lib/rghost/doc/classes/Font.html +0 -205
  277. data/lib/rghost/doc/classes/Font.src/M000061.html +0 -22
  278. data/lib/rghost/doc/classes/Font.src/M000062.html +0 -37
  279. data/lib/rghost/doc/classes/Function.html +0 -196
  280. data/lib/rghost/doc/classes/Function.src/M000045.html +0 -27
  281. data/lib/rghost/doc/classes/Function.src/M000046.html +0 -20
  282. data/lib/rghost/doc/classes/GSAlone.html +0 -154
  283. data/lib/rghost/doc/classes/GSAlone.src/M000065.html +0 -19
  284. data/lib/rghost/doc/classes/GSAlone.src/M000066.html +0 -22
  285. data/lib/rghost/doc/classes/Gif.html +0 -148
  286. data/lib/rghost/doc/classes/Gif.src/M000040.html +0 -30
  287. data/lib/rghost/doc/classes/Graphic.html +0 -153
  288. data/lib/rghost/doc/classes/Graphic.src/M000014.html +0 -18
  289. data/lib/rghost/doc/classes/Gray.html +0 -181
  290. data/lib/rghost/doc/classes/Gray.src/M000026.html +0 -18
  291. data/lib/rghost/doc/classes/Gray.src/M000027.html +0 -19
  292. data/lib/rghost/doc/classes/Helpers/HashKeyMethod.html +0 -131
  293. data/lib/rghost/doc/classes/Helpers/HashKeyMethod.src/M000127.html +0 -18
  294. data/lib/rghost/doc/classes/Helpers/HashKeyMethodClass.html +0 -118
  295. data/lib/rghost/doc/classes/Helpers.html +0 -112
  296. data/lib/rghost/doc/classes/HorizontalLine.html +0 -186
  297. data/lib/rghost/doc/classes/HorizontalLine.src/M000023.html +0 -23
  298. data/lib/rghost/doc/classes/Image.html +0 -176
  299. data/lib/rghost/doc/classes/Image.src/M000042.html +0 -20
  300. data/lib/rghost/doc/classes/Image.src/M000043.html +0 -26
  301. data/lib/rghost/doc/classes/Jpeg.html +0 -148
  302. data/lib/rghost/doc/classes/Jpeg.src/M000013.html +0 -28
  303. data/lib/rghost/doc/classes/Line.html +0 -190
  304. data/lib/rghost/doc/classes/Line.src/M000069.html +0 -20
  305. data/lib/rghost/doc/classes/Line.src/M000070.html +0 -19
  306. data/lib/rghost/doc/classes/LineWidth.html +0 -172
  307. data/lib/rghost/doc/classes/LineWidth.src/M000005.html +0 -18
  308. data/lib/rghost/doc/classes/LineWidth.src/M000006.html +0 -18
  309. data/lib/rghost/doc/classes/Load.html +0 -161
  310. data/lib/rghost/doc/classes/Load.src/M000165.html +0 -21
  311. data/lib/rghost/doc/classes/Load.src/M000166.html +0 -34
  312. data/lib/rghost/doc/classes/Load.src/M000167.html +0 -19
  313. data/lib/rghost/doc/classes/NewPath.html +0 -153
  314. data/lib/rghost/doc/classes/NewPath.src/M000041.html +0 -18
  315. data/lib/rghost/doc/classes/Paper.html +0 -213
  316. data/lib/rghost/doc/classes/Paper.src/M000010.html +0 -20
  317. data/lib/rghost/doc/classes/Paper.src/M000011.html +0 -24
  318. data/lib/rghost/doc/classes/Paper.src/M000012.html +0 -20
  319. data/lib/rghost/doc/classes/Point.html +0 -180
  320. data/lib/rghost/doc/classes/Point.src/M000073.html +0 -20
  321. data/lib/rghost/doc/classes/Point.src/M000074.html +0 -18
  322. data/lib/rghost/doc/classes/PointWithCommand.html +0 -150
  323. data/lib/rghost/doc/classes/PointWithCommand.src/M000115.html +0 -22
  324. data/lib/rghost/doc/classes/PsObject.html +0 -269
  325. data/lib/rghost/doc/classes/PsObject.src/M000015.html +0 -25
  326. data/lib/rghost/doc/classes/PsObject.src/M000016.html +0 -18
  327. data/lib/rghost/doc/classes/PsObject.src/M000017.html +0 -18
  328. data/lib/rghost/doc/classes/PsObject.src/M000018.html +0 -18
  329. data/lib/rghost/doc/classes/PsObject.src/M000019.html +0 -21
  330. data/lib/rghost/doc/classes/PsObject.src/M000020.html +0 -19
  331. data/lib/rghost/doc/classes/PsObject.src/M000021.html +0 -18
  332. data/lib/rghost/doc/classes/RGB.html +0 -213
  333. data/lib/rghost/doc/classes/RGB.src/M000024.html +0 -21
  334. data/lib/rghost/doc/classes/RGB.src/M000025.html +0 -25
  335. data/lib/rghost/doc/classes/Rectangle.html +0 -226
  336. data/lib/rghost/doc/classes/Rectangle.src/M000056.html +0 -18
  337. data/lib/rghost/doc/classes/Rectangle.src/M000057.html +0 -24
  338. data/lib/rghost/doc/classes/Rectangle.src/M000058.html +0 -21
  339. data/lib/rghost/doc/classes/RubyGhostConfig.html +0 -144
  340. data/lib/rghost/doc/classes/RubyGhostConfig.src/M000118.html +0 -22
  341. data/lib/rghost/doc/classes/RubyGhostEngine.html +0 -261
  342. data/lib/rghost/doc/classes/RubyGhostEngine.src/M000007.html +0 -24
  343. data/lib/rghost/doc/classes/RubyGhostEngine.src/M000008.html +0 -96
  344. data/lib/rghost/doc/classes/RubyGhostEngine.src/M000009.html +0 -21
  345. data/lib/rghost/doc/classes/RubyToPs.html +0 -272
  346. data/lib/rghost/doc/classes/RubyToPs.src/M000119.html +0 -23
  347. data/lib/rghost/doc/classes/RubyToPs.src/M000120.html +0 -18
  348. data/lib/rghost/doc/classes/RubyToPs.src/M000121.html +0 -18
  349. data/lib/rghost/doc/classes/RubyToPs.src/M000122.html +0 -19
  350. data/lib/rghost/doc/classes/RubyToPs.src/M000123.html +0 -30
  351. data/lib/rghost/doc/classes/RubyToPs.src/M000124.html +0 -18
  352. data/lib/rghost/doc/classes/RubyToPs.src/M000125.html +0 -18
  353. data/lib/rghost/doc/classes/RubyToPs.src/M000126.html +0 -30
  354. data/lib/rghost/doc/classes/Scale.html +0 -153
  355. data/lib/rghost/doc/classes/Scale.src/M000114.html +0 -18
  356. data/lib/rghost/doc/classes/Show.html +0 -203
  357. data/lib/rghost/doc/classes/Show.src/M000052.html +0 -20
  358. data/lib/rghost/doc/classes/Show.src/M000053.html +0 -19
  359. data/lib/rghost/doc/classes/StaticDocumentCallback.html +0 -168
  360. data/lib/rghost/doc/classes/StaticDocumentCallback.src/M000051.html +0 -19
  361. data/lib/rghost/doc/classes/TextArea.html +0 -217
  362. data/lib/rghost/doc/classes/TextArea.src/M000029.html +0 -22
  363. data/lib/rghost/doc/classes/TextArea.src/M000030.html +0 -24
  364. data/lib/rghost/doc/classes/TextIn.html +0 -201
  365. data/lib/rghost/doc/classes/TextIn.src/M000054.html +0 -19
  366. data/lib/rghost/doc/classes/TextIn.src/M000055.html +0 -24
  367. data/lib/rghost/doc/classes/Units/Cm.html +0 -145
  368. data/lib/rghost/doc/classes/Units/Cm.src/M000175.html +0 -19
  369. data/lib/rghost/doc/classes/Units/Inch.html +0 -145
  370. data/lib/rghost/doc/classes/Units/Inch.src/M000174.html +0 -18
  371. data/lib/rghost/doc/classes/Units/PSUnit.html +0 -139
  372. data/lib/rghost/doc/classes/Units/PSUnit.src/M000170.html +0 -18
  373. data/lib/rghost/doc/classes/Units/Unit.html +0 -190
  374. data/lib/rghost/doc/classes/Units/Unit.src/M000171.html +0 -18
  375. data/lib/rghost/doc/classes/Units/Unit.src/M000172.html +0 -19
  376. data/lib/rghost/doc/classes/Units/Unit.src/M000173.html +0 -18
  377. data/lib/rghost/doc/classes/Units.html +0 -166
  378. data/lib/rghost/doc/classes/Units.src/M000169.html +0 -22
  379. data/lib/rghost/doc/classes/Variable.html +0 -152
  380. data/lib/rghost/doc/classes/Variable.src/M000044.html +0 -18
  381. data/lib/rghost/doc/classes/VerticalLine.html +0 -175
  382. data/lib/rghost/doc/classes/VerticalLine.src/M000116.html +0 -23
  383. data/lib/rghost/doc/classes/VerticalLine.src/M000117.html +0 -19
  384. data/lib/rghost/doc/created.rid +0 -1
  385. data/lib/rghost/doc/files/arc_rb.html +0 -109
  386. data/lib/rghost/doc/files/barcode_rb.html +0 -108
  387. data/lib/rghost/doc/files/callback_rb.html +0 -109
  388. data/lib/rghost/doc/files/color_rb.html +0 -110
  389. data/lib/rghost/doc/files/constants_rb.html +0 -108
  390. data/lib/rghost/doc/files/convert_rb.html +0 -107
  391. data/lib/rghost/doc/files/cursor_rb.html +0 -110
  392. data/lib/rghost/doc/files/data_grid/basic_grid_rb.html +0 -108
  393. data/lib/rghost/doc/files/data_grid/csv_grid_rb.html +0 -108
  394. data/lib/rghost/doc/files/data_grid/data_grid_rb.html +0 -116
  395. data/lib/rghost/doc/files/data_grid/dynamic_callback_rb.html +0 -108
  396. data/lib/rghost/doc/files/data_grid/field_format_rb.html +0 -109
  397. data/lib/rghost/doc/files/data_grid/grid_rb.html +0 -108
  398. data/lib/rghost/doc/files/data_grid/header_rb.html +0 -113
  399. data/lib/rghost/doc/files/data_grid/rails_grid_rb.html +0 -108
  400. data/lib/rghost/doc/files/data_grid/static_callback_rb.html +0 -109
  401. data/lib/rghost/doc/files/data_grid/style/border_lines_rb.html +0 -101
  402. data/lib/rghost/doc/files/data_grid/style/bottom_lines_rb.html +0 -101
  403. data/lib/rghost/doc/files/data_grid/style/old_forms_rb.html +0 -101
  404. data/lib/rghost/doc/files/data_grid/style/style_rb.html +0 -110
  405. data/lib/rghost/doc/files/document_rb.html +0 -150
  406. data/lib/rghost/doc/files/dsc_entry_rb.html +0 -108
  407. data/lib/rghost/doc/files/dynamic_document_callback_rb.html +0 -108
  408. data/lib/rghost/doc/files/eps_rb.html +0 -108
  409. data/lib/rghost/doc/files/font_rb.html +0 -110
  410. data/lib/rghost/doc/files/function_rb.html +0 -108
  411. data/lib/rghost/doc/files/gif_rb.html +0 -114
  412. data/lib/rghost/doc/files/graphic_rb.html +0 -113
  413. data/lib/rghost/doc/files/gs_alone_rb.html +0 -101
  414. data/lib/rghost/doc/files/helpers_rb.html +0 -101
  415. data/lib/rghost/doc/files/horizontal_line_rb.html +0 -109
  416. data/lib/rghost/doc/files/image_rb.html +0 -108
  417. data/lib/rghost/doc/files/jpeg_rb.html +0 -112
  418. data/lib/rghost/doc/files/line_rb.html +0 -109
  419. data/lib/rghost/doc/files/line_width_rb.html +0 -108
  420. data/lib/rghost/doc/files/load_rb.html +0 -108
  421. data/lib/rghost/doc/files/newpath_rb.html +0 -113
  422. data/lib/rghost/doc/files/paper_rb.html +0 -112
  423. data/lib/rghost/doc/files/point_rb.html +0 -109
  424. data/lib/rghost/doc/files/point_with_command_rb.html +0 -109
  425. data/lib/rghost/doc/files/ps_object_rb.html +0 -107
  426. data/lib/rghost/doc/files/rectangle_rb.html +0 -110
  427. data/lib/rghost/doc/files/rghost_rb.html +0 -109
  428. data/lib/rghost/doc/files/ruby_ghost_config_rb.html +0 -109
  429. data/lib/rghost/doc/files/ruby_ghost_engine_rb.html +0 -111
  430. data/lib/rghost/doc/files/ruby_to_ps_rb.html +0 -107
  431. data/lib/rghost/doc/files/scale_rb.html +0 -108
  432. data/lib/rghost/doc/files/show_rb.html +0 -109
  433. data/lib/rghost/doc/files/static_document_callback_rb.html +0 -109
  434. data/lib/rghost/doc/files/text_in_rb.html +0 -110
  435. data/lib/rghost/doc/files/textarea_rb.html +0 -111
  436. data/lib/rghost/doc/files/units_rb.html +0 -109
  437. data/lib/rghost/doc/files/variable_rb.html +0 -108
  438. data/lib/rghost/doc/files/version_rb.html +0 -101
  439. data/lib/rghost/doc/files/vertical_line_rb.html +0 -110
  440. data/lib/rghost/doc/fr_class_index.html +0 -93
  441. data/lib/rghost/doc/fr_file_index.html +0 -81
  442. data/lib/rghost/doc/fr_method_index.html +0 -201
  443. data/lib/rghost/doc/index.html +0 -24
  444. data/lib/rghost/ps/functions.ps +0 -646
  445. data/lib/rghost/rectangle.rb +0 -39
  446. data/lib/rghost/rghost.rb +0 -3
  447. data/lib/rghost/version.rb +0 -9
data/lib/rghost/show.rb CHANGED
@@ -1,31 +1,88 @@
1
1
  require "ps_object"
2
2
  require "ruby_to_ps" #to_string
3
3
 
4
- #Escreve um texto alinhado na faixa corrente ou na p�gina.
5
- class Show < PsObject
4
+ #Writes a text on the current row or point with align.
5
+ class RGhost::Show < RGhost::PsObject
6
6
 
7
- attr_accessor :text, :align
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
8
66
 
9
- include RubyToPs
10
- #Nova inst�ncia de Text.
11
- #Alinhamento pela faixa
12
- # Show.new("Frog say", :align => :show_center) #no centro do ponto corrente
13
- # Show.new("Frog say", :align => :show_left) #(default) ap�s o ponto corrente
14
- # Show.new("Frog say", :align => :show_right) #antes do ponto corrente
15
- #Alinhamento pela p�gina
16
- # Show.new("Page align", :align => :page_center) #centro da p�gina
17
- # Show.new("Page align", :align => :page_left) #esquerda da p�gina
18
- # Show.new("Page align", :align => :page_right) #direita da p�gina
19
- def initialize(text,align={ :align=>:show_left } )
20
- super(text)
21
- @align=align[:align]
22
-
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)
23
72
  end
24
73
 
25
74
  def ps
26
-
27
- "#{to_string(super)} #{@align}"
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
28
86
  end
29
87
 
30
88
  end
31
-
@@ -1,17 +1,13 @@
1
1
  require "ps_object"
2
- require "function"
3
- #Callbacks est�ticos para classe Document
4
- class StaticDocumentCallback < Function
2
+ require 'function'
3
+
4
+ class RGhost::StaticDocumentCallback < RGhost::Function #:nodoc:
5
5
  ACCEPT=[:before_document_create,
6
6
  :first_page,
7
7
  :last_page,
8
8
  :after_document_create
9
9
  ]
10
10
 
11
- #Nova inst�ncia de StaticDocumentCallback. N�o aceita :only ou :excpet
12
- # sc=StaticDocumentCallback.new :before_document_create do
13
- # set HorizontalLine.new
14
- # end
15
11
  def initialize(name,&block)
16
12
  raise NameError.new("#{name} no accept in #{self.class}") unless ACCEPT.include? name
17
13
  super(name,&block)
@@ -0,0 +1,44 @@
1
+ require "ps_object"
2
+ require "units"
3
+ require "font"
4
+ require "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
+
@@ -1,27 +1,49 @@
1
1
  require "ps_object"
2
2
  require "cursor"
3
3
  require "ruby_to_ps"
4
- #Escreve um texto em uma determinada posi��o avaliando com RubyToPs.string_eval
5
- class TextIn < PsObject
6
- include RubyToPs
7
- DEFAULT_OPTIONS={:x=> :limit_left, :y=> :current_row, :text => "Ruby Ghost API - current_row= %row% "}
8
- #Nova inst�ncia de TextIn
9
- # text=TextIn.new(:x => 12, :text => "Text in x=12")
10
- #Avaliando o texto
11
- # text=TextIn.new(:x => 12, :text => "Text in x=12 and current_row = %row%")
12
- #Usando x e y
13
- # text=TextIn.new(:x => 6, :y=> 25, :text => "My Report with RubyGhost")
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%"
14
25
  def initialize(options={})
15
26
 
16
27
  @options=DEFAULT_OPTIONS.dup.merge(options)
17
28
  end
18
29
 
19
30
  def ps
20
- text=PsObject.new
21
- text.set Cursor.moveto(@options)
22
- text.raw string_eval(@options[:text])
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[:write] || @options[:text])
41
+ #text.raw "setrgbcolor"
42
+ #text.raw "setfont"
43
+ text.graphic_scope
23
44
  #text.set PsObject.new(@options[:text])
24
- text
45
+
46
+
25
47
 
26
48
 
27
49
  end
@@ -2,114 +2,87 @@ require "ps_object"
2
2
  require "units"
3
3
  require "font"
4
4
  require "ruby_to_ps"
5
+ require '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.
5
11
 
6
- #�rea de texto com quebra de linha autom�tica(whitespace wrap) e tags de tipo de fonte.
7
- class TextArea < PsObject
8
- include RubyToPs
12
+ class RGhost::TextArea < RGhost::PsObject
13
+ include RGhost::RubyToPs
14
+ include RGhost::ParseText
15
+
9
16
  DEFAULT_OPTIONS={
10
17
  :width => :area_x,
11
18
  :row_height => :row_height,
12
- :x => :limit_left,
13
- :y => :current_row,
14
- :normal => :font_normal,
15
- :bold => :font_bold,
16
- :italic => :font_italic,
17
- :bold_italic => :font_bold_italic
19
+ :x=> :limit_left,
20
+ :y=> :current_row,
21
+ :text_align => :left
22
+
18
23
  }
19
- #Nova inst�ncia de TextArea.
20
- #As seguintes tags s�o aceitas
21
- # <b>Texto negrito</b> # usa a fonte definida na op��o :bold
22
- # <i>Texto it�lico</i> # usa a fonte definida na op��o :italic
23
- # <bi>Text negrito e it�lico</bi> # usa a fonte definida na op��o :bold_italic
24
- # <br> # quebra de linha
25
- #Para texto fora de tag a fonte :normal ser� usada.
26
- #TextArea com 5 unidades de largura
27
- # text="<i>Anonymous</i> will <b>never</b> ask you <br>for sensitive personal information via an email."
28
- # ta=TextArea.new(text,:width => 5)
29
- #TextArea personalizando fontes
30
- # doc=Document.new
31
- # doc.define(:title_font) do
32
- # set Font.new(:name => "Times", :size => 24)
33
- # end
34
- # doc.define(:my_italic) do
35
- # set Font.new(:name => "HelveticaOblique", :size => 10)
36
- # end
37
- # text="<b>My Report</b><br><br>You will notice a new <i>Services</i> tab on your project"
38
- # ta=TextArea.new(text, :x=> 6, :y=> 20, :bold => :title_font, :italic => :my_italic)
39
- # doc.set ta
40
- # doc.render :pdf
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
41
34
  #
42
- def initialize(text,options={})
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)
43
58
  super("")
44
- @text=ps_escape(text)
59
+ @text=text
60
+ @tag_parse=tag_parse
61
+ options||={}
45
62
  @options=DEFAULT_OPTIONS.dup.merge(options)
46
63
 
47
-
48
64
  end
49
65
 
50
66
  def ps
51
- ls=Units::parse( @options[:row_height] )
52
- w=Units::parse( @options[:width] )
53
- x=Units::parse( @options[:x] )
54
- y=Units::parse( @options[:y] )
55
-
56
- <<TEXT_AREA_HEAD
57
- /textbox {
58
- /line_space { #{ls} } def
59
- /lm 0 def
60
- /bm 0 def
61
- /rm #{w} def
62
- /tm 0 def
63
- lm tm moveto
64
- } def
65
- /newline {
66
- tm line_space sub
67
- /tm exch def
68
- lm tm moveto
69
- } def
70
- textarea_defaults
71
- gsave
72
- #{x} #{y} translate
73
- textbox
74
- #{@options[:normal]}
75
- #{text_to_ps(@text)}
76
- grestore
77
- TEXT_AREA_HEAD
78
-
79
- end
80
-
81
- private
82
-
83
- def text_to_ps(text)
84
- text.gsub!(/<br\/?>/,"<br></br>")
85
- text="<b></b>"+text
86
- t=text.scan(/(<\w{1,2}>[^<]*<\/\w{1,2}>)([^<>]*)/).flatten
87
- t.shift
67
+ bw=RGhost::Units::parse(@options[:width])
68
+ ta=@options[:text_align]
69
+ rh=RGhost::Units::parse(@options[:row_height])
88
70
 
89
- formated_text=""
90
-
91
- t.flatten.each do |line|
92
- exp=expand_str(line)
93
- case exp
94
- when /^<b>/: formated_text << "#{@options[:bold]} (#{exp.gsub(/<\/?b>/,'')})S \n"
95
- when /^<i>/: formated_text << "#{@options[:italic]} (#{exp.gsub(/<\/?i>/,'')})S \n"
96
- when /^<bi>/: formated_text << "#{@options[:bold_italic]} (#{exp.gsub(/<\/?bi>/,'')})S \n"
97
- when /^<br><\/br>/: formated_text << " L \n"
98
- when /^\s?$/:
99
- else formated_text << "#{@options[:normal]} (#{exp})S\n"
100
- end
101
-
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)
102
76
  end
103
-
104
- formated_text
105
- end
106
-
107
- def expand_str(s)
108
- ("#{s} " unless s =~ /\s$/) || s
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
+
109
84
  end
110
85
 
86
+
111
87
  end
112
88
 
113
-
114
- #puts TextArea.new
115
- #puts text_to_ps(texto)
data/lib/rghost/units.rb CHANGED
@@ -1,81 +1,82 @@
1
1
  require "function"
2
2
  require "ps_object"
3
- #Modulo de unidades de medida
4
- module Units
5
- #Ponto em Postscript
6
- class Unit < PsObject
3
+ #The postscript default unit is the 1/72th inch. RGhost uses the centimeters (cm) as it's default, mainly for positioning coordinates and numeric object sizes (if the size is a String, it won't be parsed to the default unit). This setting can be changed setting the value of RGhost::Config::GS[:unit] before the document is created using any of the Units child classes.
4
+ #===Example:
5
+ #
6
+ #====Setting to inches.
7
+ # RGhost::Config::GS[:unit]=Units::Inch
8
+ # doc.moveto :x => 1, :y => 2 #=> 1 inch x 2 inches
9
+ #====Explicitly setting to Cm.
10
+ # doc.moveto :x => '1 cm' , :y => '2 cm'
11
+ #====Using the Postscript unit
12
+ # doc.moveto :x => '100' , :y => '200'
13
+ module RGhost::Units
14
+
15
+ class Unit < RGhost::PsObject
7
16
 
8
- attr_accessor :value
17
+ attr_accessor :value
9
18
 
10
- def initialize(value=0)
11
- @value=value
12
- end
19
+ def initialize(value=0)
20
+ @value=value
21
+ end
13
22
 
14
- def ps
23
+ def ps
15
24
 
16
- "#{@value} #{self.class.to_s.gsub('Units::','').downcase} "
17
- end
25
+ "#{@value} #{self.class.to_s.gsub('RGhost::Units::','').downcase} "
26
+ end
18
27
 
19
- def Unit.define
20
- ""
21
- end
28
+ def Unit.define
29
+ ""
30
+ end
22
31
  end
23
32
  #n/72 * 2.545
24
33
  class Cm < Unit
25
34
 
26
- def Cm.define
27
- Function.new("cm","72 div 2.545 mul")
35
+ def Cm.define
36
+ Function.new("cm","72 div 2.545 mul")
28
37
 
29
- end
38
+ end
30
39
 
31
40
  end
32
41
  #n*72
33
42
  class Inch < Unit
34
43
 
35
- def Inch.define
36
- Function.new("inch","72 mul")
37
- end
44
+ def Inch.define
45
+ RGhost::Function.new("inch","72 mul")
46
+ end
38
47
 
39
48
  end
40
49
 
41
50
  class PSUnit < Unit
42
51
 
43
52
  def ps
44
- "#{@value} "
53
+ "#{@value} "
45
54
  end
46
55
 
47
56
  end
48
57
 
49
58
 
50
59
 
51
- #Parse da unidade padr�o
60
+ #Parses units
52
61
  # Units::DEFAULT=Utits::Cm
53
- # Units.parse(2) # "2 cm"
54
- # Units.parse(:row) # "row"
55
- # Units.parse("3 inch") # "3 inch"
56
- # Units.parse("2") # "2"
57
- #Usando medida americana
62
+ # Units.parse(2) #=> "2 cm"
63
+ # Units.parse(:current_row) #=> "current_row"
64
+ # Units.parse("3 inch") #=> "3 inch"
65
+ # Units.parse("2") #=> "2"
66
+ #
67
+ #Using US metric
58
68
  # Units::DEFAULT=Utits::Inch
59
- # Units.parse(2) # "2 inch"
60
- # Units.parse(:row) # "row"
61
- # Units.parse("3 cm") # "3 cm"
62
- # Units.parse("5") # "5"
63
- def Units.parse(value)
69
+ # Units.parse(2) #=> "2 inch"
70
+ # Units.parse(:current_row) #=> "current_row"
71
+ # Units.parse("3 cm") #=> "3 cm"
72
+ # Units.parse("5") #=> "5"
73
+ def self.parse(value)
64
74
  if value.is_a? Numeric
65
- RubyGhostConfig::GS[:unit].new(value)
75
+ RGhost::Config::GS[:unit].new(value)
66
76
  else
67
- PsObject.new(value)
77
+ RGhost::PsObject.new(value)
68
78
  end
69
79
  end
70
80
  end
71
- #c=Cm.new(3)
72
- #puts c.ps
73
- #puts Cm.define
74
- #
75
- # u=Unit.new(3)
76
- # puts u.to_ps+c.to_ps
77
- #
78
- # i=Inch.new(9)
79
- # puts i.to_ps
80
- # puts Inch.define
81
+
81
82
 
@@ -1,9 +1,9 @@
1
1
  require "ps_object"
2
- #Cria uma vari�vel em Postscript
3
- class Variable < PsObject
2
+ #Creates Postscript variable
3
+ class RGhost::Variable < RGhost::PsObject
4
4
 
5
- #Nova inst�ncia de Variable
6
- # v=Variable.new(:mytext, "(text text text text text )")
5
+ #===Example
6
+ # v=Variable.new(:mytext, Show.new("Fooo Barrr") )
7
7
  # doc.set v
8
8
  def initialize(name,value)
9
9
  super("/#{name} #{value} def")
@@ -2,27 +2,35 @@ require "ps_object"
2
2
  require "units"
3
3
  require "load"
4
4
 
5
- #Cria uma linha vertical iniciando da faixa corrente
6
- #
7
- class VerticalLine < PsObject
8
-
9
- #Nova inst�ncia de VerticalLine.
10
- #Desenha linha onde :start_in => posi��o y e :size => o tamanho
11
- # VerticalLine.new(:start_in => 3, :size => 4)
12
- def initialize(start_in=:limit_left,size=:area_y)
13
-
14
- start_in=Units::parse(start_in)
15
- size=Units::parse(size)
16
-
17
- super("#{start_in} #{size} vertical_line")
18
-
5
+ #Creates vertical line starting from current row.
6
+ class RGhost::VerticalLine < RGhost::PsObject
7
+ DEFAULT_OPTIONS={
8
+ :start_in=>:limit_left,:size=>:area_y,
9
+ :border => RGhost::Border::DEFAULT_OPTIONS
10
+ }
11
+ #Draws a vertical line where :start_in => y position and :size => size of line.
12
+ #===Example
13
+ # doc=Document.new
14
+ # doc.vertical_line :start_in => 1, :size => 2, :border => {:color => :red}
15
+ def initialize(options=RGhost::Border::DEFAULT_OPTIONS)
16
+ super(""){}
17
+ options=DEFAULT_OPTIONS.dup.merge(options)
18
+ start_in= RGhost::Units::parse(options[:start_in] || :limit_left)
19
+ size= RGhost::Units::parse(options[:size]|| :area_y)
20
+ g=RGhost::Graphic.new
21
+ g.set RGhost::Border.new(options[:border]) if options[:border]
22
+ g.raw "#{start_in} #{size} vertical_line "
23
+ set g
19
24
  end
20
- #Desenha uma linha vertical do tamanho de :row_height do documento na posi��o :y corrente
25
+ #Draws a vertical line with size or :row_height of the document.
21
26
  # doc=Document.new
22
- # doc.set VerticalLine.row
23
- def VerticalLine.row
24
- PsObject.new(" vlrf")
25
-
27
+ # doc.vertical_line_row
28
+ def self.row(border=RGhost::Border::DEFAULT_OPTIONS)
29
+
30
+ g=RGhost::Graphic.new
31
+ g.set RGhost::Border.new(border)
32
+ g.raw :vlrf
33
+ g
26
34
  end
27
35
 
28
36
  end
@@ -0,0 +1,42 @@
1
+ #Defines virtual pages for the Document by method virtual_pages
2
+ class RGhost::VirtualPages < RGhost::PsObject
3
+
4
+ DEFAULT_OPTIONS={:width => 5, :margin_left => 0}
5
+ include RGhost::RubyToPs
6
+ def initialize(&block)
7
+ super(''){}
8
+ @pages=[]
9
+ instance_eval(&block) if block
10
+
11
+ end
12
+
13
+ def new_page(options=RGhost::VirtualPages::DEFAULT_OPTIONS)
14
+ options.merge(RGhost::VirtualPages::DEFAULT_OPTIONS)
15
+
16
+ @pages << options
17
+ end
18
+
19
+ def ps
20
+ first=true
21
+ all_pages=@pages.map do |p|
22
+ w=RGhost::Units::parse(p[:width])
23
+ if first
24
+ first=false
25
+ "[#{w}]"
26
+ else
27
+ m=RGhost::Units::parse(p[:margin_left])
28
+
29
+ "[#{w} #{m}]"
30
+
31
+ end
32
+ #"[#{m} #{w}]"
33
+ end
34
+ o=RGhost::PsObject.new
35
+ o.set RGhost::Variable.new(:has_vp?, true)
36
+ o.raw "/vp_params [ #{all_pages.join('')} ] def "
37
+ o.call :vp_proc
38
+ o
39
+
40
+ end
41
+
42
+ end