prawn 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/GPLv2 +20 -21
  5. data/Gemfile +2 -0
  6. data/Rakefile +10 -3
  7. data/lib/prawn.rb +9 -3
  8. data/lib/prawn/document.rb +40 -18
  9. data/lib/prawn/document/bounding_box.rb +9 -4
  10. data/lib/prawn/document/column_box.rb +2 -0
  11. data/lib/prawn/document/internals.rb +6 -4
  12. data/lib/prawn/document/span.rb +2 -0
  13. data/lib/prawn/encoding.rb +4 -1
  14. data/lib/prawn/errors.rb +2 -0
  15. data/lib/prawn/font.rb +34 -17
  16. data/lib/prawn/font_metric_cache.rb +8 -3
  17. data/lib/prawn/{font → fonts}/afm.rb +14 -7
  18. data/lib/prawn/{font → fonts}/dfont.rb +3 -1
  19. data/lib/prawn/fonts/otf.rb +11 -0
  20. data/lib/prawn/{font → fonts}/ttc.rb +3 -1
  21. data/lib/prawn/{font → fonts}/ttf.rb +23 -12
  22. data/lib/prawn/graphics.rb +24 -26
  23. data/lib/prawn/graphics/blend_mode.rb +2 -0
  24. data/lib/prawn/graphics/cap_style.rb +2 -0
  25. data/lib/prawn/graphics/color.rb +8 -3
  26. data/lib/prawn/graphics/dash.rb +3 -1
  27. data/lib/prawn/graphics/join_style.rb +2 -0
  28. data/lib/prawn/graphics/patterns.rb +7 -2
  29. data/lib/prawn/graphics/transformation.rb +5 -1
  30. data/lib/prawn/graphics/transparency.rb +2 -0
  31. data/lib/prawn/grid.rb +39 -38
  32. data/lib/prawn/image_handler.rb +2 -0
  33. data/lib/prawn/images.rb +21 -19
  34. data/lib/prawn/images/image.rb +2 -0
  35. data/lib/prawn/images/jpg.rb +2 -0
  36. data/lib/prawn/images/png.rb +9 -9
  37. data/lib/prawn/measurement_extensions.rb +2 -0
  38. data/lib/prawn/measurements.rb +5 -0
  39. data/lib/prawn/outline.rb +2 -0
  40. data/lib/prawn/repeater.rb +2 -0
  41. data/lib/prawn/security.rb +26 -24
  42. data/lib/prawn/security/arcfour.rb +2 -0
  43. data/lib/prawn/soft_mask.rb +3 -1
  44. data/lib/prawn/stamp.rb +4 -1
  45. data/lib/prawn/text.rb +14 -12
  46. data/lib/prawn/text/box.rb +3 -1
  47. data/lib/prawn/text/formatted.rb +2 -0
  48. data/lib/prawn/text/formatted/arranger.rb +12 -12
  49. data/lib/prawn/text/formatted/box.rb +23 -13
  50. data/lib/prawn/text/formatted/fragment.rb +2 -0
  51. data/lib/prawn/text/formatted/line_wrap.rb +10 -8
  52. data/lib/prawn/text/formatted/parser.rb +8 -10
  53. data/lib/prawn/text/formatted/wrap.rb +4 -2
  54. data/lib/prawn/transformation_stack.rb +5 -2
  55. data/lib/prawn/utilities.rb +2 -2
  56. data/lib/prawn/version.rb +3 -1
  57. data/lib/prawn/view.rb +15 -7
  58. data/manual/basic_concepts/adding_pages.rb +2 -0
  59. data/manual/basic_concepts/basic_concepts.rb +4 -2
  60. data/manual/basic_concepts/creation.rb +2 -0
  61. data/manual/basic_concepts/cursor.rb +2 -0
  62. data/manual/basic_concepts/measurement.rb +3 -1
  63. data/manual/basic_concepts/origin.rb +2 -0
  64. data/manual/basic_concepts/other_cursor_helpers.rb +2 -0
  65. data/manual/basic_concepts/view.rb +2 -0
  66. data/manual/bounding_box/bounding_box.rb +4 -2
  67. data/manual/bounding_box/bounds.rb +6 -4
  68. data/manual/bounding_box/canvas.rb +2 -0
  69. data/manual/bounding_box/creation.rb +2 -0
  70. data/manual/bounding_box/indentation.rb +2 -0
  71. data/manual/bounding_box/nesting.rb +2 -0
  72. data/manual/bounding_box/russian_boxes.rb +6 -4
  73. data/manual/bounding_box/stretchy.rb +2 -0
  74. data/manual/contents.rb +2 -0
  75. data/manual/cover.rb +10 -7
  76. data/manual/document_and_page_options/background.rb +2 -0
  77. data/manual/document_and_page_options/document_and_page_options.rb +4 -2
  78. data/manual/document_and_page_options/metadata.rb +2 -0
  79. data/manual/document_and_page_options/page_margins.rb +2 -0
  80. data/manual/document_and_page_options/page_size.rb +2 -0
  81. data/manual/document_and_page_options/print_scaling.rb +2 -0
  82. data/manual/example_helper.rb +5 -2
  83. data/manual/graphics/blend_mode.rb +6 -4
  84. data/manual/graphics/circle_and_ellipse.rb +2 -0
  85. data/manual/graphics/color.rb +2 -0
  86. data/manual/graphics/common_lines.rb +2 -0
  87. data/manual/graphics/fill_and_stroke.rb +2 -0
  88. data/manual/graphics/fill_rules.rb +2 -0
  89. data/manual/graphics/gradients.rb +2 -0
  90. data/manual/graphics/graphics.rb +4 -2
  91. data/manual/graphics/helper.rb +2 -0
  92. data/manual/graphics/line_width.rb +3 -0
  93. data/manual/graphics/lines_and_curves.rb +2 -0
  94. data/manual/graphics/polygon.rb +2 -0
  95. data/manual/graphics/rectangle.rb +2 -0
  96. data/manual/graphics/rotate.rb +2 -0
  97. data/manual/graphics/scale.rb +2 -0
  98. data/manual/graphics/soft_masks.rb +2 -0
  99. data/manual/graphics/stroke_cap.rb +3 -1
  100. data/manual/graphics/stroke_dash.rb +2 -0
  101. data/manual/graphics/stroke_join.rb +3 -1
  102. data/manual/graphics/translate.rb +2 -0
  103. data/manual/graphics/transparency.rb +2 -0
  104. data/manual/how_to_read_this_manual.rb +2 -0
  105. data/manual/images/absolute_position.rb +2 -0
  106. data/manual/images/fit.rb +2 -0
  107. data/manual/images/horizontal.rb +3 -1
  108. data/manual/images/images.rb +4 -2
  109. data/manual/images/plain_image.rb +2 -0
  110. data/manual/images/scale.rb +2 -0
  111. data/manual/images/vertical.rb +3 -1
  112. data/manual/images/width_and_height.rb +2 -0
  113. data/manual/layout/boxes.rb +2 -0
  114. data/manual/layout/content.rb +2 -0
  115. data/manual/layout/layout.rb +4 -2
  116. data/manual/layout/simple_grid.rb +2 -0
  117. data/manual/outline/add_subsection_to.rb +2 -0
  118. data/manual/outline/insert_section_after.rb +2 -0
  119. data/manual/outline/outline.rb +4 -2
  120. data/manual/outline/sections_and_pages.rb +2 -0
  121. data/manual/repeatable_content/alternate_page_numbering.rb +2 -0
  122. data/manual/repeatable_content/page_numbering.rb +2 -0
  123. data/manual/repeatable_content/repeatable_content.rb +4 -2
  124. data/manual/repeatable_content/repeater.rb +2 -0
  125. data/manual/repeatable_content/stamp.rb +2 -0
  126. data/manual/security/encryption.rb +2 -0
  127. data/manual/security/permissions.rb +2 -0
  128. data/manual/security/security.rb +4 -2
  129. data/manual/table.rb +2 -0
  130. data/manual/text/alignment.rb +2 -0
  131. data/manual/text/color.rb +2 -0
  132. data/manual/text/column_box.rb +4 -2
  133. data/manual/text/fallback_fonts.rb +4 -2
  134. data/manual/text/font.rb +2 -0
  135. data/manual/text/font_size.rb +2 -0
  136. data/manual/text/font_style.rb +4 -2
  137. data/manual/text/formatted_callbacks.rb +2 -0
  138. data/manual/text/formatted_text.rb +3 -1
  139. data/manual/text/free_flowing_text.rb +2 -0
  140. data/manual/text/inline.rb +2 -0
  141. data/manual/text/kerning_and_character_spacing.rb +2 -0
  142. data/manual/text/leading.rb +2 -0
  143. data/manual/text/line_wrapping.rb +4 -1
  144. data/manual/text/paragraph_indentation.rb +2 -0
  145. data/manual/text/positioned_text.rb +2 -0
  146. data/manual/text/registering_families.rb +4 -2
  147. data/manual/text/rendering_and_color.rb +2 -0
  148. data/manual/text/right_to_left_text.rb +2 -0
  149. data/manual/text/rotation.rb +3 -1
  150. data/manual/text/single_usage.rb +2 -0
  151. data/manual/text/text.rb +4 -3
  152. data/manual/text/text_box_excess.rb +2 -0
  153. data/manual/text/text_box_extensions.rb +2 -0
  154. data/manual/text/text_box_overflow.rb +3 -1
  155. data/manual/text/utf8.rb +3 -1
  156. data/manual/text/win_ansi_charset.rb +6 -3
  157. data/prawn.gemspec +14 -11
  158. data/spec/extensions/encoding_helpers.rb +4 -2
  159. data/spec/prawn/document/bounding_box_spec.rb +8 -8
  160. data/spec/prawn/document/column_box_spec.rb +2 -0
  161. data/spec/prawn/document/security_spec.rb +12 -9
  162. data/spec/prawn/document_annotations_spec.rb +2 -0
  163. data/spec/prawn/document_destinations_spec.rb +2 -0
  164. data/spec/prawn/document_grid_spec.rb +3 -0
  165. data/spec/prawn/document_reference_spec.rb +2 -0
  166. data/spec/prawn/document_span_spec.rb +2 -0
  167. data/spec/prawn/document_spec.rb +59 -14
  168. data/spec/prawn/font_metric_cache_spec.rb +2 -0
  169. data/spec/prawn/font_spec.rb +45 -16
  170. data/spec/prawn/graphics/blend_mode_spec.rb +4 -2
  171. data/spec/prawn/graphics/transparency_spec.rb +2 -0
  172. data/spec/prawn/graphics_spec.rb +40 -20
  173. data/spec/prawn/graphics_stroke_styles_spec.rb +2 -0
  174. data/spec/prawn/image_handler_spec.rb +2 -0
  175. data/spec/prawn/images/jpg_spec.rb +2 -0
  176. data/spec/prawn/images/png_spec.rb +2 -0
  177. data/spec/prawn/images_spec.rb +56 -2
  178. data/spec/prawn/measurements_extensions_spec.rb +2 -0
  179. data/spec/prawn/outline_spec.rb +6 -2
  180. data/spec/prawn/repeater_spec.rb +6 -4
  181. data/spec/prawn/soft_mask_spec.rb +2 -0
  182. data/spec/prawn/stamp_spec.rb +11 -7
  183. data/spec/prawn/text/box_spec.rb +26 -27
  184. data/spec/prawn/text/formatted/arranger_spec.rb +30 -28
  185. data/spec/prawn/text/formatted/box_spec.rb +78 -57
  186. data/spec/prawn/text/formatted/fragment_spec.rb +10 -8
  187. data/spec/prawn/text/formatted/line_wrap_spec.rb +8 -5
  188. data/spec/prawn/text/formatted/parser_spec.rb +32 -2
  189. data/spec/prawn/text_draw_text_spec.rb +5 -3
  190. data/spec/prawn/text_rendering_mode_spec.rb +7 -1
  191. data/spec/prawn/text_spacing_spec.rb +6 -4
  192. data/spec/prawn/text_spec.rb +9 -7
  193. data/spec/prawn/text_with_inline_formatting_spec.rb +3 -1
  194. data/spec/prawn/transformation_stack_spec.rb +2 -0
  195. data/spec/prawn/view_spec.rb +18 -0
  196. data/spec/{manual_spec.rb → prawn_manual_spec.rb} +6 -4
  197. data/spec/spec_helper.rb +9 -10
  198. metadata +86 -73
  199. metadata.gz.sig +4 -2
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>line_width=</code> method sets the stroke width for subsequent
2
4
  # stroke calls.
