prawn 0.4.1 → 0.5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. data/lib/prawn.rb +2 -72
  2. metadata +33 -224
  3. data/COPYING +0 -340
  4. data/LICENSE +0 -56
  5. data/README +0 -40
  6. data/Rakefile +0 -79
  7. data/data/encodings/win_ansi.txt +0 -29
  8. data/data/fonts/Action Man.dfont +0 -0
  9. data/data/fonts/Activa.ttf +0 -0
  10. data/data/fonts/Chalkboard.ttf +0 -0
  11. data/data/fonts/Courier-Bold.afm +0 -342
  12. data/data/fonts/Courier-BoldOblique.afm +0 -342
  13. data/data/fonts/Courier-Oblique.afm +0 -342
  14. data/data/fonts/Courier.afm +0 -342
  15. data/data/fonts/DejaVuSans.ttf +0 -0
  16. data/data/fonts/Dustismo_Roman.ttf +0 -0
  17. data/data/fonts/Helvetica-Bold.afm +0 -2827
  18. data/data/fonts/Helvetica-BoldOblique.afm +0 -2827
  19. data/data/fonts/Helvetica-Oblique.afm +0 -3051
  20. data/data/fonts/Helvetica.afm +0 -3051
  21. data/data/fonts/MustRead.html +0 -19
  22. data/data/fonts/Symbol.afm +0 -213
  23. data/data/fonts/Times-Bold.afm +0 -2588
  24. data/data/fonts/Times-BoldItalic.afm +0 -2384
  25. data/data/fonts/Times-Italic.afm +0 -2667
  26. data/data/fonts/Times-Roman.afm +0 -2419
  27. data/data/fonts/ZapfDingbats.afm +0 -225
  28. data/data/fonts/comicsans.ttf +0 -0
  29. data/data/fonts/gkai00mp.ttf +0 -0
  30. data/data/images/arrow.png +0 -0
  31. data/data/images/arrow2.png +0 -0
  32. data/data/images/barcode_issue.png +0 -0
  33. data/data/images/dice.alpha +0 -0
  34. data/data/images/dice.dat +0 -0
  35. data/data/images/dice.png +0 -0
  36. data/data/images/fractal.jpg +0 -0
  37. data/data/images/letterhead.jpg +0 -0
  38. data/data/images/page_white_text.alpha +0 -0
  39. data/data/images/page_white_text.dat +0 -0
  40. data/data/images/page_white_text.png +0 -0
  41. data/data/images/pigs.jpg +0 -0
  42. data/data/images/rails.dat +0 -0
  43. data/data/images/rails.png +0 -0
  44. data/data/images/ruport.png +0 -0
  45. data/data/images/ruport_data.dat +0 -0
  46. data/data/images/ruport_transparent.png +0 -0
  47. data/data/images/ruport_type0.png +0 -0
  48. data/data/images/stef.jpg +0 -0
  49. data/data/images/web-links.dat +0 -1
  50. data/data/images/web-links.png +0 -0
  51. data/data/shift_jis_text.txt +0 -1
  52. data/examples/bounding_box/bounding_boxes.rb +0 -44
  53. data/examples/bounding_box/lazy_bounding_boxes.rb +0 -28
  54. data/examples/bounding_box/padded_box.rb +0 -24
  55. data/examples/bounding_box/russian_boxes.rb +0 -37
  56. data/examples/general/background.rb +0 -20
  57. data/examples/general/canvas.rb +0 -16
  58. data/examples/general/measurement_units.rb +0 -52
  59. data/examples/general/multi_page_layout.rb +0 -17
  60. data/examples/general/page_geometry.rb +0 -32
  61. data/examples/graphics/basic_images.rb +0 -27
  62. data/examples/graphics/cmyk.rb +0 -13
  63. data/examples/graphics/curves.rb +0 -12
  64. data/examples/graphics/hexagon.rb +0 -14
  65. data/examples/graphics/image_fit.rb +0 -16
  66. data/examples/graphics/image_flow.rb +0 -38
  67. data/examples/graphics/image_position.rb +0 -18
  68. data/examples/graphics/line.rb +0 -33
  69. data/examples/graphics/png_types.rb +0 -23
  70. data/examples/graphics/polygons.rb +0 -17
  71. data/examples/graphics/remote_images.rb +0 -12
  72. data/examples/graphics/ruport_style_helpers.rb +0 -20
  73. data/examples/graphics/stroke_bounds.rb +0 -23
  74. data/examples/m17n/chinese_text_wrapping.rb +0 -20
  75. data/examples/m17n/euro.rb +0 -16
  76. data/examples/m17n/sjis.rb +0 -29
  77. data/examples/m17n/utf8.rb +0 -14
  78. data/examples/m17n/win_ansi_charset.rb +0 -55
  79. data/examples/text/alignment.rb +0 -19
  80. data/examples/text/dfont.rb +0 -49
  81. data/examples/text/family_based_styling.rb +0 -25
  82. data/examples/text/flowing_text_with_header_and_footer.rb +0 -37
  83. data/examples/text/font_calculations.rb +0 -92
  84. data/examples/text/font_size.rb +0 -34
  85. data/examples/text/kerning.rb +0 -31
  86. data/examples/text/simple_text.rb +0 -18
  87. data/examples/text/simple_text_ttf.rb +0 -18
  88. data/examples/text/span.rb +0 -30
  89. data/examples/text/text_box.rb +0 -26
  90. data/examples/text/text_flow.rb +0 -68
  91. data/lib/prawn/compatibility.rb +0 -38
  92. data/lib/prawn/document.rb +0 -309
  93. data/lib/prawn/document/annotations.rb +0 -63
  94. data/lib/prawn/document/bounding_box.rb +0 -368
  95. data/lib/prawn/document/destinations.rb +0 -81
  96. data/lib/prawn/document/internals.rb +0 -126
  97. data/lib/prawn/document/page_geometry.rb +0 -79
  98. data/lib/prawn/document/span.rb +0 -55
  99. data/lib/prawn/document/text.rb +0 -185
  100. data/lib/prawn/document/text/box.rb +0 -76
  101. data/lib/prawn/document/text/wrapping.rb +0 -59
  102. data/lib/prawn/encoding.rb +0 -121
  103. data/lib/prawn/errors.rb +0 -40
  104. data/lib/prawn/font.rb +0 -277
  105. data/lib/prawn/font/afm.rb +0 -202
  106. data/lib/prawn/font/dfont.rb +0 -31
  107. data/lib/prawn/font/ttf.rb +0 -326
  108. data/lib/prawn/graphics.rb +0 -257
  109. data/lib/prawn/graphics/color.rb +0 -140
  110. data/lib/prawn/images.rb +0 -339
  111. data/lib/prawn/images/jpg.rb +0 -45
  112. data/lib/prawn/images/png.rb +0 -199
  113. data/lib/prawn/literal_string.rb +0 -14
  114. data/lib/prawn/measurement_extensions.rb +0 -46
  115. data/lib/prawn/measurements.rb +0 -71
  116. data/lib/prawn/name_tree.rb +0 -165
  117. data/lib/prawn/pdf_object.rb +0 -73
  118. data/lib/prawn/reference.rb +0 -59
  119. data/spec/annotations_spec.rb +0 -90
  120. data/spec/bounding_box_spec.rb +0 -141
  121. data/spec/destinations_spec.rb +0 -15
  122. data/spec/document_spec.rb +0 -193
  123. data/spec/font_spec.rb +0 -234
  124. data/spec/graphics_spec.rb +0 -209
  125. data/spec/images_spec.rb +0 -68
  126. data/spec/jpg_spec.rb +0 -25
  127. data/spec/measurement_units_spec.rb +0 -23
  128. data/spec/name_tree_spec.rb +0 -103
  129. data/spec/pdf_object_spec.rb +0 -112
  130. data/spec/png_spec.rb +0 -196
  131. data/spec/reference_spec.rb +0 -42
  132. data/spec/spec_helper.rb +0 -23
  133. data/spec/text_spec.rb +0 -178
  134. data/vendor/pdf-inspector/README +0 -18
  135. data/vendor/pdf-inspector/lib/pdf/inspector.rb +0 -25
  136. data/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +0 -80
  137. data/vendor/pdf-inspector/lib/pdf/inspector/page.rb +0 -16
  138. data/vendor/pdf-inspector/lib/pdf/inspector/text.rb +0 -31
  139. data/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +0 -19
  140. data/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
  141. data/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
  142. data/vendor/ttfunk/example.rb +0 -45
  143. data/vendor/ttfunk/lib/ttfunk.rb +0 -102
  144. data/vendor/ttfunk/lib/ttfunk/directory.rb +0 -17
  145. data/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +0 -88
  146. data/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +0 -69
  147. data/vendor/ttfunk/lib/ttfunk/reader.rb +0 -44
  148. data/vendor/ttfunk/lib/ttfunk/resource_file.rb +0 -78
  149. data/vendor/ttfunk/lib/ttfunk/subset.rb +0 -18
  150. data/vendor/ttfunk/lib/ttfunk/subset/base.rb +0 -141
  151. data/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +0 -46
  152. data/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +0 -48
  153. data/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +0 -63
  154. data/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +0 -51
  155. data/vendor/ttfunk/lib/ttfunk/subset_collection.rb +0 -72
  156. data/vendor/ttfunk/lib/ttfunk/table.rb +0 -46
  157. data/vendor/ttfunk/lib/ttfunk/table/cmap.rb +0 -34
  158. data/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +0 -54
  159. data/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +0 -126
  160. data/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +0 -79
  161. data/vendor/ttfunk/lib/ttfunk/table/glyf.rb +0 -64
  162. data/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +0 -81
  163. data/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +0 -37
  164. data/vendor/ttfunk/lib/ttfunk/table/head.rb +0 -44
  165. data/vendor/ttfunk/lib/ttfunk/table/hhea.rb +0 -41
  166. data/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +0 -47
  167. data/vendor/ttfunk/lib/ttfunk/table/kern.rb +0 -79
  168. data/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +0 -62
  169. data/vendor/ttfunk/lib/ttfunk/table/loca.rb +0 -43
  170. data/vendor/ttfunk/lib/ttfunk/table/maxp.rb +0 -40
  171. data/vendor/ttfunk/lib/ttfunk/table/name.rb +0 -119
  172. data/vendor/ttfunk/lib/ttfunk/table/os2.rb +0 -78
  173. data/vendor/ttfunk/lib/ttfunk/table/post.rb +0 -91
  174. data/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +0 -43
  175. data/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +0 -35
  176. data/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +0 -23
  177. data/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +0 -17
  178. data/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +0 -17
  179. data/vendor/ttfunk/lib/ttfunk/table/simple.rb +0 -14
