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
@@ -1,28 +1,236 @@
1
1
  require "ps_object"
2
2
  require 'iconv'
3
+ require 'font_map'
3
4
 
4
- module RubyGhostConfig
5
- GS={
6
- :mode => :gsparams,
7
- :path => "/usr/bin/gs",
8
- :tmpdir => ENV["TMP"] || ENV["TMPDIR"] || ENV["TEMPDIR"] || ENV["TEMP"] || "/tmp",
9
- :pslibdir => File.dirname(__FILE__)+File::SEPARATOR+"ps",
10
- :default_params=> %w(gs -dNOPAUSE -dBATCH -dQUIET -dNOPAGEPROMPT),
11
- :stack_elements => 5000,
12
- :font_encoding => :IsoLatin,
13
- :charset_convert => nil, #lambda {|text| Iconv::iconv('latin1','utf8', text) },
14
- :fontsize => 8,
15
- :unit => Units::Cm
16
- }
5
+ #Rghost setup with Ghostscript.
6
+ #Ghostscript runs on a variety of platforms, this is why we recommend the non coupled install for non *nix environments.
7
+ #The gem already comes with a set of defaults but you can change the settings using the Hash RGhost::Config::GS before each use of the API. Listed below are the keys of the said hash.
8
+ #===RGhost::Config::GS[:mode]
9
+ #Operating mode
10
+ #* <tt>:gsparams</tt> In this mode RGhost just pass parameters to the Ghostscript framework.
11
+ #* <tt>:gsapi</tt> based on the exchange of data between Ruby and Ghostscript via rgengine.so using gslib.so.8 or gslib-esp.so.8.
12
+ #
13
+ #===RGhost::Config::GS[:path]
14
+ #Path to the ghostscript executable.
15
+ #====Example on windows
16
+ #RGhost::Config::GS[:path] = "C:\\gs\\bin\\gswin32c.exe"
17
+ #====Example on Linux
18
+ #RGhost::Config::GS[:path] = "/usr/bin/gs"
19
+ #
20
+ #===RGhost::Config::GS[:tmpdir]
21
+ #Temporary directory
22
+ #====Example
23
+ #RGhost::Config::GS[:tmpdir] = "/tmp"
24
+ #
25
+ #===RGhost::Config::GS[:default_params]
26
+ #Allows you to add/remove options. (use with caution!)
27
+ #====Example
28
+ #RGhost::Config::GS[:default_params] << "-dSAFER"
29
+ #
30
+ #===RGhost::Config::GS[:stack_elements]
31
+ #Defines the maximum number of elements for each matrix inside postscript's internal stack, avoiding a stack overflow error..
32
+ #====Example
33
+ #RGhost::Config::GS[:stack_elements]=5000
34
+ #
35
+ #===RGhost::Config::GS[:unit]
36
+ #Set the measure units. See Units::Unit for available units.
37
+ #====Example
38
+ #RGhost::Config::GS[:unit]=Units::Cm
39
+ #
40
+ #===RGhost::Config::GS[:charset_convert]
41
+ #Ruby to PS character conversion proxy. Necessary when the source code isn't on the same encoding of the document.
42
+ #Params is a block that returns a String. The default setting is nil.
43
+ #====Example
44
+ #RGhost::Config::GS[:charset_convert]= lambda {|text| Iconv::iconv("latin1","utf8", text).to_s}
45
+ #
46
+ #===RGhost::Config::GS[:font_encoding]
47
+ #Sets the Postscript font encoding. Default: :IsoLatin
48
+ #====Example
49
+ #RGhost::Config::GS[:font_encoding]= :IsoLatin
50
+ #
51
+ module RGhost::Config
52
+
53
+ DEFAULT_PORTRAIT_TEMPLATE = File.join(File.dirname(__FILE__),"ps","rghost_default_template.eps")
17
54
 
18
55
 