3
5
  #
@@ -31,3 +33,4 @@ Prawn::ManualBuilder::Example.generate(filename) do
31
33
  y -= 100
32
34
  end
33
35
  end
36
+ # rubocop: enable Lint/UselessAssignment
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Prawn supports drawing both lines and curves starting either at the current
2
4
  # position, or from a specified starting position.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Drawing polygons in Prawn is easy, just pass a sequence of points to one of
2
4
  # the polygon family of methods.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # To draw a rectangle, just provide the upper-left corner, width and height to
2
4
  # the <code>rectangle</code> method.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This transformation is used to rotate the user space. Give it an angle
2
4
  # and an <code>:origin</code> point about which to rotate and a block.
3
5
  # Everything inside the block will be drawn with the rotated coordinates.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This transformation is used to scale the user space. Give it an scale factor
2
4
  # and an <code>:origin</code> point and everything inside the block will be
3
5
  # scaled using the origin point as reference.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Soft masks are used for more complex alpha channel manipulations. You can use
2
4
  # arbitrary drawing functions for creation of soft masks. The resulting alpha
3
5
  # channel is made of greyscale version of the drawing (luminosity channel to be
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The cap style defines how the edge of a line or curve will be drawn. There are
2
4
  # three types: <code>:butt</code> (the default), <code>:round</code> and