@@ -1,14 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Shows that Prawn works out of the box with UTF-8 text, so long as you use
4
- # a TTF file with the necessary glyphs for your content.
5
- #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
- require "prawn"
8
-
9
- Prawn::Document.generate("utf8.pdf") do
10
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
11
- text "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει." * 20
12
- end
13
-
14
-
@@ -1,55 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Prints a list of all of the glyphs that can be rendered by Adobe's built
4
- # in fonts, along with their character widths and WinAnsi codes. Be sure
5
- # to pass these glyphs as UTF-8, and Prawn will transcode them for you.
6
- #
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
8
- require 'prawn'
9
-
10
- FONT_SIZE = 9.5
11
-
12
- Prawn::Document.generate("win-ansi.pdf") do
13
- @skip_encoding = true
14
-
15
- x = 0
16
- y = bounds.top
17
-
18
- fields = [[20, :right], [8, :left], [12, :center], [30, :right], [8, :left], [0, :left]]
19
-
20
- font "Helvetica", :size => FONT_SIZE
21
-
22
- Prawn::Encoding::WinAnsi::CHARACTERS.each_with_index do |name, index|
23
- next if name == ".notdef"
24
- y -= FONT_SIZE
25
-
26
- if y < FONT_SIZE
27
- y = bounds.top - FONT_SIZE
28
- x += 170
29
- end
30
-
31
- code = "%d." % index
32
- char = index.chr
33
-
34
- width = 1000 * font.width_of(char, :size => FONT_SIZE) / FONT_SIZE
35
- size = "%d" % width
36
-
37
- data = [code, nil, char, size, nil, name]
38
- dx = x
39
- fields.zip(data).each do |(total_width, align), field|
40
- if field
41
- width = font.width_of(field, :size => FONT_SIZE)
42
-
43
- case align
44
- when :left then offset = 0
45
- when :right then offset = total_width - width
46
- when :center then offset = (total_width - width)/2
47
- end
48
-
49
- text(field, :at => [dx + offset, y])
50
- end
51
-
52
- dx += total_width
53
- end
54
- end
55
- end
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # This example demonstrates usage of Document#text with the :align option.
4
- # Available options are :left, :right, and :center, with :left as default.
5
- #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
- require "prawn"
8
-
9
- Prawn::Document.generate("alignment.pdf") do
10
- text "This text should be left aligned"
11
- text "This text should be centered", :align => :center
12
- text "This text should be right aligned", :align => :right
13
-
14
- pad(20) { text "This is Flowing from the left. " * 20 }
15
-
16
- pad(20) { text "This is Flowing from the center. " * 20, :align => :center }
17
-
18
- pad(20) { text "This is Flowing from the right. " * 20, :align => :right }
19
- end
@@ -1,49 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
4
- require "prawn"
5
-
6
- DFONT_FILE = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
7
- puts "There are #{Prawn::Font::DFont.font_count(DFONT_FILE)} fonts in #{DFONT_FILE}:"
8
- Prawn::Font::DFont.named_fonts(DFONT_FILE).each do |name|
9
- puts "* #{name}"
10
- end
11
-
12
- puts
13
- puts "generating sample document in 'dfont.pdf'..."
14
-
15
- Prawn::Document.generate "dfont.pdf" do
16
- fill_color "0000ff"
17
-
18
- font DFONT_FILE, :font => "ActionMan-Bold", :size => 24
19
- text "Introducing Action Man!"
20
-
21
- move_text_position 24
22
-
23
- font_families["Action Man"] = {
24
- :normal => { :file => DFONT_FILE, :font => "ActionMan" },
25
- :bold => { :file => DFONT_FILE, :font => "ActionMan-Bold" },
26
- :italic => { :file => DFONT_FILE, :font => "ActionMan-Italic" },
27
- :bold_italic => { :file => DFONT_FILE, :font => "ActionMan-BoldItalic" }
28
- }
29
-
30
- font "Action Man", :size => 16
31
- text "Action Man is feeling normal here."
32
-
33
- move_text_position 16
34
-
35
- font "Action Man", :style => :bold, :size => 16
36
- text "Action Man is feeling bold here!"
37
-
38
- move_text_position 16
39
-
40
- font "Action Man", :style => :italic, :size => 16
41
- text "Here, we see Action Man feeling italicized. Slick!"
42
-
43
- move_text_position 16
44
-
45
- font "Action Man", :style => :bold_italic, :size => 16
46
- text "Lastly, we observe Mr. Action Man being bold AND italicized. Excellent!"
47
- end
48
-
49
- puts "done"
@@ -1,25 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # This example demonstrates using the :style option for Document#text.
4
- # If you are working with TTF fonts, you'll want to check out the
5
- # documentation for Document#font_families and register your fonts with it.
6
- #
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
8
- require "prawn"
9
-
10
- Prawn::Document.generate("family_style.pdf") do
11
- ["Courier","Helvetica","Times-Roman"].each do |f|
12
- [:bold,:bold_italic,:italic,:normal].each do |s|
13
- font f, :style => s
14
- text "I'm writing in #{f} (#{s})"
15
- end
16
- end
17
-
18
- font "Helvetica"
19
-
20
- text "Normal"
21
- text "Bold", :style => :bold
22
- text "Bold Italic", :style => :bold_italic
23
- text "Italic", :style => :italic
24
- text "Normal"
25
- end
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Multi-faceted example that demonstrates a document flowing between header
4
- # and footer regions. At the moment, headers and footers in Prawn are run
5
- # using the current font settings (among other things), for each page. This
6
- # means that it is important to non-destructively set your desired styling
7
- # within your headers and footers, as shown below.
8
- #
9
- # Future versions of Prawn may make this more convenient somehow.
10
- #
11
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
12
- require "prawn"
13
-
14
- Prawn::Document.generate("flow_with_headers_and_footers.pdf") do
15
-
16
- header margin_box.top_left do
17
- font "Helvetica" do
18
- text "Here's My Fancy Header", :size => 25, :align => :center
19
- stroke_horizontal_rule
20
- end
21
- end
22
-
23
- footer [margin_box.left, margin_box.bottom + 25] do
24
- font "Helvetica" do
25
- stroke_horizontal_rule
26
- text "And here's a sexy footer", :size => 16
27
- end
28
- end
29
-
30
- bounding_box([bounds.left, bounds.top - 50],
31
- :width => bounds.width, :height => bounds.height - 100) do
32
- text "this is some flowing text " * 200
33
-
34
-
35
- end
36
-
37
- end
@@ -1,92 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # This example is a demonstration of how Prawn does its text positioning,
4
- # meant to assist those that need to do advanced positioning calculations.
5
- # Run the example for a clearer picture of how things work
6
- #
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
8
- require 'prawn'
9
-
10
- Prawn::Document.generate('font_calculations.pdf') do
11
-
12
- def demonstration
13
- font_size 12
14
- move_down 10
15
-
16
- stroke_horizontal_rule
17
-
18
- text "When using flowing text, Prawn will position text\n" +
19
- "starting font.ascender below the baseline, and leave\n" +
20
- "the y-cursor at the baseline of the next line of text"
21
-
22
- stroke_horizontal_rule
23
-
24
- move_down 20
25
-
26
- bl = y - bounds.absolute_bottom
27
-
28
- stroke_horizontal_rule
29
- text "When using text positioned with :at, the baseline is used", :at => [0, bl]
30
-
31
- text "(and the Y-cursor is not moved)", :at => [350, bl]
32
-
33
- colors = { :ascender => "ff0000",
34
- :descender => "00ff00",
35
- :line_gap => "0000ff",
36
- :font_height => "005500" }
37
-
38
-
39
- pad(20) do
40
- text "Calculations Demo", :size => 16
41
- end
42
-
43
- fill_color colors[:ascender]
44
- text "ASCENDER"
45
-
46
- fill_color colors[:descender]
47
- text "DESCENDER"
48
-
49
- fill_color colors[:line_gap]
50
- text "LINEGAP"
51
-
52
- fill_color colors[:font_height]
53
- text "FONT_HEIGHT"
54
-
55
- fill_color "000000"
56
- font_size 16
57
-
58
- move_down 40
59
-
60
- bl = y - bounds.absolute_bottom
61
- text "The quick brown fox jumps over the lazy dog.", :at => [0, bl]
62
-
63
- stroke_color colors[:ascender]
64
- stroke_line [0, bl], [0, bl + font.ascender]
65
- stroke_line [0, bl + font.ascender], [bounds.width, bl + font.ascender]
66
-
67
- stroke_color colors[:descender]
68
- stroke_line [0,bl], [0, bl + font.descender]
69
- stroke_line [0, bl + font.descender], [bounds.width, bl + font.descender]
70
-
71
- stroke_color colors[:line_gap]
72
- stroke_line [0, bl + font.descender], [0,bl + font.descender - font.line_gap]
73
- stroke_line [0, bl + font.descender - font.line_gap],
74
- [bounds.width,bl + font.descender - font.line_gap]
75
-
76
- stroke_color colors[:font_height]
77
- stroke_line [bounds.width, bl + font.ascender],
78
- [bounds.width, bl + font.descender - font.line_gap]
79
-
80
- stroke_color "000000"
81
- fill_color "000000"
82
- end
83
-
84
- text "Using AFM", :size => 20
85
- demonstration
86
-
87
- move_down 75
88
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
89
- text "Using TTF", :size => 20
90
- demonstration
91
-
92
- end
@@ -1,34 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # This example shows the many ways of setting font sizes in Prawn
4
- #
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
6
- require "prawn"
7
-
8
- Prawn::Document.generate "font_size.pdf", :page_size => "A4" do
9
-
10
- # Explicit global changes
11
- font 'Helvetica'
12
- self.font_size = 16
13
-
14
- text 'Font at 16 point'
15
-
16
- # Transactional changes rolled back after block exit
17
- font_size 9 do
18
- text 'Font at 9 point'
19
- # single line changes, not persisted.
20
- text 'Font at manual override 20 point', :size => 20
21
- text 'Font at 9 point'
22
- end
23
-
24
- # Transactional changes rolled back after block exit on full fonts.
25
- font("Times-Roman", :style => :italic, :size => 12) do
26
- text "Font in times at 12"
27
- font_size(16) { text "Font in Times at 16" }
28
- end
29
-
30
- text 'Font at 16 point'
31
-
32
- font "Courier", :size => 40
33
- text "40 pt!"
34
- end
@@ -1,31 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Demonstration of enabling and disabling kerning support
4
- #
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
6
- require "prawn"
7
-
8
- Prawn::Document.generate "kerning.pdf" do
9
- text "To kern?", :at => [200,720], :size => 24, :kerning => true
10
- text "To not kern?", :at => [200,690], :size => 24, :kerning => false
11
-
12
- move_down 100
13
-
14
- pad(30) do
15
- text "To kern and wrap. " * 5, :size => 24, :kerning => true
16
- end
17
-
18
- text "To not kern and wrap. " * 5, :size => 24, :kerning => false
19
-
20
- font "#{Prawn::BASEDIR}/data/fonts/Dustismo_Roman.ttf"
21
-
22
- text "To kern?", :at => [200,660], :size => 24, :kerning => true
23
- text "To not kern?", :at => [200,630], :size => 24, :kerning => false
24
-
25
- pad(30) do
26
- text "To kern and wrap. " * 5, :size => 24, :kerning => true
27
- end
28
-
29
- text "To not kern and wrap. " * 5, :size => 24, :kerning => false
30
-
31
- end
@@ -1,18 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # An early example of basic text generation at absolute positions.
4
- # Mostly kept for nostalgia.
5
- #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
- require "prawn"
8
-
9
- Prawn::Document.generate "simple_text.pdf" do
10
- fill_color "0000ff"
11
- text "Hello World", :at => [200,420], :size => 32, :rotate => 45
12
- font "Times-Roman"
13
- fill_color "ff0000"
14
- text "Using Another Font", :at => [5,5]
15
- start_new_page
16
- font "Courier"
17
- text "Goodbye World", :at => [288,50]
18
- end
@@ -1,18 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # An early example of TTF font embedding. Mostly kept for nostalgia's sake.
4
- #
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
6
- require "prawn"
7
-
8
- Prawn::Document.generate "simple_text_ttf.pdf" do
9
- fill_color "0000ff"
10
- font "#{Prawn::BASEDIR}/data/fonts/comicsans.ttf"
11
- text "Hello World", :at => [200,720], :size => 32
12
-
13
- font "#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf"
14
-
15
- pad(20) do
16
- text "This is chalkboard wrapping " * 20
17
- end
18
- end
@@ -1,30 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Demonstration of Document#span, which is used for generating flowing
4
- # columns of text.
5
- #
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
- require "prawn"
8
-
9
- Prawn::Document.generate("span.pdf") do
10
-
11
- # Spans will typically be used outside of bounding boxes as a way to build
12
- # single columns of flowing text that span across pages.
13
- #
14
- span(350, :position => :center) do
15
- text "Here's some centered text in a 350 point column. " * 100
16
- end
17
-
18
- # Spans are not really compatible with bounding boxes because they break
19
- # the nesting chain and also may position text outside of the bounding box
20
- # boundaries, but sometimes you may wish to use them anyway for convenience
21
- # Here's an example of how to do that dynamically.
22
- #
23
- bounding_box([50,300], :width => 400) do
24
- text "Here's some default bounding box text. " * 10
25
- span(bounds.width,
26
- :position => bounds.absolute_left - margin_box.absolute_left) do
27
- text "The rain in spain falls mainly on the plains. " * 300
28
- end
29
- end
30
- end
@@ -1,26 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # A text box is positioned by a top-left corner, width, and height and is
4
- # essentially an invisible rectangle that the text wil lflow within. If the
5
- # text exceeds the boundaries, it is either truncated, replaced with some
6
- # ellipses, or set to expand beyond the bottom boundary.
7
- #
8
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
9
- require 'prawn'
10
-
11
- Prawn::Document.generate("text_box.pdf") do
12
-
13
- text_box "Oh hai text box. " * 200,
14
- :width => 300, :height => font.height * 5,
15
- :overflow => :ellipses,
16
- :at => [100,bounds.top]
17
-
18
- text_box "Oh hai text box. " * 200,
19
- :width => 250, :height => font.height * 10,
20
- :overflow => :truncate,
21
- :at => [50, 300]
22
-
23
- move_down 20
24
-
25
- text_box "Oh hai text box. " * 100, :overflow => :expand
26
- end