prawn-graph 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. data/README.markdown +51 -2
  2. data/Rakefile +16 -2
  3. data/lib/prawn/graph.rb +1 -4
  4. data/lib/prawn/graph/bar.rb +39 -143
  5. data/lib/prawn/graph/base.rb +207 -0
  6. data/lib/prawn/graph/errors.rb +2 -1
  7. data/lib/prawn/graph/grid.rb +5 -0
  8. data/lib/prawn/graph/line.rb +40 -1
  9. data/lib/prawn/graph/theme.rb +24 -0
  10. metadata +19 -312
  11. data/vendor/prawn-core/COPYING +0 -340
  12. data/vendor/prawn-core/HACKING +0 -46
  13. data/vendor/prawn-core/LICENSE +0 -56
  14. data/vendor/prawn-core/README +0 -138
  15. data/vendor/prawn-core/Rakefile +0 -75
  16. data/vendor/prawn-core/bench/afm_text_bench.rb +0 -18
  17. data/vendor/prawn-core/bench/png_type_6.rb +0 -15
  18. data/vendor/prawn-core/bench/ttf_text_bench.rb +0 -19
  19. data/vendor/prawn-core/bugs/indentation_across_pagebreaks.rb +0 -15
  20. data/vendor/prawn-core/bugs/resolved/canvas_sets_y_to_0.rb +0 -15
  21. data/vendor/prawn-core/bugs/resolved/png_barcode_issue.rb +0 -11
  22. data/vendor/prawn-core/bugs/resolved/transaction_page_number_issue_79.rb +0 -21
  23. data/vendor/prawn-core/bugs/resolved/ttf_fails_in_transactions.rb +0 -24
  24. data/vendor/prawn-core/data/encodings/win_ansi.txt +0 -29
  25. data/vendor/prawn-core/data/fonts/Action Man.dfont +0 -0
  26. data/vendor/prawn-core/data/fonts/Activa.ttf +0 -0
  27. data/vendor/prawn-core/data/fonts/Chalkboard.ttf +0 -0
  28. data/vendor/prawn-core/data/fonts/Courier-Bold.afm +0 -342
  29. data/vendor/prawn-core/data/fonts/Courier-BoldOblique.afm +0 -342
  30. data/vendor/prawn-core/data/fonts/Courier-Oblique.afm +0 -342
  31. data/vendor/prawn-core/data/fonts/Courier.afm +0 -342
  32. data/vendor/prawn-core/data/fonts/DejaVuSans.ttf +0 -0
  33. data/vendor/prawn-core/data/fonts/Dustismo_Roman.ttf +0 -0
  34. data/vendor/prawn-core/data/fonts/Helvetica-Bold.afm +0 -2827
  35. data/vendor/prawn-core/data/fonts/Helvetica-BoldOblique.afm +0 -2827
  36. data/vendor/prawn-core/data/fonts/Helvetica-Oblique.afm +0 -3051
  37. data/vendor/prawn-core/data/fonts/Helvetica.afm +0 -3051
  38. data/vendor/prawn-core/data/fonts/MustRead.html +0 -19
  39. data/vendor/prawn-core/data/fonts/Symbol.afm +0 -213
  40. data/vendor/prawn-core/data/fonts/Times-Bold.afm +0 -2588
  41. data/vendor/prawn-core/data/fonts/Times-BoldItalic.afm +0 -2384
  42. data/vendor/prawn-core/data/fonts/Times-Italic.afm +0 -2667
  43. data/vendor/prawn-core/data/fonts/Times-Roman.afm +0 -2419
  44. data/vendor/prawn-core/data/fonts/ZapfDingbats.afm +0 -225
  45. data/vendor/prawn-core/data/fonts/comicsans.ttf +0 -0
  46. data/vendor/prawn-core/data/fonts/gkai00mp.ttf +0 -0
  47. data/vendor/prawn-core/data/images/16bit.alpha +0 -0
  48. data/vendor/prawn-core/data/images/16bit.dat +0 -0
  49. data/vendor/prawn-core/data/images/16bit.png +0 -0
  50. data/vendor/prawn-core/data/images/arrow.png +0 -0
  51. data/vendor/prawn-core/data/images/arrow2.png +0 -0
  52. data/vendor/prawn-core/data/images/barcode_issue.png +0 -0
  53. data/vendor/prawn-core/data/images/dice.alpha +0 -0
  54. data/vendor/prawn-core/data/images/dice.dat +0 -0
  55. data/vendor/prawn-core/data/images/dice.png +0 -0
  56. data/vendor/prawn-core/data/images/dice_interlaced.png +0 -0
  57. data/vendor/prawn-core/data/images/fractal.jpg +0 -0
  58. data/vendor/prawn-core/data/images/letterhead.jpg +0 -0
  59. data/vendor/prawn-core/data/images/page_white_text.alpha +0 -0
  60. data/vendor/prawn-core/data/images/page_white_text.dat +0 -0
  61. data/vendor/prawn-core/data/images/page_white_text.png +0 -0
  62. data/vendor/prawn-core/data/images/pigs.jpg +0 -0
  63. data/vendor/prawn-core/data/images/rails.dat +0 -0
  64. data/vendor/prawn-core/data/images/rails.png +0 -0
  65. data/vendor/prawn-core/data/images/ruport.png +0 -0
  66. data/vendor/prawn-core/data/images/ruport_data.dat +0 -0
  67. data/vendor/prawn-core/data/images/ruport_transparent.png +0 -0
  68. data/vendor/prawn-core/data/images/ruport_type0.png +0 -0
  69. data/vendor/prawn-core/data/images/stef.jpg +0 -0
  70. data/vendor/prawn-core/data/images/tru256.bmp +0 -0
  71. data/vendor/prawn-core/data/images/web-links.dat +0 -1
  72. data/vendor/prawn-core/data/images/web-links.png +0 -0
  73. data/vendor/prawn-core/data/shift_jis_text.txt +0 -1
  74. data/vendor/prawn-core/examples/bounding_box/bounding_boxes.rb +0 -43
  75. data/vendor/prawn-core/examples/bounding_box/indentation.rb +0 -34
  76. data/vendor/prawn-core/examples/bounding_box/russian_boxes.rb +0 -36
  77. data/vendor/prawn-core/examples/bounding_box/stretched_nesting.rb +0 -67
  78. data/vendor/prawn-core/examples/column_box/column_box_example.rb +0 -43
  79. data/vendor/prawn-core/examples/example_helper.rb +0 -3
  80. data/vendor/prawn-core/examples/general/background.rb +0 -23
  81. data/vendor/prawn-core/examples/general/canvas.rb +0 -15
  82. data/vendor/prawn-core/examples/general/context_sensitive_headers.rb +0 -37
  83. data/vendor/prawn-core/examples/general/float.rb +0 -11
  84. data/vendor/prawn-core/examples/general/margin.rb +0 -36
  85. data/vendor/prawn-core/examples/general/measurement_units.rb +0 -51
  86. data/vendor/prawn-core/examples/general/metadata-info.rb +0 -16
  87. data/vendor/prawn-core/examples/general/multi_page_layout.rb +0 -18
  88. data/vendor/prawn-core/examples/general/outlines.rb +0 -50
  89. data/vendor/prawn-core/examples/general/page_geometry.rb +0 -31
  90. data/vendor/prawn-core/examples/general/page_numbering.rb +0 -15
  91. data/vendor/prawn-core/examples/general/repeaters.rb +0 -47
  92. data/vendor/prawn-core/examples/general/stamp.rb +0 -41
  93. data/vendor/prawn-core/examples/graphics/basic_images.rb +0 -23
  94. data/vendor/prawn-core/examples/graphics/cmyk.rb +0 -12
  95. data/vendor/prawn-core/examples/graphics/curves.rb +0 -11
  96. data/vendor/prawn-core/examples/graphics/hexagon.rb +0 -13
  97. data/vendor/prawn-core/examples/graphics/image_fit.rb +0 -15
  98. data/vendor/prawn-core/examples/graphics/image_flow.rb +0 -37
  99. data/vendor/prawn-core/examples/graphics/image_position.rb +0 -17
  100. data/vendor/prawn-core/examples/graphics/line.rb +0 -32
  101. data/vendor/prawn-core/examples/graphics/png_types.rb +0 -22
  102. data/vendor/prawn-core/examples/graphics/polygons.rb +0 -16
  103. data/vendor/prawn-core/examples/graphics/remote_images.rb +0 -12
  104. data/vendor/prawn-core/examples/graphics/rounded_polygons.rb +0 -19
  105. data/vendor/prawn-core/examples/graphics/rounded_rectangle.rb +0 -20
  106. data/vendor/prawn-core/examples/graphics/ruport_style_helpers.rb +0 -19
  107. data/vendor/prawn-core/examples/graphics/stroke_bounds.rb +0 -20
  108. data/vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb +0 -45
  109. data/vendor/prawn-core/examples/graphics/stroke_dash.rb +0 -42
  110. data/vendor/prawn-core/examples/graphics/transformations.rb +0 -52
  111. data/vendor/prawn-core/examples/graphics/transparency.rb +0 -26
  112. data/vendor/prawn-core/examples/m17n/chinese_text_wrapping.rb +0 -17
  113. data/vendor/prawn-core/examples/m17n/euro.rb +0 -15
  114. data/vendor/prawn-core/examples/m17n/sjis.rb +0 -28
  115. data/vendor/prawn-core/examples/m17n/utf8.rb +0 -13
  116. data/vendor/prawn-core/examples/m17n/win_ansi_charset.rb +0 -54
  117. data/vendor/prawn-core/examples/text/alignment.rb +0 -18
  118. data/vendor/prawn-core/examples/text/dfont.rb +0 -48
  119. data/vendor/prawn-core/examples/text/family_based_styling.rb +0 -24
  120. data/vendor/prawn-core/examples/text/font_calculations.rb +0 -91
  121. data/vendor/prawn-core/examples/text/font_size.rb +0 -33
  122. data/vendor/prawn-core/examples/text/indent_paragraphs.rb +0 -18
  123. data/vendor/prawn-core/examples/text/kerning.rb +0 -30
  124. data/vendor/prawn-core/examples/text/rotated.rb +0 -98
  125. data/vendor/prawn-core/examples/text/simple_text.rb +0 -17
  126. data/vendor/prawn-core/examples/text/simple_text_ttf.rb +0 -17
  127. data/vendor/prawn-core/examples/text/span.rb +0 -29
  128. data/vendor/prawn-core/examples/text/text_box.rb +0 -88
  129. data/vendor/prawn-core/examples/text/text_box_returning_excess.rb +0 -51
  130. data/vendor/prawn-core/examples/text/text_flow.rb +0 -67
  131. data/vendor/prawn-core/lib/prawn/byte_string.rb +0 -7
  132. data/vendor/prawn-core/lib/prawn/compatibility.rb +0 -51
  133. data/vendor/prawn-core/lib/prawn/core.rb +0 -87
  134. data/vendor/prawn-core/lib/prawn/core/page.rb +0 -88
  135. data/vendor/prawn-core/lib/prawn/core/text.rb +0 -65
  136. data/vendor/prawn-core/lib/prawn/document.rb +0 -596
  137. data/vendor/prawn-core/lib/prawn/document/annotations.rb +0 -65
  138. data/vendor/prawn-core/lib/prawn/document/bounding_box.rb +0 -402
  139. data/vendor/prawn-core/lib/prawn/document/column_box.rb +0 -113
  140. data/vendor/prawn-core/lib/prawn/document/destinations.rb +0 -92
  141. data/vendor/prawn-core/lib/prawn/document/graphics_state.rb +0 -49
  142. data/vendor/prawn-core/lib/prawn/document/internals.rb +0 -153
  143. data/vendor/prawn-core/lib/prawn/document/page_geometry.rb +0 -136
  144. data/vendor/prawn-core/lib/prawn/document/snapshot.rb +0 -80
  145. data/vendor/prawn-core/lib/prawn/document/span.rb +0 -55
  146. data/vendor/prawn-core/lib/prawn/encoding.rb +0 -121
  147. data/vendor/prawn-core/lib/prawn/errors.rb +0 -83
  148. data/vendor/prawn-core/lib/prawn/font.rb +0 -329
  149. data/vendor/prawn-core/lib/prawn/font/afm.rb +0 -217
  150. data/vendor/prawn-core/lib/prawn/font/dfont.rb +0 -34
  151. data/vendor/prawn-core/lib/prawn/font/ttf.rb +0 -341
  152. data/vendor/prawn-core/lib/prawn/graphics.rb +0 -321
  153. data/vendor/prawn-core/lib/prawn/graphics/cap_style.rb +0 -38
  154. data/vendor/prawn-core/lib/prawn/graphics/color.rb +0 -205
  155. data/vendor/prawn-core/lib/prawn/graphics/dash.rb +0 -71
  156. data/vendor/prawn-core/lib/prawn/graphics/join_style.rb +0 -38
  157. data/vendor/prawn-core/lib/prawn/graphics/transformation.rb +0 -157
  158. data/vendor/prawn-core/lib/prawn/graphics/transparency.rb +0 -99
  159. data/vendor/prawn-core/lib/prawn/images.rb +0 -337
  160. data/vendor/prawn-core/lib/prawn/images/jpg.rb +0 -46
  161. data/vendor/prawn-core/lib/prawn/images/png.rb +0 -219
  162. data/vendor/prawn-core/lib/prawn/literal_string.rb +0 -14
  163. data/vendor/prawn-core/lib/prawn/measurement_extensions.rb +0 -46
  164. data/vendor/prawn-core/lib/prawn/measurements.rb +0 -71
  165. data/vendor/prawn-core/lib/prawn/name_tree.rb +0 -166
  166. data/vendor/prawn-core/lib/prawn/object_store.rb +0 -93
  167. data/vendor/prawn-core/lib/prawn/outline.rb +0 -278
  168. data/vendor/prawn-core/lib/prawn/pdf_object.rb +0 -83
  169. data/vendor/prawn-core/lib/prawn/reference.rb +0 -92
  170. data/vendor/prawn-core/lib/prawn/repeater.rb +0 -129
  171. data/vendor/prawn-core/lib/prawn/stamp.rb +0 -128
  172. data/vendor/prawn-core/lib/prawn/text.rb +0 -271
  173. data/vendor/prawn-core/lib/prawn/text/box.rb +0 -414
  174. data/vendor/prawn-core/meta/Rakefile +0 -36
  175. data/vendor/prawn-core/meta/lib/prawn.rb +0 -2
  176. data/vendor/prawn-core/reference_pdfs/alignment.pdf +0 -229
  177. data/vendor/prawn-core/reference_pdfs/background.pdf +0 -0
  178. data/vendor/prawn-core/reference_pdfs/basic_images.pdf +0 -0
  179. data/vendor/prawn-core/reference_pdfs/bounding_boxes.pdf +0 -128
  180. data/vendor/prawn-core/reference_pdfs/canvas.pdf +0 -78
  181. data/vendor/prawn-core/reference_pdfs/chinese_flow.pdf +0 -0
  182. data/vendor/prawn-core/reference_pdfs/cmyk.pdf +0 -0
  183. data/vendor/prawn-core/reference_pdfs/column_box.pdf +0 -3671
  184. data/vendor/prawn-core/reference_pdfs/context_sensitive_headers.pdf +0 -2331
  185. data/vendor/prawn-core/reference_pdfs/curves.pdf +0 -62
  186. data/vendor/prawn-core/reference_pdfs/dfont.pdf +0 -0
  187. data/vendor/prawn-core/reference_pdfs/euro.pdf +0 -75
  188. data/vendor/prawn-core/reference_pdfs/family_style.pdf +0 -286
  189. data/vendor/prawn-core/reference_pdfs/flow.pdf +0 -964
  190. data/vendor/prawn-core/reference_pdfs/font_calculations.pdf +0 -0
  191. data/vendor/prawn-core/reference_pdfs/font_size.pdf +0 -142
  192. data/vendor/prawn-core/reference_pdfs/hexagon.pdf +0 -61
  193. data/vendor/prawn-core/reference_pdfs/image-flow.pdf +0 -0
  194. data/vendor/prawn-core/reference_pdfs/image_fit.pdf +0 -0
  195. data/vendor/prawn-core/reference_pdfs/image_position.pdf +0 -0
  196. data/vendor/prawn-core/reference_pdfs/indentation.pdf +0 -124
  197. data/vendor/prawn-core/reference_pdfs/kerning.pdf +0 -0
  198. data/vendor/prawn-core/reference_pdfs/landscape_a4.pdf +0 -52
  199. data/vendor/prawn-core/reference_pdfs/landscape_legal.pdf +0 -52
  200. data/vendor/prawn-core/reference_pdfs/landscape_letter.pdf +0 -52
  201. data/vendor/prawn-core/reference_pdfs/lines.pdf +0 -116
  202. data/vendor/prawn-core/reference_pdfs/margin.pdf +0 -3850
  203. data/vendor/prawn-core/reference_pdfs/measurement_units.pdf +0 -4667
  204. data/vendor/prawn-core/reference_pdfs/metadata-info.pdf +0 -88
  205. data/vendor/prawn-core/reference_pdfs/multi-layout.pdf +0 -209
  206. data/vendor/prawn-core/reference_pdfs/page_with_numbering.pdf +0 -156
  207. data/vendor/prawn-core/reference_pdfs/png_types.pdf +0 -0
  208. data/vendor/prawn-core/reference_pdfs/portrait_a4.pdf +0 -52
  209. data/vendor/prawn-core/reference_pdfs/portrait_legal.pdf +0 -52
  210. data/vendor/prawn-core/reference_pdfs/portrait_letter.pdf +0 -52
  211. data/vendor/prawn-core/reference_pdfs/pretty_polygons.pdf +0 -122
  212. data/vendor/prawn-core/reference_pdfs/remote_images.pdf +0 -0
  213. data/vendor/prawn-core/reference_pdfs/ruport.pdf +0 -101
  214. data/vendor/prawn-core/reference_pdfs/russian_boxes.pdf +0 -2780
  215. data/vendor/prawn-core/reference_pdfs/simple_text.pdf +0 -136
  216. data/vendor/prawn-core/reference_pdfs/simple_text_ttf.pdf +0 -0
  217. data/vendor/prawn-core/reference_pdfs/sjis.pdf +0 -0
  218. data/vendor/prawn-core/reference_pdfs/span.pdf +0 -1975
  219. data/vendor/prawn-core/reference_pdfs/stamp.pdf +0 -649
  220. data/vendor/prawn-core/reference_pdfs/stretched_nesting.pdf +0 -200
  221. data/vendor/prawn-core/reference_pdfs/stroke_bounds.pdf +0 -135
  222. data/vendor/prawn-core/reference_pdfs/stroke_cap_and_join.pdf +0 -80
  223. data/vendor/prawn-core/reference_pdfs/stroke_dash.pdf +0 -457
  224. data/vendor/prawn-core/reference_pdfs/text_box.pdf +0 -962
  225. data/vendor/prawn-core/reference_pdfs/text_box_returning_excess.pdf +0 -271
  226. data/vendor/prawn-core/reference_pdfs/transparency.pdf +0 -347
  227. data/vendor/prawn-core/reference_pdfs/utf8.pdf +0 -0
  228. data/vendor/prawn-core/reference_pdfs/win-ansi.pdf +0 -6172
  229. data/vendor/prawn-core/spec/annotations_spec.rb +0 -90
  230. data/vendor/prawn-core/spec/bounding_box_spec.rb +0 -185
  231. data/vendor/prawn-core/spec/destinations_spec.rb +0 -15
  232. data/vendor/prawn-core/spec/document_spec.rb +0 -408
  233. data/vendor/prawn-core/spec/font_spec.rb +0 -314
  234. data/vendor/prawn-core/spec/graphics_spec.rb +0 -438
  235. data/vendor/prawn-core/spec/images_spec.rb +0 -79
  236. data/vendor/prawn-core/spec/jpg_spec.rb +0 -25
  237. data/vendor/prawn-core/spec/measurement_units_spec.rb +0 -23
  238. data/vendor/prawn-core/spec/name_tree_spec.rb +0 -112
  239. data/vendor/prawn-core/spec/object_store_spec.rb +0 -75
  240. data/vendor/prawn-core/spec/outline_spec.rb +0 -229
  241. data/vendor/prawn-core/spec/pdf_object_spec.rb +0 -122
  242. data/vendor/prawn-core/spec/png_spec.rb +0 -236
  243. data/vendor/prawn-core/spec/reference_spec.rb +0 -82
  244. data/vendor/prawn-core/spec/repeater_spec.rb +0 -96
  245. data/vendor/prawn-core/spec/snapshot_spec.rb +0 -138
  246. data/vendor/prawn-core/spec/span_spec.rb +0 -49
  247. data/vendor/prawn-core/spec/spec_helper.rb +0 -24
  248. data/vendor/prawn-core/spec/stamp_spec.rb +0 -108
  249. data/vendor/prawn-core/spec/stroke_styles_spec.rb +0 -152
  250. data/vendor/prawn-core/spec/text_at_spec.rb +0 -119
  251. data/vendor/prawn-core/spec/text_box_spec.rb +0 -603
  252. data/vendor/prawn-core/spec/text_spec.rb +0 -308
  253. data/vendor/prawn-core/spec/transparency_spec.rb +0 -75
  254. data/vendor/prawn-core/vendor/pdf-inspector/README +0 -18
  255. data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector.rb +0 -26
  256. data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +0 -18
  257. data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +0 -131
  258. data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/page.rb +0 -25
  259. data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/text.rb +0 -31
  260. data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +0 -19
  261. data/vendor/prawn-core/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
  262. data/vendor/prawn-core/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
  263. data/vendor/prawn-core/vendor/ttfunk/example.rb +0 -45
  264. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk.rb +0 -102
  265. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/directory.rb +0 -17
  266. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +0 -88
  267. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +0 -69
  268. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/reader.rb +0 -44
  269. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/resource_file.rb +0 -78
  270. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset.rb +0 -18
  271. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/base.rb +0 -141
  272. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +0 -46
  273. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +0 -48
  274. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +0 -63
  275. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +0 -51
  276. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset_collection.rb +0 -72
  277. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table.rb +0 -46
  278. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap.rb +0 -34
  279. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +0 -54
  280. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +0 -126
  281. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +0 -79
  282. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf.rb +0 -64
  283. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +0 -81
  284. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +0 -37
  285. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/head.rb +0 -44
  286. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hhea.rb +0 -41
  287. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +0 -47
  288. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern.rb +0 -79
  289. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +0 -62
  290. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/loca.rb +0 -43
  291. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/maxp.rb +0 -40
  292. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/name.rb +0 -119
  293. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/os2.rb +0 -78
  294. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post.rb +0 -91
  295. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +0 -43
  296. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +0 -35
  297. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +0 -23
  298. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +0 -17
  299. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +0 -17
  300. data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/simple.rb +0 -14
  301. data/vendor/prawn-core/www/index.html +0 -196
  302. data/vendor/prawn-core/www/media/bounding_boxes.pdf +0 -146
  303. data/vendor/prawn-core/www/media/bounding_boxes.png +0 -0
  304. data/vendor/prawn-core/www/media/bounding_boxes_out.png +0 -0
  305. data/vendor/prawn-core/www/media/fancy_table.pdf +0 -350
  306. data/vendor/prawn-core/www/media/image.pdf +0 -0
  307. data/vendor/prawn-core/www/media/images.png +0 -0
  308. data/vendor/prawn-core/www/media/prawn_logo.png +0 -0
  309. data/vendor/prawn-core/www/media/tables.png +0 -0
  310. data/vendor/prawn-core/www/media/utf8.pdf +0 -0
  311. data/vendor/prawn-core/www/media/utf8.png +0 -0
  312. data/vendor/prawn-core/www/prawn-Chinese.html +0 -113
  313. data/vendor/prawn-core/www/prawn.css +0 -86
  314. data/vendor/prawn-core/www/twilight.css +0 -266