3
5
  # <code>:projecting_square</code>
@@ -18,7 +20,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
18
20
 
19
21
  self.line_width = 25
20
22
 
21
- [:butt, :round, :projecting_square].each_with_index do |cap, i|
23
+ %i[butt round projecting_square].each_with_index do |cap, i|
22
24
  self.cap_style = cap
23
25
 
24
26
  y = 250 - i * 100
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This sets the dashed pattern for lines and curves. The (dash) length defines
2
4
  # how long each dash will be.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The join style defines how the intersection between two lines is drawn. There
2
4
  # are three types: <code>:miter</code> (the default), <code>:round</code> and
3
5
  # <code>:bevel</code>
@@ -13,7 +15,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
13
15
 
14
16
  self.line_width = 25
15
17
 
16
- [:miter, :round, :bevel].each_with_index do |style, i|
18
+ %i[miter round bevel].each_with_index do |style, i|
17
19
  self.join_style = style
18
20
 
19
21
  y = 200 - i * 100
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This transformation is used to translate the user space. Just provide the
2
4
  # x and y coordinates for the new origin.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Although the name of the method is <code>transparency</code>, what we are
2
4
  # actually setting is the opacity for fill and stroke. So <code>0</code> means
3
5
  # completely transparent and <code>1.0</code> means completely opaque
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Prawn manual how to read this manual page.
2
4
 