56
+ GS={
57
+ :mode => :gsparams,
58
+ :plugin => nil,
59
+ :path => "/usr/bin/gs",
60
+ :tmpdir => ENV["TMP"] || ENV["TMPDIR"] || ENV["TEMPDIR"] || ENV["TEMP"] || "/tmp",
61
+ :pslibdir => File.join( File.dirname(__FILE__),"ps"),
62
+ :extensions => [],
63
+ :preload => [],
64
+ :default_params=> %w(gs -dNOPAUSE -dBATCH -dQUIET -dNOPAGEPROMPT),
65
+ :stack_elements => 5000,
66
+ :font_encoding => :IsoLatin,
67
+ :charset_convert => lambda {|text| Iconv::iconv('latin1','utf8', text) },
68
+ :fontsize => 8,
69
+ :unit => RGhost::Units::Cm
70
+ }
71
+
72
+
73
+
74
+
19
75
 
20
- def RubyGhostConfig.config_platform
76
+ def self.config_platform #:nodoc:
21
77
 
22
78
  GS[:path]=case PLATFORM
23
- when /linux|darwin|freebsd/: "/usr/bin/gs"
24
- when /mswin/: "C:\\gs\\bin\\gswin32\\gswin32c.exe"
79
+ when /linux|darwin|freebsd/: "/usr/bin/gs"
80
+ when /mswin/: "C:\\gs\\bin\\gswin32\\gswin32c.exe"
25
81
  end
26
82
  end
