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,80 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # snapshot.rb : Implements transactional rendering for Prawn
4
- #
5
- # Copyright August 2009, Brad Ediger. All Rights Reserved.
6
- #
7
- # This is free software. Please see the LICENSE and COPYING files for details.
8
- require 'delegate'
9
-
10
- module Prawn
11
- class Document
12
- module Snapshot
13
-
14
- RollbackTransaction = Class.new(StandardError)
15
-
16
- # Call this within a +transaction+ block to roll back the transaction and
17
- # prevent any of its data from being rendered. You must reset the
18
- # y-position yourself if you have performed any drawing operations that
19
- # modify it.
20
- #
21
- def rollback
22
- raise RollbackTransaction
23
- end
24
-
25
- # Run a block of drawing operations, to be completed atomically. If
26
- # +rollback+ is called or a RollbackTransaction exception is raised
27
- # inside the block, all actions taken inside the block will be rolled
28
- # back (with the exception of y-position, which you must restore
29
- # yourself).
30
- #
31
- # Returns true on success, or false if the transaction was rolled back.
32
- #
33
- def transaction
34
- snap = take_snapshot
35
- yield
36
- true
37
- rescue RollbackTransaction
38
- restore_snapshot(snap)
39
- false
40
- end
41
-
42
- private
43
-
44
- # Takes a current snapshot of the document's state, sufficient to
45
- # reconstruct it after it was amended.
46
- def take_snapshot
47
- {:page_content => Marshal.load(Marshal.dump(page.content)),
48
- :current_page => Marshal.load(Marshal.dump(page.dictionary)),
49
- :page_number => @page_number,
50
- :page_kids => @store.pages.data[:Kids].map{|kid| kid.identifier},
51
- :dests => names? &&
52
- Marshal.load(Marshal.dump(names.data[:Dests]))}
53
- end
54
-
55
- # Rolls the page state back to the state of the given snapshot.
56
- def restore_snapshot(shot)
57
- # Because these objects are referenced by identifier from the Pages
58
- # dictionary, we can't just restore them over the current refs in
59
- # page_content and current_page. We have to restore them over the old
60
- # ones.
61
- page.content = shot[:page_content].identifier
62
- page.content.replace shot[:page_content]
63
-
64
- page.dictionary = shot[:current_page].identifier
65
- page.dictionary.replace shot[:current_page]
66
- page.dictionary.data[:Contents] = page.content
67
-
68
- @page_number = shot[:page_number]
69
-
70
- @store.pages.data[:Kids] = shot[:page_kids].map{|id| @store[id]}
71
- @store.pages.data[:Count] = shot[:page_kids].size
72
-
73
- if shot[:dests]
74
- names.data[:Dests] = shot[:dests]
75
- end
76
- end
77
-
78
- end
79
- end
80
- end
@@ -1,55 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # span.rb : Implements text columns
4
- #
5
- # Copyright September 2008, Gregory Brown. All Rights Reserved.
6
- #
7
- # This is free software. Please see the LICENSE and COPYING files for details.
8
-
9
- module Prawn
10
- class Document
11
- # A span is a special purpose bounding box that allows a column of
12
- # elements to be positioned relative to the margin_box.
13
- #
14
- # Arguments:
15
- # +width+:: The width of the column in PDF points
16
- #
17
- # Options:
18
- # <tt>:position</tt>:: One of :left, :center, :right or an x offset
19
- #
20
- # This method is typically used for flowing a column of text from one
21
- # page to the next.
22
- #
23
- # span(350, :position => :center) do
24
- # text "Here's some centered text in a 350 point column. " * 100
25
- # end
26
- #
27
- def span(width, options={})
28
- Prawn.verify_options [:position], options
29
- original_position = self.y
30
-
31
- # FIXME: Any way to move this upstream?
32
- left_boundary = case(options[:position] || :left)
33
- when :left
34
- margin_box.absolute_left
35
- when :center
36
- margin_box.absolute_left + margin_box.width / 2.0 - width /2.0
37
- when :right
38
- margin_box.absolute_right - width
39
- when Numeric
40
- margin_box.absolute_left + options[:position]
41
- else
42
- raise ArgumentError, "Invalid option for :position"
43
- end
44
-
45
- # we need to bust out of whatever nested bounding boxes we're in.
46
- canvas do
47
- bounding_box([left_boundary,
48
- margin_box.absolute_top], :width => width) do
49
- self.y = original_position
50
- yield
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,121 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright September 2008, Gregory Brown, James Healy All Rights Reserved.
4
- #
5
- # This is free software. Please see the LICENSE and COPYING files for details.
6
- #
7
- module Prawn
8
- module Encoding
9
- # Map between unicode and WinAnsiEnoding
10
- #
11
- class WinAnsi #:nodoc:
12
- CHARACTERS = %w[
13
- .notdef .notdef .notdef .notdef
14
- .notdef .notdef .notdef .notdef
15
- .notdef .notdef .notdef .notdef
16
- .notdef .notdef .notdef .notdef
17
- .notdef .notdef .notdef .notdef
18
- .notdef .notdef .notdef .notdef
19
- .notdef .notdef .notdef .notdef
20
- .notdef .notdef .notdef .notdef
21
-
22
- space exclam quotedbl numbersign
23
- dollar percent ampersand quotesingle
24
- parenleft parenright asterisk plus
25
- comma hyphen period slash
26
- zero one two three
27
- four five six seven
28
- eight nine colon semicolon
29
- less equal greater question
30
-
31
- at A B C
32
- D E F G
33
- H I J K
34
- L M N O
35
- P Q R S
36
- T U V W
37
- X Y Z bracketleft
38
- backslash bracketright asciicircum underscore
39
-
40
- grave a b c
41
- d e f g
42
- h i j k
43
- l m n o
44
- p q r s
45
- t u v w
46
- x y z braceleft
47
- bar braceright asciitilde .notdef
48
-
49
- Euro .notdef quotesinglbase florin
50
- quotedblbase ellipsis dagger daggerdbl
51
- circumflex perthousand Scaron guilsinglleft
52
- OE .notdef Zcaron .notdef
53
- .notdef quoteleft quoteright quotedblleft
54
- quotedblright bullet endash emdash
55
- tilde trademark scaron guilsinglright
56
- oe .notdef zcaron ydieresis
57
-
58
- space exclamdown cent sterling
59
- currency yen brokenbar section
60
- dieresis copyright ordfeminine guillemotleft
61
- logicalnot hyphen registered macron
62
- degree plusminus twosuperior threesuperior
63
- acute mu paragraph periodcentered
64
- cedilla onesuperior ordmasculine guillemotright
65
- onequarter onehalf threequarters questiondown
66
-
67
- Agrave Aacute Acircumflex Atilde
68
- Adieresis Aring AE Ccedilla
69
- Egrave Eacute Ecircumflex Edieresis
70
- Igrave Iacute Icircumflex Idieresis
71
- Eth Ntilde Ograve Oacute
72
- Ocircumflex Otilde Odieresis multiply
73
- Oslash Ugrave Uacute Ucircumflex
74
- Udieresis Yacute Thorn germandbls
75
-
76
- agrave aacute acircumflex atilde
77
- adieresis aring ae ccedilla
78
- egrave eacute ecircumflex edieresis
79
- igrave iacute icircumflex idieresis
80
- eth ntilde ograve oacute
81
- ocircumflex otilde odieresis divide
82
- oslash ugrave uacute ucircumflex
83
- udieresis yacute thorn ydieresis
84
- ]
85
-
86
- def initialize
87
- @mapping_file = "#{Prawn::BASEDIR}/data/encodings/win_ansi.txt"
88
- load_mapping if self.class.mapping.empty?
89
- end
90
-
91
- # Converts a Unicode codepoint into a valid WinAnsi single byte character.
92
- #
93
- # If there is no WinAnsi equivlant for a character, a _ will be substituted.
94
- #
95
- def [](codepoint)
96
- # unicode codepoints < 255 map directly to the single byte value in WinAnsi
97
- return codepoint if codepoint <= 255
98
-
99
- # There are a handful of codepoints > 255 that have equivilants in WinAnsi.
100
- # Replace anything else with an underscore
101
- self.class.mapping[codepoint] || 95
102
- end
103
-
104
- def self.mapping
105
- @mapping ||= {}
106
- end
107
-
108
- private
109
-
110
- def load_mapping
111
- RUBY_VERSION >= "1.9" ? mode = "r:BINARY" : mode = "r"
112
- File.open(@mapping_file, mode) do |f|
113
- f.each do |l|
114
- m, single_byte, unicode = *l.match(/([0-9A-Za-z]+);([0-9A-F]{4})/)
115
- self.class.mapping["0x#{unicode}".hex] = "0x#{single_byte}".hex if single_byte
116
- end
117
- end
118
- end
119
- end
120
- end
121
- end
@@ -1,83 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # errors.rb : Implements custom error classes for Prawn
4
- #
5
- # Copyright April 2008, Gregory Brown. All Rights Reserved.
6
- #
7
- # This is free software. Please see the LICENSE and COPYING files for details.
8
- #
9
- module Prawn
10
- module Errors
11
-
12
- # This error is raised when Prawn::PdfObject() encounters a Ruby object it
13
- # cannot convert to PDF
14
- #
15
- FailedObjectConversion = Class.new(StandardError)
16
-
17
- # This error is raised when Document#page_layout is set to anything
18
- # other than :portrait or :landscape
19
- #
20
- InvalidPageLayout = Class.new(StandardError)
21
-
22
- # This error is raised when a method requiring a current page is called
23
- # without being on a page.
24
- #
25
- NotOnPage = Class.new(StandardError)
26
-
27
- # This error is raised when Prawn cannot find a specified font
28
- #
29
- UnknownFont = Class.new(StandardError)
30
-
31
- # Raised when Prawn is asked to draw something into a too-small box
32
- #
33
- CannotFit = Class.new(StandardError)
34
-
35
- # Raised if group() is called with a block that is too big to be
36
- # rendered in the current context.
37
- #
38
- CannotGroup = Class.new(StandardError)
39
-
40
- # This error is raised when Prawn is being used on a M17N aware VM,
41
- # and the user attempts to add text that isn't compatible with UTF-8
42
- # to their document
43
- #
44
- IncompatibleStringEncoding = Class.new(StandardError)
45
-
46
- # This error is raised when Prawn encounters an unknown key in functions
47
- # that accept an options hash. This usually means there is a typo in your
48
- # code or that the option you are trying to use has a different name than
49
- # what you have specified.
50
- #
51
- UnknownOption = Class.new(StandardError)
52
-
53
- # this error is raised when a user attempts to embed an image of an unsupported
54
- # type. This can either a completely unsupported format, or a dialect of a
55
- # supported format (ie. some types of PNG)
56
- UnsupportedImageType = Class.new(StandardError)
57
-
58
- # This error is raised when a named element has alredy been
59
- # created. For example, in the stamp module, stamps must have
60
- # unique names within a document
61
- NameTaken = Class.new(StandardError)
62
-
63
- # This error is raised when a name is not a valid format
64
- InvalidName = Class.new(StandardError)
65
-
66
- # This error is raised when an object is attempted to be
67
- # referenced by name, but no such name is associated with an object
68
- UndefinedObjectName = Class.new(StandardError)
69
-
70
- # This error is raised when a required option has not been set
71
- RequiredOption = Class.new(StandardError)
72
-
73
- # This error is raised when a requested outline item with a given title does not exist
74
- UnknownOutlineTitle = Class.new(StandardError)
75
-
76
- # This error is raised when a block is required, but not provided
77
- BlockRequired = Class.new(StandardError)
78
-
79
- # This error is rased when a graphics method is called with improper arguments
80
- InvalidGraphicsPath = Class.new(StandardError)
81
-
82
- end
83
- end
@@ -1,329 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # font.rb : The Prawn font class
4
- #
5
- # Copyright May 2008, Gregory Brown / James Healy. All Rights Reserved.
6
- #
7
- # This is free software. Please see the LICENSE and COPYING files for details.
8
- require "prawn/font/afm"
9
- require "prawn/font/ttf"
10
- require "prawn/font/dfont"
11
-
12
- module Prawn
13
-
14
- class Document
15
- # Without arguments, this returns the currently selected font. Otherwise,
16
- # it sets the current font. When a block is used, the font is applied
17
- # transactionally and is rolled back when the block exits.
18
- #
19
- # Prawn::Document.generate("font.pdf") do
20
- # text "Default font is Helvetica"
21
- #
22
- # font "Times-Roman"
23
- # text "Now using Times-Roman"
24
- #
25
- # font("Chalkboard.ttf") do
26
- # text "Using TTF font from file Chalkboard.ttf"
27
- # font "Courier", :style => :bold
28
- # text "You see this in bold Courier"
29
- # end
30
- #
31
- # text "Times-Roman, again"
32
- # end
33
- #
34
- # The :name parameter must be a string. It can be one of the 14 built-in
35
- # fonts supported by PDF, or the location of a TTF file. The Font::AFM::BUILT_INS
36
- # array specifies the valid built in font values.
37
- #
38
- # If a ttf font is specified, the glyphs necessary to render your document
39
- # will be embedded in the rendered PDF. This should be your preferred option
40
- # in most cases. It will increase the size of the resulting file, but also
41
- # make it more portable.
42
- #
43
- # The options parameter is an optional hash providing size and style. To use
44
- # the :style option you need to map those font styles to their respective font files.
45
- # See font_families for more information.
46
- #
47
- def font(name=nil, options={})
48
- return((defined?(@font) && @font) || font("Helvetica")) if name.nil?
49
-
50
- raise Errors::NotOnPage if pages.empty? && !page.in_stamp_stream?
51
- new_font = find_font(name, options)
52
-
53
- if block_given?
54
- save_font do
55
- set_font(new_font, options[:size])
56
- yield
57
- end
58
- else
59
- set_font(new_font, options[:size])
60
- end
61
-
62
- @font
63
- end
64
-
65
- # When called with no argument, returns the current font size.
66
- # When called with a single argument but no block, sets the current font
67
- # size. When a block is used, the font size is applied transactionally and
68
- # is rolled back when the block exits. You may still change the font size
69
- # within a transactional block for individual text segments, or nested calls
70
- # to font_size.
71
- #
72
- # Prawn::Document.generate("font_size.pdf") do
73
- # font_size 16
74
- # text "At size 16"
75
- #
76
- # font_size(10) do
77
- # text "At size 10"
78
- # text "At size 6", :size => 6
79
- # text "At size 10"
80
- # end
81
- #
82
- # text "At size 16"
83
- # end
84
- #
85
- # When called without an argument, this method returns the current font
86
- # size.
87
- #
88
- def font_size(points=nil)
89
- return @font_size unless points
90
- size_before_yield = @font_size
91
- @font_size = points
92
- block_given? ? yield : return
93
- @font_size = size_before_yield
94
- end
95
-
96
- # Sets the font directly, given an actual Font object
97
- # and size.
98
- #
99
- def set_font(font, size=nil) # :nodoc:
100
- @font = font
101
- @font_size = size if size
102
- end
103
-
104
- # Saves the current font, and then yields. When the block
105
- # finishes, the original font is restored.
106
- #
107
- def save_font
108
- @font ||= find_font("Helvetica")
109
- original_font = @font
110
- original_size = @font_size
111
-
112
- yield
113
- ensure
114
- set_font(original_font, original_size) if original_font
115
- end
116
-
117
- # Looks up the given font using the given criteria. Once a font has been
118
- # found by that matches the criteria, it will be cached to subsequent lookups
119
- # for that font will return the same object.
120
- #--
121
- # Challenges involved: the name alone is not sufficient to uniquely identify
122
- # a font (think dfont suitcases that can hold multiple different fonts in a
123
- # single file). Thus, the :name key is included in the cache key.
124
- #
125
- # It is further complicated, however, since fonts in some formats (like the
126
- # dfont suitcases) can be identified either by numeric index, OR by their
127
- # name within the suitcase, and both should hash to the same font object
128
- # (to avoid the font being embedded multiple times). This is not yet implemented,
129
- # which means if someone selects a font both by name, and by index, the
130
- # font will be embedded twice. Since we do font subsetting, this double
131
- # embedding won't be catastrophic, just annoying.
132
- # ++
133
- def find_font(name, options={}) #:nodoc:
134
- if font_families.key?(name)
135
- family, name = name, font_families[name][options[:style] || :normal]
136
- if name.is_a?(Hash)
137
- options = options.merge(name)
138
- name = options[:file]
139
- end
140
- end
141
- key = "#{name}:#{options[:font] || 0}"
142
- font_registry[key] ||= Font.load(self, name, options.merge(:family => family))
143
- end
144
-
145
- # Hash of Font objects keyed by names
146
- #
147
- def font_registry #:nodoc:
148
- @font_registry ||= {}
149
- end
150
-
151
- # Hash that maps font family names to their styled individual font names.
152
- #
153
- # To add support for another font family, append to this hash, e.g:
154
- #
155
- # pdf.font_families.update(
156
- # "MyTrueTypeFamily" => { :bold => "foo-bold.ttf",
157
- # :italic => "foo-italic.ttf",
158
- # :bold_italic => "foo-bold-italic.ttf",
159
- # :normal => "foo.ttf" })
160
- #
161
- # This will then allow you to use the fonts like so:
162
- #
163
- # pdf.font("MyTrueTypeFamily", :style => :bold)
164
- # pdf.text "Some bold text"
165
- # pdf.font("MyTrueTypeFamily")
166
- # pdf.text "Some normal text"
167
- #
168
- # This assumes that you have appropriate TTF fonts for each style you
169
- # wish to support.
170
- #
171
- # By default the styles :bold, :italic, :bold_italic, and :normal are
172
- # defined for fonts "Courier", "Times-Roman" and "Helvetica".
173
- #
174
- # You probably want to provide those four styles, but are free to define
175
- # custom ones, like :thin, and use them in font calls.
176
- #
177
- def font_families
178
- @font_families ||= Hash.new { |h,k| h[k] = {} }.merge!(
179
- { "Courier" => { :bold => "Courier-Bold",
180
- :italic => "Courier-Oblique",
181
- :bold_italic => "Courier-BoldOblique",
182
- :normal => "Courier" },
183
-
184
- "Times-Roman" => { :bold => "Times-Bold",
185
- :italic => "Times-Italic",
186
- :bold_italic => "Times-BoldItalic",
187
- :normal => "Times-Roman" },
188
-
189
- "Helvetica" => { :bold => "Helvetica-Bold",
190
- :italic => "Helvetica-Oblique",
191
- :bold_italic => "Helvetica-BoldOblique",
192
- :normal => "Helvetica" }
193
- })
194
- end
195
-
196
- # Returns the width of the given string using the given font. If :size is not
197
- # specified as one of the options, the string is measured using the current
198
- # font size. You can also pass :kerning as an option to indicate whether
199
- # kerning should be used when measuring the width (defaults to +false+).
200
- #
201
- # Note that the string _must_ be encoded properly for the font being used.
202
- # For AFM fonts, this is WinAnsi. For TTF, make sure the font is encoded as
203
- # UTF-8. You can use the Font#normalize_encoding method to make sure strings
204
- # are in an encoding appropriate for the current font.
205
- #--
206
- # For the record, this method used to be a method of Font (and still delegates
207
- # to width computations on Font). However, having the primary interface for
208
- # calculating string widths exist on Font made it tricky to write extensions
209
- # for Prawn in which widths are computed differently (e.g., taking formatting
210
- # tags into account, or the like).
211
- #
212
- # By putting width_of here, on Document itself, extensions may easily override
213
- # it and redefine the width calculation behavior.
214
- #++
215
- def width_of(string, options={})
216
- font.compute_width_of(string, options)
217
- end
218
- end
219
-
220
- # Provides font information and helper functions.
221
- #
222
- class Font
223
-
224
- # The current font name
225
- attr_reader :name
226
-
227
- # The current font family
228
- attr_reader :family
229
-
230
- # The options hash used to initialize the font
231
- attr_reader :options
232
-
233
- # Shortcut interface for constructing a font object. Filenames of the form
234
- # *.ttf will call Font::TTF.new, *.dfont Font::DFont.new, and anything else
235
- # will be passed through to Font::AFM.new()
236
- #
237
- def self.load(document,name,options={})
238
- case name
239
- when /\.ttf$/ then TTF.new(document, name, options)
240
- when /\.dfont$/ then DFont.new(document, name, options)
241
- when /\.afm$/ then AFM.new(document, name, options)
242
- else AFM.new(document, name, options)
243
- end
244
- end
245
-
246
- def initialize(document,name,options={}) #:nodoc:
247
- @document = document
248
- @name = name
249
- @options = options
250
-
251
- @family = options[:family]
252
-
253
- @identifier = :"F#{@document.font_registry.size + 1}"
254
-
255
- @references = {}
256
- end
257
-
258
- # The size of the font ascender in PDF points
259
- #
260
- def ascender
261
- @ascender / 1000.0 * size
262
- end
263
-
264
- # The size of the font descender in PDF points
265
- #
266
- def descender
267
- -@descender / 1000.0 * size
268
- end
269
-
270
- # The size of the recommended gap between lines of text in PDF points
271
- #
272
- def line_gap
273
- @line_gap / 1000.0 * size
274
- end
275
-
276
- # Normalizes the encoding of the string to an encoding supported by the
277
- # font. The string is expected to be UTF-8 going in. It will be re-encoded
278
- # and the new string will be returned. For an in-place (destructive)
279
- # version, see normalize_encoding!.
280
- def normalize_encoding(string)
281
- raise NotImplementedError, "subclasses of Prawn::Font must implement #normalize_encoding"
282
- end
283
-
284
- # Destructive version of normalize_encoding; normalizes the encoding of a
285
- # string in place.
286
- #
287
- def normalize_encoding!(str)
288
- str.replace(normalize_encoding(str))
289
- end
290
-
291
- # Gets height of current font in PDF points at the given font size
292
- #
293
- def height_at(size)
294
- @normalized_height ||= (@ascender - @descender + @line_gap) / 1000.0
295
- @normalized_height * size
296
- end
297
-
298
- # Gets height of current font in PDF points at current font size
299
- #
300
- def height
301
- height_at(size)
302
- end
303
-
304
- # Registers the given subset of the current font with the current PDF
305
- # page. This is safe to call multiple times for a given font and subset,
306
- # as it will only add the font the first time it is called.
307
- #
308
- def add_to_current_page(subset)
309
- @references[subset] ||= register(subset)
310
- @document.page.fonts.merge!(identifier_for(subset) => @references[subset])
311
- end
312
-
313
- def identifier_for(subset) #:nodoc:
314
- "#{@identifier}.#{subset}"
315
- end
316
-
317
- def inspect #:nodoc:
318
- "#{self.class.name}< #{name}: #{size} >"
319
- end
320
-
321
- private
322
-
323
- def size
324
- @document.font_size
325
- end
326
-
327
- end
328
-
329
- end