@@ -1,90 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- class PageAnnotations
6
- attr_reader :pages
7
-
8
- def self.parse(document)
9
- receiver = new
10
- PDF::Reader.string(document.render, receiver)
11
- return receiver
12
- end
13
-
14
- def initialize
15
- @pages = []
16
- end
17
-
18
- def begin_page(params)
19
- @pages << params
20
- end
21
- end
22
-
23
- describe "When creating annotations" do
24
-
25
- before(:each) { create_pdf }
26
-
27
- it "should append annotation to current page" do
28
- @pdf.start_new_page
29
- @pdf.annotate(:Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
30
- obj = PageAnnotations.parse(@pdf)
31
- obj.pages[0][:Annots].nil?.should == true
32
- obj.pages[1][:Annots].length.should == 1
33
- end
34
-
35
- it "should force :Type to be :Annot" do
36
- opts = @pdf.annotate(:Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
37
- opts[:Type].should == :Annot
38
- opts = @pdf.annotate(:Type => :Bogus, :Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
39
- opts[:Type].should == :Annot
40
- end
41
-
42
- end
43
-
44
- describe "When creating text annotations" do
45
-
46
- before(:each) do
47
- @rect = [0,0,10,10]
48
- @content = "Hello, world!"
49
- create_pdf
50
- end
51
-
52
- it "should build appropriate annotation" do
53
- opts = @pdf.text_annotation(@rect, @content)
54
- opts[:Type].should == :Annot
55
- opts[:Subtype].should == :Text
56
- opts[:Rect].should == @rect
57
- opts[:Contents].should == @content
58
- end
59
-
60
- it "should merge extra options" do
61
- opts = @pdf.text_annotation(@rect, @content, :Open => true, :Subtype => :Bogus)
62
- opts[:Subtype].should == :Text
63
- opts[:Open].should == true
64
- end
65
-
66
- end
67
-
68
- describe "When creating link annotations" do
69
-
70
- before(:each) do
71
- @rect = [0,0,10,10]
72
- @dest = "home"
73
- create_pdf
74
- end
75
-
76
- it "should build appropriate annotation" do
77
- opts = @pdf.link_annotation(@rect, :Dest => @dest)
78
- opts[:Type].should == :Annot
79
- opts[:Subtype].should == :Link
80
- opts[:Rect].should == @rect
81
- opts[:Dest].should == @dest
82
- end
83
-
84
- it "should merge extra options" do
85
- opts = @pdf.link_annotation(@rect, :Dest => @dest, :Subtype => :Bogus)
86
- opts[:Subtype].should == :Link
87
- opts[:Dest].should == @dest
88
- end
89
-
90
- end
@@ -1,185 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- describe "A bounding box" do
6
-
7
- before(:each) do
8
- @x = 100
9
- @y = 125
10
- @width = 50
11
- @height = 75
12
- @box = Prawn::Document::BoundingBox.new(nil, [@x,@y], :width => @width,
13
- :height => @height )
14
- end
15
-
16
- it "should have an anchor at (x, y - height)" do
17
- @box.anchor.should == [@x,@y-@height]
18
- end
19
-
20
- it "should have a left boundary of 0" do
21
- @box.left.should == 0
22
- end
23
-
24
- it "should have a right boundary equal to the width" do
25
- @box.right.should == @width
26
- end
27
-
28
- it "should have a top boundary of height" do
29
- @box.top.should == @height
30
- end
31
-
32
- it "should have a bottom boundary of 0" do
33
- @box.bottom.should == 0
34
- end
35
-
36
- it "should have a top-left of [0,height]" do
37
- @box.top_left.should == [0,@height]
38
- end
39
-
40
- it "should have a top-right of [width,height]" do
41
- @box.top_right.should == [@width,@height]
42
- end
43
-
44
- it "should have a bottom-left of [0,0]" do
45
- @box.bottom_left.should == [0,0]
46
- end
47
-
48
- it "should have a bottom-right of [width,0]" do
49
- @box.bottom_right.should == [@width,0]
50
- end
51
-
52
- it "should have an absolute left boundary of x" do
53
- @box.absolute_left.should == @x
54
- end
55
-
56
- it "should have an absolute right boundary of x + width" do
57
- @box.absolute_right.should == @x + @width
58
- end
59
-
60
- it "should have an absolute top boundary of y" do
61
- @box.absolute_top.should == @y
62
- end
63
-
64
- it "should have an absolute bottom boundary of y - height" do
65
- @box.absolute_bottom.should == @y - @height
66
- end
67
-
68
- it "should have an absolute bottom-left of [x,y-height]" do
69
- @box.absolute_bottom_left.should == [@x, @y - @height]
70
- end
71
-
72
- it "should have an absolute bottom-right of [x+width,y-height]" do
73
- @box.absolute_bottom_right.should == [@x + @width , @y - @height]
74
- end
75
-
76
- it "should have an absolute top-left of [x,y]" do
77
- @box.absolute_top_left.should == [@x, @y]
78
- end
79
-
80
- it "should have an absolute top-right of [x+width,y]" do
81
- @box.absolute_top_right.should == [@x + @width, @y]
82
- end
83
-
84
-
85
- end
86
-
87
- describe "drawing bounding boxes" do
88
-
89
- before(:each) { create_pdf }
90
-
91
- it "should restore the margin box when bounding box exits" do
92
- margin_box = @pdf.bounds
93
-
94
- @pdf.bounding_box [100,500] do
95
- #nothing
96
- end
97
-
98
- @pdf.bounds.should == margin_box
99
-
100
- end
101
-
102
- it "should restore the parent bounding box when calls are nested" do
103
- @pdf.bounding_box [100,500], :width => 300, :height => 300 do
104
-
105
- @pdf.bounds.absolute_top.should == 500 + @pdf.margin_box.absolute_bottom
106
- @pdf.bounds.absolute_left.should == 100 + @pdf.margin_box.absolute_left
107
-
108
- parent_box = @pdf.bounds
109
-
110
- @pdf.bounding_box [50,200], :width => 100, :height => 100 do
111
- @pdf.bounds.absolute_top.should == 200 + parent_box.absolute_bottom
112
- @pdf.bounds.absolute_left.should == 50 + parent_box.absolute_left
113
- end
114
-
115
- @pdf.bounds.absolute_top.should == 500 + @pdf.margin_box.absolute_bottom
116
- @pdf.bounds.absolute_left.should == 100 + @pdf.margin_box.absolute_left
117
-
118
- end
119
- end
120
-
121
- it "should calculate a height if none is specified" do
122
- @pdf.bounding_box([100, 500], :width => 100) do
123
- @pdf.text "The rain in Spain falls mainly on the plains."
124
- end
125
-
126
- @pdf.y.should.be.close 458.384, 0.001
127
- end
128
-
129
- it "should keep track of the max height the box was stretched to" do
130
- box = @pdf.bounding_box(@pdf.bounds.top_left, :width => 100) do
131
- @pdf.move_down 100
132
- @pdf.move_up 15
133
- end
134
-
135
- assert_equal 100, box.height
136
- end
137
-
138
- end
139
-
140
- describe "Indentation" do
141
- before(:each) { create_pdf }
142
-
143
- it "should temporarily shift the x coordinate and width" do
144
- @pdf.bounding_box([100,100], :width => 200) do
145
- @pdf.indent(20) do
146
- @pdf.bounds.absolute_left.should == 120
147
- @pdf.bounds.width.should == 180
148
- end
149
- end
150
- end
151
-
152
- it "should restore the x coordinate and width after block exits" do
153
- @pdf.bounding_box([100,100], :width => 200) do
154
- @pdf.indent(20) do
155
- # no-op
156
- end
157
- @pdf.bounds.absolute_left.should == 100
158
- @pdf.bounds.width.should == 200
159
- end
160
- end
161
-
162
- it "should restore the x coordinate and width on error" do
163
- @pdf.bounding_box([100,100], :width => 200) do
164
- begin
165
- @pdf.indent(20) { raise }
166
- rescue
167
- @pdf.bounds.absolute_left.should == 100
168
- @pdf.bounds.width.should == 200
169
- end
170
- end
171
- end
172
-
173
- end
174
-
175
- describe "A canvas" do
176
- before(:each) { create_pdf }
177
-
178
- it "should use whatever the last set y position is" do
179
- @pdf.canvas do
180
- @pdf.bounding_box([100,500],:width => 200) { @pdf.move_down 50 }
181
- end
182
- @pdf.y.should == 450
183
- end
184
- end
185
-
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- describe "When creating destinations" do
6
-
7
- before(:each) { create_pdf }
8
-
9
- it "should add entry to Dests name tree" do
10
- @pdf.dests.data.empty?.should == true
11
- @pdf.add_dest "candy", "chocolate"
12
- @pdf.dests.data.size.should == 1
13
- end
14
-
15
- end
@@ -1,408 +0,0 @@
1
- # encoding: utf-8
2
- require "tempfile"
3
-
4
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
5
-
6
- describe "The cursor" do
7
- it "should equal pdf.y - bounds.absolute_bottom" do
8
- pdf = Prawn::Document.new
9
- pdf.cursor.should == pdf.bounds.top
10
-
11
- pdf.y = 300
12
- pdf.cursor.should == pdf.y - pdf.bounds.absolute_bottom
13
- end
14
-
15
- it "should be able to move relative to the bottom margin" do
16
- pdf = Prawn::Document.new
17
- pdf.move_cursor_to(10)
18
-
19
- pdf.cursor.should == 10
20
- pdf.y.should == pdf.cursor + pdf.bounds.absolute_bottom
21
- end
22
- end
23
-
24
- describe "when generating a document from a subclass" do
25
- it "should be an instance of the subclass" do
26
- custom_document = Class.new(Prawn::Document)
27
- custom_document.generate(Tempfile.new("generate_test").path) do |e|
28
- e.class.should == custom_document
29
- e.should.be.kind_of(Prawn::Document)
30
- end
31
- end
32
-
33
- it "should retain any extensions found on Prawn::Document" do
34
- mod1 = Module.new { attr_reader :test_extensions1 }
35
- mod2 = Module.new { attr_reader :test_extensions2 }
36
-
37
- Prawn::Document.extensions << mod1 << mod2
38
-
39
- custom_document = Class.new(Prawn::Document)
40
- assert_equal [mod1, mod2], custom_document.extensions
41
-
42
- # remove the extensions we added to prawn document
43
- Prawn::Document.extensions.delete(mod1)
44
- Prawn::Document.extensions.delete(mod2)
45
-
46
- assert ! Prawn::Document.new.respond_to?(:test_extensions1)
47
- assert ! Prawn::Document.new.respond_to?(:test_extensions2)
48
-
49
- # verify these still exist on custom class
50
- assert_equal [mod1, mod2], custom_document.extensions
51
-
52
- assert custom_document.new.respond_to?(:test_extensions1)
53
- assert custom_document.new.respond_to?(:test_extensions2)
54
- end
55
-
56
- end
57
-
58
-
59
- describe "When creating multi-page documents" do
60
-
61
- before(:each) { create_pdf }
62
-
63
- it "should initialize with a single page" do
64
- page_counter = PDF::Inspector::Page.analyze(@pdf.render)
65
-
66
- page_counter.pages.size.should == 1
67
- @pdf.page_count.should == 1
68
- end
69
-
70
- it "should provide an accurate page_count" do
71
- 3.times { @pdf.start_new_page }
72
- page_counter = PDF::Inspector::Page.analyze(@pdf.render)
73
-
74
- page_counter.pages.size.should == 4
75
- @pdf.page_count.should == 4
76
- end
77
-
78
- end
79
-
80
- describe "When beginning each new page" do
81
-
82
- describe "Background template feature" do
83
- before(:each) do
84
- @filename = "#{Prawn::BASEDIR}/data/images/pigs.jpg"
85
- @pdf = Prawn::Document.new(:background => @filename)
86
- end
87
- it "should place a background image if it is in options block" do
88
- output = @pdf.render
89
- images = PDF::Inspector::XObject.analyze(output)
90
- # there should be 2 images in the page resources
91
- images.page_xobjects.first.size.should == 1
92
- end
93
- it "should place a background image if it is in options block" do
94
- @pdf.instance_variable_defined?(:@background).should == true
95
- @pdf.instance_variable_get(:@background).should == @filename
96
- end
97
-
98
-
99
- end
100
-
101
-
102
- end
103
-
104
- describe "The page_number method" do
105
- it "should be 1 for a new document" do
106
- pdf = Prawn::Document.new
107
- pdf.page_number.should == 1
108
- end
109
-
110
- it "should be 0 for documents with no pages" do
111
- pdf = Prawn::Document.new(:skip_page_creation => true)
112
- pdf.page_number.should == 0
113
- end
114
-
115
- it "should be changed by go_to_page" do
116
- pdf = Prawn::Document.new
117
- 10.times { pdf.start_new_page }
118
- pdf.go_to_page 3
119
- pdf.page_number.should == 3
120
- end
121
-
122
- end
123
-
124
- describe "on_page_create callback" do
125
- before do
126
- create_pdf
127
- end
128
-
129
- it "should be invoked with document" do
130
- called_with = nil
131
-
132
- @pdf.on_page_create { |*args| called_with = args }
133
-
134
- @pdf.start_new_page
135
-
136
- called_with.should == [@pdf]
137
- end
138
-
139
- it "should be invoked for each new page" do
140
- trigger = mock()
141
- trigger.expects(:fire).times(5)
142
-
143
- @pdf.on_page_create { trigger.fire }
144
-
145
- 5.times { @pdf.start_new_page }
146
- end
147
-
148
- it "should be replaceable" do
149
- trigger1 = mock()
150
- trigger1.expects(:fire).times(1)
151
-
152
- trigger2 = mock()
153
- trigger2.expects(:fire).times(1)
154
-
155
- @pdf.on_page_create { trigger1.fire }
156
-
157
- @pdf.start_new_page
158
-
159
- @pdf.on_page_create { trigger2.fire }
160
-
161
- @pdf.start_new_page
162
- end
163
-
164
- it "should be clearable by calling on_page_create without a block" do
165
- trigger = mock()
166
- trigger.expects(:fire).times(1)
167
-
168
- @pdf.on_page_create { trigger.fire }
169
-
170
- @pdf.start_new_page
171
-
172
- @pdf.on_page_create
173
-
174
- @pdf.start_new_page
175
- end
176
-
177
- end
178
-
179
- describe "Document compression" do
180
-
181
- it "should not compress the page content stream if compression is disabled" do
182
-
183
- pdf = Prawn::Document.new(:compress => false)
184
- pdf.page.content.stubs(:compress_stream).returns(true)
185
- pdf.page.content.expects(:compress_stream).never
186
-
187
- pdf.text "Hi There" * 20
188
- pdf.render
189
- end
190
-
191
- it "should compress the page content stream if compression is enabled" do
192
-
193
- pdf = Prawn::Document.new(:compress => true)
194
- pdf.page.content.stubs(:compress_stream).returns(true)
195
- pdf.page.content.expects(:compress_stream).once
196
-
197
- pdf.text "Hi There" * 20
198
- pdf.render
199
- end
200
-
201
- it "should result in a smaller file size when compressed" do
202
- doc_uncompressed = Prawn::Document.new
203
- doc_compressed = Prawn::Document.new(:compress => true)
204
- [doc_compressed, doc_uncompressed].each do |pdf|
205
- pdf.font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
206
- pdf.text "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历" * 10
207
- end
208
-
209
- doc_compressed.render.length.should.be < doc_uncompressed.render.length
210
- end
211
-
212
- end
213
-
214
- describe "When reopening pages" do
215
- it "should modify the content stream size" do
216
- @pdf = Prawn::Document.new do |pdf|
217
- pdf.text "Page 1"
218
- pdf.start_new_page
219
- pdf.text "Page 2"
220
- pdf.go_to_page 0
221
- pdf.text "More for page 1"
222
- end
223
-
224
- # MalformedPDFError raised if content stream actual length does not match
225
- # dictionary length
226
- lambda{ PDF::Inspector::Page.analyze(@pdf.render) }.
227
- should.not.raise(PDF::Reader::MalformedPDFError)
228
- end
229
-
230
- it "should insert pages after the current page when calling start_new_page" do
231
- pdf = Prawn::Document.new
232
- 3.times { |i| pdf.text "Old page #{i+1}"; pdf.start_new_page }
233
- pdf.go_to_page 1
234
- pdf.start_new_page
235
- pdf.text "New page 2"
236
-
237
- pdf.page_number.should == 2
238
-
239
- pages = PDF::Inspector::Page.analyze(pdf.render).pages
240
- pages.size.should == 5
241
- pages[1][:strings].should == ["New page 2"]
242
- pages[2][:strings].should == ["Old page 2"]
243
- end
244
- end
245
-
246
- describe "When setting page size" do
247
- it "should default to LETTER" do
248
- @pdf = Prawn::Document.new
249
- pages = PDF::Inspector::Page.analyze(@pdf.render).pages
250
- pages.first[:size].should == Prawn::Document::PageGeometry::SIZES["LETTER"]
251
- end
252
-
253
- (Prawn::Document::PageGeometry::SIZES.keys - ["LETTER"]).each do |k|
254
- it "should provide #{k} geometry" do
255
- @pdf = Prawn::Document.new(:page_size => k)
256
- pages = PDF::Inspector::Page.analyze(@pdf.render).pages
257
- pages.first[:size].should == Prawn::Document::PageGeometry::SIZES[k]
258
- end
259
- end
260
-
261
- it "should allow custom page size" do
262
- @pdf = Prawn::Document.new(:page_size => [1920, 1080] )
263
- pages = PDF::Inspector::Page.analyze(@pdf.render).pages
264
- pages.first[:size].should == [1920, 1080]
265
- end
266
-
267
- end
268
-
269
- describe "When setting page layout" do
270
- it "should reverse coordinates for landscape" do
271
- @pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape)
272
- pages = PDF::Inspector::Page.analyze(@pdf.render).pages
273
- pages.first[:size].should == Prawn::Document::PageGeometry::SIZES["A4"].reverse
274
- end
275
- end
276
-
277
- describe "The mask() feature" do
278
- it "should allow transactional restoration of attributes" do
279
- @pdf = Prawn::Document.new
280
- y, line_width = @pdf.y, @pdf.line_width
281
- @pdf.mask(:y, :line_width) do
282
- @pdf.y = y + 1
283
- @pdf.line_width = line_width + 1
284
- @pdf.y.should.not == y
285
- @pdf.line_width.should.not == line_width
286
- end
287
- @pdf.y.should == y
288
- @pdf.line_width.should == line_width
289
- end
290
- end
291
-
292
- describe "The group() feature" do
293
- it "should group a simple block on a single page" do
294
- pdf = Prawn::Document.new do
295
- self.y = 50
296
- group do
297
- text "Hello"
298
- text "World"
299
- end
300
- end
301
-
302
- pages = PDF::Inspector::Page.analyze(pdf.render).pages
303
- pages.size.should == 2
304
- pages[0][:strings].should == []
305
- pages[1][:strings].should == ["Hello", "World"]
306
- end
307
-
308
- it "should raise CannotGroup if the content is too tall" do
309
- lambda {
310
- Prawn::Document.new do
311
- group do
312
- 100.times { text "Too long" }
313
- end
314
- end.render
315
- }.should.raise(Prawn::Errors::CannotGroup)
316
- end
317
-
318
- it "should group within individual column boxes" do
319
- pdf = Prawn::Document.new do
320
- # Set up columns with grouped blocks of 0..49. 0 to 49 is slightly short
321
- # of the height of one page / column, so each column should get its own
322
- # group (every column should start with zero).
323
- column_box([0, bounds.top], :width => bounds.width, :columns => 7) do
324
- 10.times do
325
- group { 50.times { |i| text(i.to_s) } }
326
- end
327
- end
328
- end
329
-
330
- # Second page should start with a 0 because it's a new group.
331
- pages = PDF::Inspector::Page.analyze(pdf.render).pages
332
- pages.size.should == 2
333
- pages[1][:strings].first.should == '0'
334
- end
335
- end
336
-
337
- describe "The render() feature" do
338
- if "spec".respond_to?(:encode!)
339
- it "should return a 8 bit encoded string on a m17n aware VM" do
340
- @pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape)
341
- @pdf.line [100,100], [200,200]
342
- str = @pdf.render
343
- str.encoding.to_s.should == "ASCII-8BIT"
344
- end
345
- end
346
-
347
- it "should trigger before_render callbacks just before rendering" do
348
- pdf = Prawn::Document.new
349
-
350
- seq = sequence("callback_order")
351
-
352
- # Verify the order: finalize -> fire callbacks -> render body
353
- pdf.expects(:finalize_all_page_contents).in_sequence(seq)
354
- trigger = mock()
355
- trigger.expects(:fire).in_sequence(seq)
356
-
357
- # Store away the render_body method to be called below
358
- render_body = pdf.method(:render_body)
359
- pdf.expects(:render_body).in_sequence(seq)
360
-
361
- pdf.before_render{ trigger.fire }
362
-
363
- # Render the body to set up object offsets
364
- render_body.call(StringIO.new)
365
- pdf.render
366
- end
367
- end
368
-
369
- describe "The :optimize_objects option" do
370
- before(:all) do
371
- @wasteful_doc = lambda do
372
- transaction { start_new_page; text "Hidden text"; rollback }
373
- text "Hello world"
374
- end
375
- end
376
-
377
- it "should result in fewer objects when enabled" do
378
- wasteful_pdf = Prawn::Document.new(&@wasteful_doc)
379
- frugal_pdf = Prawn::Document.new(:optimize_objects => true,
380
- &@wasteful_doc)
381
- frugal_pdf.render.size.should.be < wasteful_pdf.render.size
382
- end
383
-
384
- it "should default to :false" do
385
- default_pdf = Prawn::Document.new(&@wasteful_doc)
386
- wasteful_pdf = Prawn::Document.new(:optimize_objects => false,
387
- &@wasteful_doc)
388
- default_pdf.render.size.should == wasteful_pdf.render.size
389
- end
390
-
391
- end
392
-
393
- describe "PDF file versions" do
394
- it "should default to 1.3" do
395
- @pdf = Prawn::Document.new
396
- str = @pdf.render
397
- str[0,8].should == "%PDF-1.3"
398
- end
399
-
400
- it "should allow the default to be changed" do
401
- @pdf = Prawn::Document.new
402
- @pdf.__send__(:min_version, 1.4)
403
- str = @pdf.render
404
- str[0,8].should == "%PDF-1.4"
405
- end
406
- end
407
-
408
-