3
5
  require_relative 'example_helper'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # One of the options that the <code>image</code> method accepts is
2
4
  # <code>:at</code>. If you've read some of the graphics examples you are
3
5
  # probably already familiar with it. Just provide it the upper-left corner where
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # <code>:fit</code> option is useful when you want the image to have the
2
4
  # maximum size within a container preserving the aspect ratio without
3
5
  # overlapping.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The image may be positioned relatively to the current bounding box. The
2
4
  # horizontal position may be set with the <code>:position</code> option.
3
5
  #
@@ -11,7 +13,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
11
13
  bounding_box([50, cursor], width: 400, height: 450) do
12
14
  stroke_bounds
13
15
 
14
- [:left, :center, :right].each do |position|
16
+ %i[left center right].each do |position|
15
17
  text "Image aligned to the #{position}."
16
18
  image "#{Prawn::DATADIR}/images/stef.jpg", position: position
17
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Examples for embedding images.
2
4
 
3
5
  require_relative '../example_helper'
@@ -21,12 +23,12 @@ Prawn::ManualBuilder::Example.generate('images.pdf', page_size: 'FOLIO') do
21
23
  end
22
24
 
23
25
  p.intro do
24
- prose <<-END
26
+ prose <<-TEXT
25
27
  Embedding images on PDF documents is fairly easy. Prawn supports both