83
+ #Test if your environment is ready to works. If yes the page below will show.
84
+ #
85
+ #link:images/is_ok.png
86
+ #
87
+ #You can generate this page with the code.
88
+ # RGhost::Config.is_ok?.render :pdf, :filename => "/tmp/mytest.pdf"
89
+ #
90
+ def self.is_ok?
91
+ d=RGhost::Document.new :margin_left => 2.3, :margin_bottom => 2.3
92
+ d.benchmark(:start)
93
+ d.before_page_create do
94
+ image RGhost::Config::DEFAULT_PORTRAIT_TEMPLATE
95
+ end
96
+ d.define_tags do
97
+ new :bigger, :size => 150, :color => "#AAFF33"
98
+ end
99
+ d.text_in :x => 6, :y=> 15, :write => "Yes!", :with => :bigger
100
+ d.text_in :x => 10, :y=> 14, :write => "Your environment is ready!"
101
+ d.text_in :x => 10, :y=> 13, :write => "RGhost Version " + RGhost::VERSION::STRING
102
+ d.text_in :x => 10, :y=> 12, :write => "Created at " + Time.at(RGhost::VERSION::DATE).to_s
103
+ d.text_in :x => 10, :y=> 11, :write => "Now " + Time.now.to_s
104
+
105
+ d.benchmark(:stop)
106
+ d.done
107
+ d
108
+
109
+
110
+
111
+ end
112
+ #This method is a helper to gets the best encoding.
113
+ #
114
+ #link:images/encode_test.png
115
+ #
116
+ #You can generate this page with the code.
117
+ # RGhost::Config.encode_teste("Fiancé").render :pdf, :filename => "/tmp/mytest.pdf"
118
+ #
119
+ #The encode will use on Document class.
120
+ # doc=Document.new :font_encoding => 'IsoLatin'
121
+ #
122
+ def self.encode_test(value)
123
+ d=RGhost::Document.new :paper => :A4, :margin_left => 2 #, :landscape => true
124
+ d.before_page_create do
125
+ image RGhost::Config::DEFAULT_PORTRAIT_TEMPLATE
126
+ end
127
+ exp=File.join(File.dirname(__FILE__),"ps","*.enc")
128
+ d.show "String (Using Helvetica Font)", :with => :b
129
+ d.moveto :x => 16
130
+ d.show "Encode Name", :with => :b
131
+ d.horizontal_line :bottom
132
+ d.next_row
133
+
134
+ Dir.glob(exp).sort.each do |f|
135
+ name=File.basename(f)
136
+ name.gsub!(/\.enc/,'')
137
+ d.set RGhost::Load.library(name,:enc)
138
+ d.set RGhost::Variable.new(:default_encoding,name)
139
+ d.set RGhost::FontMap.new {
140
+ new(:font_test, :name => "Helvetica",:size => 8,:color => "#FF0000", :encoding => true)
141
+ }
142
+
143
+ d.show "#{value}" , :with => :font_test
144
+ d.moveto :x => 16
145
+ d.show "#{name}", :with => :i
146
+ d.next_row
147
+
148
+ end
149
+ d
150
+ end
151
+ #Generates font catalog to use into method define_tags on Document
152
+ # RGhost::Config.enviroment_fonts.render :pdf, :filename => "mycatalog.pdf"
153
+ #link:images/environment_fonts.png
154
+ #
155
+ def self.environment_fonts(text="The quick brown fox jumps over the lazy dog")
156
+
157
+ d=RGhost::Document.new :margin_left => 2.3, :margin_bottom => 2.3
158
+ d.before_page_create do
159
+ image RGhost::Config::DEFAULT_PORTRAIT_TEMPLATE
160
+ end
161
+ d.show "Search Path"
162
+ d.horizontal_line :bottom
163
+ d.next_row
164
+ d.raw :default_font
165
+ d.raw %Q{
166
+ LIBPATH{
167
+ limit_left current_row moveto show
168
+ nrdp
169
+ } forall
170
+
171
+ }
172
+ d.next_row
173
+ d.show "Example"
174
+ d.moveto :x=> 13
175
+ d.show "Font Name"
176
+ d.horizontal_line :bottom
177
+ d.next_row
178
+ #=begin
179
+ d.raw %Q{
180
+ Fontmap{
181
+ 50 string cvs pop dup findfont 10 scalefont setfont
182
+ limit_left current_row moveto (#{text}) show
183
+ 13 cm current_row moveto default_font 0 setgray
184
+ 50 string cvs show
185
+ nrdp
186
+ } forall
187
+ }
188
+ #=end
189
+ d.done
190
+ d
191
+ end
27
192
 
193
+ # .
194
+ #
195
+ #
196
+ #Preseted tags
197
+ #
198
+ #
199
+ #
200
+ #FONTMAP=RGhost::FontMap.new :name => "Helvetica", :size => 8, :encoding => false do
201
+ # new :span
202
+ # new :b, :name => "Helvetica-Bold"
203
+ # new :bold, :name => "Helvetica-Bold"
204
+ # new :normal, :name => "Helvetica"
205
+ # new :i, :name => "Helvetica-Oblique", :size => 8
206
+ # new :bi, :name => "Helvetica-BoldOblique"
207
+ # new :big, :size => 10
208
+ # new :small, :size => 7
209
+ # new :h1, :name => "Helvetica", :size => 14
210
+ # new :h2, :name => "Helvetica", :size => 13
211
+ # new :h3, :name => "Helvetica", :size => 12
212
+ # new :h4, :name => "Helvetica", :size => 11
213
+ # new :h5, :name => "Helvetica", :size => 10
214
+ # new :title, :name => "Helvetica", :size => 20
215
+ # new :pre, :name => "Courier"
216
+ # end
217
+ #
218
+ FONTMAP=RGhost::FontMap.new :name => "Helvetica", :size => 8, :encoding => false do
219
+ new :span
220
+ new :b, :name => "Helvetica-Bold"
221
+ new :bold, :name => "Helvetica-Bold"
222
+ new :normal, :name => "Helvetica"
223
+ new :i, :name => "Helvetica-Oblique", :size => 8
224
+ new :bi, :name => "Helvetica-BoldOblique"
225
+ new :big, :size => 10
226
+ new :small, :size => 7
227
+ new :h1, :name => "Helvetica", :size => 14
228
+ new :h2, :name => "Helvetica", :size => 13
229
+ new :h3, :name => "Helvetica", :size => 12
230
+ new :h4, :name => "Helvetica", :size => 11
231
+ new :h5, :name => "Helvetica", :size => 10
232
+ new :title, :name => "Helvetica", :size => 20
233
+ new :pre, :name => "Courier"
234
+ end
235
+
28
236
  end
@@ -1,21 +1,12 @@
1
1
  require 'ruby_ghost_config'
2
2
  require "constants"
3
- #Motor do RubyGhost. Trata parametros e arquivos tempor�rios para a compila��o do Postscript.
4
- #
5
- class RubyGhostEngine
3
+
4
+ class RGhost::Engine
6
5
  attr_reader :errors, :error, :output
7
6
  DEFAULT_OPTIONS={:device => :pdf }
8
7
 
9
- include Constants::Devices
10
- #Nova inst�ncia de RubyGhostEngine
11
- # d=Document.new
12
- # rge=RubyGhostEngine.new(d, :logfile => "/var/log/rgengine.log")
13
- # img=rge.render(:gif)
14
- # if rge.error
15
- # puts rge.errors
16
- # else
17
- # FileUtils.cp(img,"/local/my/dir/")
18
- # end
8
+ include RGhost::Constants::Devices
9
+
19
10
  def initialize(document,options={})
20
11
  @document=document
21
12
  @options=DEFAULT_OPTIONS.merge(options)
@@ -26,44 +17,26 @@ class RubyGhostEngine
26
17
 
27
18
  end
28
19
 
29
- #Renderiza o documento.
30
- #Valores v�lidos para options.
31
- #
32
- # :logfile => "/var/log/rghost.log"
33
- # :multipage=> true # Para imagens em v�rios arquivos
34
- # :resolution => 72 # Resolu��o
35
- # :size => "200x180" # Para crop da imagem de sa�da
36
- # :range =>2..3 # Range de p�ginas(PDF only)
37
- #Array contendo um Hash para op��es em modo raw do Ghostscript :d ou :s
38
- # :s => [{:GenericResourceDir, :DEFAULTPAPERSIZE=> "a3"}]
39
- # :d => [ {:TextAlphaBits => 2} ]
40
- #
41
- #Exemplo:
42
- # d=Document.new
43
- # #fa�a o documento ....
44
- #
45
- # d.render :pdf # Sa�da em pdf
46
- # d.render :jpeg # Sa�da em jpeg
47
- # d.render :png, :multipage => true # Uma imagem por arquivo
48
- # d.render :tiff, :resolution => 300 # Imagem com resolu��o de 300 dpi
20
+
49
21
  def render(device=nil)
50
- #puts @options.inspect
22
+
51
23
  device||=@options[:device]
52
24
  tmp_filename=@options[:filename]
53
25
  unless tmp_filename
54
- tmp_filename||="#{RubyGhostConfig::GS[:tmpdir]}#{File::SEPARATOR}#{self.object_id.abs}"
26
+ tmp_filename||="#{RGhost::Config::GS[:tmpdir]}#{File::SEPARATOR}#{self.object_id.abs}"
55
27
  file_out="#{tmp_filename}.#{device}"
56
28
  else
57
29
  file_out=tmp_filename
58
30
  end
59
- #puts file_out
31
+
60
32
  file_err="#{tmp_filename}.rgerr"
61
33
 
62
34
  multipage=@options[:multipage]
63
35
  file_out.gsub!(/\./,"_%04d.") if multipage
64
36
 
65
- params=RubyGhostConfig::GS[:default_params].dup #default parameters gs engine
66
- params << "-I#{RubyGhostConfig::GS[:pslibdir]}"
37
+ params=RGhost::Config::GS[:default_params].dup #default parameters gs engine
38
+ params << "-I#{RGhost::Config::GS[:pslibdir]}"
39
+ params << "-I#{RGhost::Config::GS[:extensions].join(' -I')}" if RGhost::Config::GS[:extensions]
67
40
  params << "-sDEVICE=#{device_for(device)}"
68
41
  params.concat format_params(@options[:d],"-d") if @options[:d]
69
42
  params.concat format_params(@options[:s],"-s") if @options[:s]
@@ -79,31 +52,31 @@ class RubyGhostEngine
79
52
 
80
53
 
81
54
  case @document
82
- when Document:
83
- file_in="#{tmp_filename}.rgin"
55
+ when RGhost::Document:
56
+ file_in="#{tmp_filename}.rgin"
84
57
  params.concat @document.gs_paper
85
58
  fi=File.open(file_in,'w')
86
59
  fi.puts @document.ps
87
60
  fi.close
88
61
  when File:
89
- file_in=@document.path
90
- @delete_input=false
62
+ file_in=@document.path
63
+ #@delete_input=false unless @options[:debug]
91
64
  when String:
92
- file_in=@document
93
- @delete_input=false
65
+ file_in=@document
66
+ #@delete_input=false unless @options[:debug]
94
67
  end
95
68
 
96
69
  params << file_in
97
70
 
98
71
  #puts params.inspect
99
72
 
100
- if RubyGhostConfig::GS[:mode] == :gslib
73
+ if RGhost::Config::GS[:mode] == :gslib
101
74
  require "rgengine"
102
75
  gs=RGEngine.new
103
76
  @error=!gs.render(params,params.size)
104
77
  else
105
78
  require 'gs_alone'
106
- gs=GSAlone.new(params)
79
+ gs=RGhost::GSAlone.new(params,@options[:debug])
107
80
  @error=!gs.run
108
81
  end
109
82
 
@@ -117,9 +90,11 @@ class RubyGhostEngine
117
90
  @output=File.open(file_out)
118
91
  end
119
92
  end
120
- File.delete(file_err)
121
- File.delete(file_in) if @delete_input
122
-
93
+ begin
94
+ File.delete(file_err)
95
+ File.delete(file_in) unless (@options[:debug] || @options[:convert])
96
+ rescue
97
+ end
123
98
  log(params) if @options[:logfile]
124
99
  return @output
125
100
  end
@@ -127,16 +102,18 @@ class RubyGhostEngine
127
102
  def clear_output
128
103
  case @output
129
104
  when File:
130
- @output.close
105
+ @output.close
131
106
  File.delete(@output.path)
132
107
  when Array:
133
- @output.each do |f|
108
+ @output.each do |f|
134
109
  f.close
135
110
  File.delete(f.path)
136
111
  end
137
112
  end
138
113
  end
139
-
114
+ def error?
115
+ @error
116
+ end
140
117
  private
141
118
  def log(gp)
142
119
  id=self.object_id.abs
@@ -157,13 +134,13 @@ class RubyGhostEngine
157
134
  r=[]
158
135
  case v
159
136
  when Symbol:
160
- r << "#{pre}#{v}"
137
+ r << "#{pre}#{v}"
161
138
  when Array:
162
- v.each do |av|
139
+ v.each do |av|
163
140
  r << format_params(av,pre).to_s
164
141
  end
165
142
  when Hash:
166
- v.each do |k,v|
143
+ v.each do |k,v|
167
144
  r << "#{pre}#{k}=#{v.to_s.gsub(/ /,'')}"
168
145
  end
169
146
  else
@@ -0,0 +1,8 @@
1
+ module RGhost::VERSION #:nodoc:
2
+ MAJOR = 0
3
+ MINOR = 8
4
+ TINY = 0
5
+ DATE=1211385093
6
+ STRING = [MAJOR, MINOR, TINY].join('.')
7
+
8
+ end
@@ -1,63 +1,62 @@
1
- #Modulo de convers�o e tratamento de valores de Ruby para Postscript
2
- module RubyToPs
1
+ #Converts Ruby types to Postscript types
2
+ module RGhost::RubyToPs
3
3
 
4
- #Converte uma string Ruby para string Postscript
5
- def to_string(value)
6
- #ps escape
4
+
5
+ def to_string(value)
6
+ #ps escape
7
7
  value=pack_string(value)
8
- ps_str=ps_escape(value)
8
+ ps_str=ps_escape(value)
9
9
 
10
- "(#{ps_str}) "
10
+ "(#{ps_str}) "
11
11
 
12
- end
13
- def pack_string(s)
14
- if RubyGhostConfig::GS[:charset_convert]
15
- RubyGhostConfig::GS[:charset_convert].call(s.to_s).to_s
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
16
17
  else
17
18
  s
18
19
  end
19
- end
20
+ end
20
21
 
21
- #Escapa ( e ) para string postscript
22
- def ps_escape(value)
23
- value.to_s.gsub(/(\(|\))/,'\\\\\1')
24
- end
25
- #Converte para ps bool
26
- def to_bool(value)
27
- value ? "true":"false"
28
- end
29
- #Converte para um array de string ps
30
- def to_string_array(arr)
22
+
23
+ def ps_escape(value)
24
+ value.to_s.gsub(/(\(|\)|\\)/,'\\\\\1')
25
+ end
26
+
27
+ def to_bool(value)
28
+ value ? "true":"false"
29
+ end
30
+
31
+ def to_string_array(arr)
31
32
 
32
- "[#{arr.map{|a| to_string(a.to_s) }}] "
33
- end
34
- #Converte para um array ps
35
- def to_array(arr)
36
- return "[ ]" unless arr
37
- ps_arr=[]
38
- arr.each do |a|
39
- ps_arr << case a
40
- when TrueClass,FalseClass: to_bool(a)
41
- when Numeric: a
42
- when Proc: a.to_s
43
- when Array: to_array(a)
44
- else
45
- to_string(a.to_s)
46
- end
47
- end
48
- "[#{ps_arr.join(' ')}] "
49
- end
50
- #Converte um hash para string array ps
51
- def hash_to_array(hash)
52
- to_string_array(hash.values)
53
- end
54
- #'aload' converte um array para dados em pilha
33
+ "[#{arr.map{|a| to_string(a.to_s) }}] "
34
+ end
35
+
36
+ def to_array(arr)
37
+ return "[ ]" unless arr
38
+ ps_arr=[]
39
+ arr.each do |a|
40
+ ps_arr << case a
41
+ when TrueClass,FalseClass: to_bool(a)
42
+ when Numeric: a
43
+ when Proc: a.to_s
44
+ when Array: to_array(a)
45
+ else
46
+ to_string(a.to_s)
47
+ end
48
+ end
49
+ "[#{ps_arr.join(' ')}] "
50
+ end
51
+
52
+ def hash_to_array(hash)
53
+ to_string_array(hash.values)
54
+ end
55
+
55
56
  def array_to_stack(arr)
56
57
  "#{arr.join(' ')} "
57
58
  end
58
- #Eval para dados internos de postscript.
59
- # s=string_eval("Page: %current_page% of %count_pages%")
60
- #As vari�veis s�o delimitadas por %
59
+
61
60
  def string_eval(str)
62
61
  str=pack_string(str)
63
62
  return "(#{ps_escape(str)}) show " unless str =~ /%/
@@ -67,37 +66,12 @@ module RubyToPs
67
66
  tudo=""
68
67
  s.each do |v|
69
68
  case v
70
- when /^%/: tudo << "#{v.gsub(/%/,'')} to_s show "
71
- else
72
- tudo << "(#{ps_escape(v)}) show "
73
- end
69
+ when /^%/: tudo << "#{v.gsub(/%/,'')} to_s show "
70
+ else
71
+ tudo << "(#{ps_escape(v)}) show "
72
+ end
74
73
  end
75
- tudo
74
+ tudo
76
75
  end
77
76
  end
78
77
 
79
-
80
-
81
- #class Teste
82
- # include RubyToPs
83
-
84
- #end
85
- #Teste.new.string_eval("diga %current_row oi")
86
-
87
- #
88
- #class Ligacoes < ActiveRecord::Base
89
- #
90
- #end
91
- #
92
- #ActiveRecord::Base.establish_connection(:adapter => "postgresql",:database => "fonip", :host => 'solaris', :username => 'fonip', :password=>'qwe123')
93
- #
94
- #t=Teste.new
95
- #liga=Ligacoes.find(:all, :limit => 50, :conditions => "id > 100")
96
- #
97
- #puts liga.class
98
- #
99
- #liga.each do |l|
100
- #
101
- #puts t.hash_to_array(l.attributes)
102
- #
103
- #end
data/lib/rghost/scale.rb CHANGED
@@ -1,14 +1,29 @@
1
1
  require "ps_object"
2
- #Escala dos objetos
2
+ #Scales objects
3
3
 
4
- class Scale < PsObject
5
- #Nova inst�ncia de Scale
6
- # Scale.new(1,1) # default postscript
7
- # Scale.new(0.5,0.5) # zoom de 50%
8
- # Scale.new(2,2) # zoom de 200%
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
9
17
  def initialize(sx,sy)
10
18
  super("#{sx} #{sy} scale")
11
19
  end
12
-
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
13
28
 
14
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