26
28
  JPG and PNG images.
27
29
 
28
30
  The examples show:
29
- END
31
+ TEXT
30
32
 
31
33
  list(
32
34
  'How to add an image to a page',
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # To embed images onto your PDF file use the <code>image</code> method.
2
4
  # It accepts the file path of the image to be loaded and some optional
3
5
  # arguments.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # To scale an image use the <code>:scale</code> option.
2
4
  #
3
5
  # It scales the image proportionally given the provided value.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # To set the vertical position of an image use the <code>:vposition</code>
2
4
  # option.
3
5
  #
@@ -11,7 +13,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
11
13
  bounding_box([0, cursor], width: 500, height: 450) do
12
14
  stroke_bounds
13
15
 
14
- [:top, :center, :bottom].each do |vposition|
16
+ %i[top center bottom].each do |vposition|
15
17
  text "Image vertically aligned to the #{vposition}.", valign: vposition
16
18
  image "#{Prawn::DATADIR}/images/stef.jpg",
17
19
  position: 250, vposition: vposition
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The image size can be set with the <code>:width</code> and
2
4
  # <code>:height</code> options.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # After defined the grid is there but nothing happens. To start taking effect
2
4
  # we need to use the grid boxes.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Now that we know how to access the boxes we might as well add some content
2
4
  # to them.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Examples for using grid layouts.
2
4
 
3
5
  require_relative '../example_helper'
@@ -9,11 +11,11 @@ Prawn::ManualBuilder::Example.generate('layout.pdf', page_size: 'FOLIO') do
9
11
  p.example 'content'
10
12
 
11
13
  p.intro do
12
- prose <<-END
14
+ prose <<-TEXT
13
15
  Prawn has support for two-dimensional grid based layouts out of the box.
14
16
 
15
17
  The examples show:
16
- END
18
+ TEXT
17
19
 
18
20
  list(
19
21
  'How to define the document grid',
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The document grid on Prawn is just a table-like structure with a defined
2
4
  # number of rows and columns. There are some helpers to create boxes of content
3
5
  # based on the grid coordinates.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # We have already seen how to define an outline tree sequentially.
2
4
  #
3
5
  # If you'd like to add nodes to the middle of an outline tree the
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Another way to insert nodes into an existing outline is the
2
4
  # <code>insert_section_after</code> method.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Examples for defining the document outline.
2
4
 
3
5
  require_relative '../example_helper'
@@ -14,12 +16,12 @@ Prawn::ManualBuilder::Example.generate('outline.pdf', page_size: 'FOLIO') do
14
16
  end
15
17
 
16
18
  p.intro do
17
- prose <<-END
19
+ prose <<-TEXT
18
20
  The outline of a PDF document is the table of contents tab you see to
19
21
  the right or left of your PDF viewer.
20
22
 
21
23
  The examples include:
22
- END
24
+ TEXT
23
25
 
24
26
  list(
25
27
  'How to define sections and pages',
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The document outline tree is the set of links used to navigate through the
2
4
  # various document sections and pages.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Below is the code to generate page numbers that alternate being rendered
2
4
  # on the right and left side of the page. The first page will have a "1" in
3
5
  # the bottom right corner. The second page will have a "2" in the bottom
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>number_pages</code> method is a simple way to number the pages of
2
4
  # your document. It should be called towards the end of the document since
3
5
  # pages created after the call won't be numbered.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Examples for stamps and repeaters.
2
4
 
3
5
  require_relative '../example_helper'
@@ -11,7 +13,7 @@ Prawn::ManualBuilder::Example.generate(filename, page_size: 'FOLIO') do
11
13
  p.example 'alternate_page_numbering', eval_source: false
12
14
 
13
15
  p.intro do
14
- prose <<-END
16
+ prose <<-TEXT
15
17
  Prawn offers two ways to handle repeatable content blocks. Repeater is
16
18
  useful for content that gets repeated at well defined intervals while
17
19
  Stamp is more appropriate if you need better control of when to repeat
@@ -20,7 +22,7 @@ Prawn::ManualBuilder::Example.generate(filename, page_size: 'FOLIO') do
20
22
  There is also one very specific helper for numbering pages.
21
23
 
22
24
  The examples show:
23
- END
25
+ TEXT
24
26
 
25
27
  list(
26
28
  'How to repeat content on several pages with a single invocation',
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>repeat</code> method is quite versatile when it comes to define
2
4
  # the intervals at which the content block should repeat.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Stamps should be used when you have content that will be included multiple
2
4
  # times in a document. Its advantages over creating the content anew each time
3
5
  # are:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>encrypt_document</code> method, as you might have already guessed,
2
4
  # is used to encrypt the PDF document.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Some permissions may be set for the regular user with the following options:
2
4
  # <code>:print_document</code>, <code>:modify_contents</code>,
3
5
  # <code>:copy_contents</code>, <code>:modify_annotations</code>. All this
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Examples for document encryption.
2
4
 
3
5
  require_relative '../example_helper'
@@ -8,12 +10,12 @@ Prawn::ManualBuilder::Example.generate('security.pdf', page_size: 'FOLIO') do
8
10
  p.example 'permissions', eval_source: false, full_source: true
9
11
 
10
12
  p.intro do
11
- prose <<-END
13
+ prose <<-TEXT
12
14
  Security lets you control who can read the document by defining
13
15
  a password.
14
16
 
15
17
  The examples include:
16
- END
18
+ TEXT
17
19
 
18
20
  list(
19
21
  'How to encrypt the document without the need for a password',
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'example_helper'
2
4
 
3
5
  filename = File.basename(__FILE__).gsub('.rb', '.pdf')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Horizontal text alignment can be achieved by supplying the <code>:align</code>
2
4
  # option to the text methods. Available options are <code>:left</code>
3
5
  # (default), <code>:right</code>, <code>:center</code>, and
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>:color</code> attribute can give a block of text a default color,
2
4
  # in RGB hex format or 4-value CMYK.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>column_box</code> method allows you to define columns that flow
2
4
  # their contents from one section to the next. You can have a number of columns
3
5
  # on the page, and only when the last column overflows will a new page be
@@ -12,7 +14,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
12
14
  move_down 12
13
15
 
14
16
  column_box([0, cursor], columns: 2, width: bounds.width) do
15
- text((<<-END.gsub(/\s+/, ' ') + "\n\n") * 3)
17
+ text((<<-TEXT.gsub(/\s+/, ' ') + "\n\n") * 3)
16
18
  All the States and Governments by which men are or ever have been ruled,
17
19
  have been and are either Republics or Princedoms. Princedoms are either
18
20
  hereditary, in which the sovereignty is derived through an ancient line
@@ -23,6 +25,6 @@ Prawn::ManualBuilder::Example.generate(filename) do
23
25
  acquired have either been used to live under a Prince or have been free;
24
26
  and he who acquires them does so either by his own arms or by the arms of
25
27
  others, and either by good fortune or by merit.
26
- END
28
+ TEXT
27
29
  end
28
30
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Prawn enables the declaration of fallback fonts for those glyphs that may not
2
4
  # be present in the desired font. Use the <code>:fallback_fonts</code> option
3
5
  # with any of the text or text box methods, or set fallback_fonts document-wide.
@@ -24,7 +26,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
24
26
  'to right.' \
25
27
  "\n\n" \
26
28
  "hello ƒ 你好\n再见 ƒ goodbye",
27
- fallback_fonts: ['Times-Roman', 'Kai']
29
+ fallback_fonts: %w[Times-Roman Kai]
28
30
  )
29
31
  end
30
32
  move_down 20
@@ -34,6 +36,6 @@ Prawn::ManualBuilder::Example.generate(filename) do
34
36
  { text: 'Fallback fonts can even override' },
35
37
  { text: 'fragment fonts (你好)', font: 'Times-Roman' }
36
38
  ],
37
- fallback_fonts: ['Times-Roman', 'Kai']
39
+ fallback_fonts: %w[Times-Roman Kai]
38
40
  )
39
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>font</code> method can be used in three different ways.
2
4
  #
3
5
  # If we don't pass it any arguments it will return the current font being used
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The <code>font_size</code> method works just like the <code>font</code>
2
4
  # method.
3
5
  #