prawn 2.3.0 → 2.5.0
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/prawn/document/bounding_box.rb +223 -143
- data/lib/prawn/document/column_box.rb +61 -26
- data/lib/prawn/document/internals.rb +25 -16
- data/lib/prawn/document/span.rb +21 -18
- data/lib/prawn/document.rb +273 -182
- data/lib/prawn/encoding.rb +2 -5
- data/lib/prawn/errors.rb +23 -34
- data/lib/prawn/font.rb +254 -139
- data/lib/prawn/font_metric_cache.rb +18 -16
- data/lib/prawn/fonts/afm.rb +99 -57
- data/lib/prawn/fonts/dfont.rb +7 -1
- data/lib/prawn/fonts/otf.rb +4 -1
- data/lib/prawn/fonts/to_unicode_cmap.rb +151 -0
- data/lib/prawn/fonts/ttc.rb +7 -2
- data/lib/prawn/fonts/ttf.rb +345 -107
- data/lib/prawn/fonts.rb +14 -0
- data/lib/prawn/graphics/blend_mode.rb +25 -28
- data/lib/prawn/graphics/cap_style.rb +9 -12
- data/lib/prawn/graphics/color.rb +75 -50
- data/lib/prawn/graphics/dash.rb +45 -42
- data/lib/prawn/graphics/join_style.rb +18 -12
- data/lib/prawn/graphics/patterns.rb +239 -110
- data/lib/prawn/graphics/transformation.rb +51 -44
- data/lib/prawn/graphics/transparency.rb +16 -40
- data/lib/prawn/graphics.rb +370 -260
- data/lib/prawn/grid.rb +219 -57
- data/lib/prawn/image_handler.rb +27 -10
- data/lib/prawn/images/image.rb +8 -10
- data/lib/prawn/images/jpg.rb +46 -20
- data/lib/prawn/images/png.rb +94 -42
- data/lib/prawn/images.rb +70 -81
- data/lib/prawn/measurement_extensions.rb +39 -8
- data/lib/prawn/measurements.rb +60 -5
- data/lib/prawn/outline.rb +120 -113
- data/lib/prawn/repeater.rb +52 -36
- data/lib/prawn/security/arcfour.rb +4 -4
- data/lib/prawn/security.rb +106 -98
- data/lib/prawn/soft_mask.rb +42 -30
- data/lib/prawn/stamp.rb +38 -42
- data/lib/prawn/text/box.rb +156 -105
- data/lib/prawn/text/formatted/arranger.rb +121 -41
- data/lib/prawn/text/formatted/box.rb +239 -163
- data/lib/prawn/text/formatted/fragment.rb +130 -14
- data/lib/prawn/text/formatted/line_wrap.rb +49 -38
- data/lib/prawn/text/formatted/parser.rb +116 -74
- data/lib/prawn/text/formatted/wrap.rb +25 -26
- data/lib/prawn/text/formatted.rb +75 -0
- data/lib/prawn/text.rb +456 -211
- data/lib/prawn/transformation_stack.rb +29 -10
- data/lib/prawn/utilities.rb +13 -13
- data/lib/prawn/version.rb +2 -1
- data/lib/prawn/view.rb +69 -54
- data/lib/prawn.rb +24 -18
- data.tar.gz.sig +0 -0
- metadata +55 -262
- metadata.gz.sig +3 -4
- data/.yardopts +0 -10
- data/Gemfile +0 -5
- data/Rakefile +0 -54
- data/manual/absolute_position.pdf +0 -0
- data/manual/basic_concepts/adding_pages.rb +0 -26
- data/manual/basic_concepts/basic_concepts.rb +0 -43
- data/manual/basic_concepts/creation.rb +0 -38
- data/manual/basic_concepts/cursor.rb +0 -32
- data/manual/basic_concepts/measurement.rb +0 -24
- data/manual/basic_concepts/origin.rb +0 -37
- data/manual/basic_concepts/other_cursor_helpers.rb +0 -39
- data/manual/basic_concepts/view.rb +0 -48
- data/manual/bounding_box/bounding_box.rb +0 -41
- data/manual/bounding_box/bounds.rb +0 -48
- data/manual/bounding_box/canvas.rb +0 -23
- data/manual/bounding_box/creation.rb +0 -22
- data/manual/bounding_box/indentation.rb +0 -45
- data/manual/bounding_box/nesting.rb +0 -52
- data/manual/bounding_box/russian_boxes.rb +0 -40
- data/manual/bounding_box/stretchy.rb +0 -29
- data/manual/contents.rb +0 -35
- data/manual/cover.rb +0 -43
- data/manual/document_and_page_options/background.rb +0 -25
- data/manual/document_and_page_options/document_and_page_options.rb +0 -34
- data/manual/document_and_page_options/metadata.rb +0 -25
- data/manual/document_and_page_options/page_margins.rb +0 -36
- data/manual/document_and_page_options/page_size.rb +0 -34
- data/manual/document_and_page_options/print_scaling.rb +0 -22
- data/manual/example_helper.rb +0 -8
- data/manual/graphics/blend_mode.rb +0 -52
- data/manual/graphics/circle_and_ellipse.rb +0 -21
- data/manual/graphics/color.rb +0 -22
- data/manual/graphics/common_lines.rb +0 -29
- data/manual/graphics/fill_and_stroke.rb +0 -41
- data/manual/graphics/fill_rules.rb +0 -37
- data/manual/graphics/gradients.rb +0 -43
- data/manual/graphics/graphics.rb +0 -64
- data/manual/graphics/helper.rb +0 -27
- data/manual/graphics/line_width.rb +0 -36
- data/manual/graphics/lines_and_curves.rb +0 -40
- data/manual/graphics/polygon.rb +0 -27
- data/manual/graphics/rectangle.rb +0 -20
- data/manual/graphics/rotate.rb +0 -25
- data/manual/graphics/scale.rb +0 -42
- data/manual/graphics/soft_masks.rb +0 -44
- data/manual/graphics/stroke_cap.rb +0 -30
- data/manual/graphics/stroke_dash.rb +0 -47
- data/manual/graphics/stroke_join.rb +0 -29
- data/manual/graphics/translate.rb +0 -28
- data/manual/graphics/transparency.rb +0 -33
- data/manual/how_to_read_this_manual.rb +0 -39
- data/manual/images/absolute_position.rb +0 -22
- data/manual/images/fit.rb +0 -20
- data/manual/images/horizontal.rb +0 -24
- data/manual/images/images.rb +0 -41
- data/manual/images/plain_image.rb +0 -17
- data/manual/images/scale.rb +0 -21
- data/manual/images/vertical.rb +0 -27
- data/manual/images/width_and_height.rb +0 -24
- data/manual/layout/boxes.rb +0 -26
- data/manual/layout/content.rb +0 -24
- data/manual/layout/layout.rb +0 -27
- data/manual/layout/simple_grid.rb +0 -22
- data/manual/outline/add_subsection_to.rb +0 -60
- data/manual/outline/insert_section_after.rb +0 -46
- data/manual/outline/outline.rb +0 -33
- data/manual/outline/sections_and_pages.rb +0 -66
- data/manual/repeatable_content/alternate_page_numbering.rb +0 -36
- data/manual/repeatable_content/page_numbering.rb +0 -55
- data/manual/repeatable_content/repeatable_content.rb +0 -35
- data/manual/repeatable_content/repeater.rb +0 -54
- data/manual/repeatable_content/stamp.rb +0 -40
- data/manual/security/encryption.rb +0 -28
- data/manual/security/permissions.rb +0 -41
- data/manual/security/security.rb +0 -28
- data/manual/table.rb +0 -16
- data/manual/text/alignment.rb +0 -43
- data/manual/text/color.rb +0 -24
- data/manual/text/column_box.rb +0 -30
- data/manual/text/fallback_fonts.rb +0 -41
- data/manual/text/font.rb +0 -40
- data/manual/text/font_size.rb +0 -44
- data/manual/text/font_style.rb +0 -22
- data/manual/text/formatted_callbacks.rb +0 -65
- data/manual/text/formatted_text.rb +0 -58
- data/manual/text/free_flowing_text.rb +0 -50
- data/manual/text/inline.rb +0 -40
- data/manual/text/kerning_and_character_spacing.rb +0 -38
- data/manual/text/leading.rb +0 -24
- data/manual/text/line_wrapping.rb +0 -60
- data/manual/text/paragraph_indentation.rb +0 -32
- data/manual/text/positioned_text.rb +0 -37
- data/manual/text/registering_families.rb +0 -51
- data/manual/text/rendering_and_color.rb +0 -36
- data/manual/text/right_to_left_text.rb +0 -54
- data/manual/text/rotation.rb +0 -47
- data/manual/text/single_usage.rb +0 -36
- data/manual/text/text.rb +0 -75
- data/manual/text/text_box_excess.rb +0 -35
- data/manual/text/text_box_extensions.rb +0 -48
- data/manual/text/text_box_overflow.rb +0 -49
- data/manual/text/utf8.rb +0 -27
- data/manual/text/win_ansi_charset.rb +0 -62
- data/prawn.gemspec +0 -57
- data/spec/data/curves.pdf +0 -66
- data/spec/extensions/encoding_helpers.rb +0 -11
- data/spec/prawn/document/bounding_box_spec.rb +0 -546
- data/spec/prawn/document/column_box_spec.rb +0 -75
- data/spec/prawn/document/security_spec.rb +0 -176
- data/spec/prawn/document_annotations_spec.rb +0 -76
- data/spec/prawn/document_destinations_spec.rb +0 -15
- data/spec/prawn/document_grid_spec.rb +0 -99
- data/spec/prawn/document_reference_spec.rb +0 -27
- data/spec/prawn/document_span_spec.rb +0 -36
- data/spec/prawn/document_spec.rb +0 -802
- data/spec/prawn/font_metric_cache_spec.rb +0 -54
- data/spec/prawn/font_spec.rb +0 -542
- data/spec/prawn/graphics/blend_mode_spec.rb +0 -63
- data/spec/prawn/graphics/transparency_spec.rb +0 -81
- data/spec/prawn/graphics_spec.rb +0 -837
- data/spec/prawn/graphics_stroke_styles_spec.rb +0 -229
- data/spec/prawn/image_handler_spec.rb +0 -53
- data/spec/prawn/images/jpg_spec.rb +0 -20
- data/spec/prawn/images/png_spec.rb +0 -283
- data/spec/prawn/images_spec.rb +0 -224
- data/spec/prawn/measurements_extensions_spec.rb +0 -24
- data/spec/prawn/outline_spec.rb +0 -412
- data/spec/prawn/repeater_spec.rb +0 -165
- data/spec/prawn/soft_mask_spec.rb +0 -74
- data/spec/prawn/stamp_spec.rb +0 -172
- data/spec/prawn/text/box_spec.rb +0 -1112
- data/spec/prawn/text/formatted/arranger_spec.rb +0 -466
- data/spec/prawn/text/formatted/box_spec.rb +0 -846
- data/spec/prawn/text/formatted/fragment_spec.rb +0 -343
- data/spec/prawn/text/formatted/line_wrap_spec.rb +0 -494
- data/spec/prawn/text/formatted/parser_spec.rb +0 -697
- data/spec/prawn/text_draw_text_spec.rb +0 -149
- data/spec/prawn/text_rendering_mode_spec.rb +0 -48
- data/spec/prawn/text_spacing_spec.rb +0 -95
- data/spec/prawn/text_spec.rb +0 -603
- data/spec/prawn/text_with_inline_formatting_spec.rb +0 -35
- data/spec/prawn/transformation_stack_spec.rb +0 -66
- data/spec/prawn/view_spec.rb +0 -63
- data/spec/prawn_manual_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -48
data/manual/text/text.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Examples for text rendering.
|
4
|
-
|
5
|
-
require '../example_helper'
|
6
|
-
|
7
|
-
Prawn::ManualBuilder::Example.generate('text.pdf', page_size: 'FOLIO') do
|
8
|
-
package 'text' do |p|
|
9
|
-
p.section 'Basics' do |s|
|
10
|
-
s.example 'free_flowing_text'
|
11
|
-
s.example 'positioned_text'
|
12
|
-
s.example 'text_box_overflow'
|
13
|
-
s.example 'text_box_excess'
|
14
|
-
s.example 'column_box'
|
15
|
-
end
|
16
|
-
|
17
|
-
p.section 'Styling' do |s|
|
18
|
-
s.example 'font'
|
19
|
-
s.example 'font_size'
|
20
|
-
s.example 'font_style'
|
21
|
-
s.example 'color'
|
22
|
-
s.example 'alignment'
|
23
|
-
s.example 'leading'
|
24
|
-
s.example 'kerning_and_character_spacing'
|
25
|
-
s.example 'paragraph_indentation'
|
26
|
-
s.example 'rotation'
|
27
|
-
end
|
28
|
-
|
29
|
-
p.section 'Advanced Styling' do |s|
|
30
|
-
s.example 'inline'
|
31
|
-
s.example 'formatted_text'
|
32
|
-
s.example 'formatted_callbacks'
|
33
|
-
s.example 'rendering_and_color'
|
34
|
-
s.example 'text_box_extensions'
|
35
|
-
end
|
36
|
-
|
37
|
-
p.section 'External Fonts' do |s|
|
38
|
-
s.example 'single_usage'
|
39
|
-
s.example 'registering_families'
|
40
|
-
end
|
41
|
-
|
42
|
-
p.section 'Multilingualization' do |s|
|
43
|
-
s.example 'utf8'
|
44
|
-
s.example 'line_wrapping'
|
45
|
-
s.example 'right_to_left_text'
|
46
|
-
s.example 'fallback_fonts'
|
47
|
-
s.example 'win_ansi_charset'
|
48
|
-
end
|
49
|
-
|
50
|
-
p.intro do
|
51
|
-
prose <<-TEXT
|
52
|
-
This is probably the feature people will use the most. There is no
|
53
|
-
shortage of options when it comes to text. You'll be hard pressed to
|
54
|
-
find a use case that is not covered by one of the text methods and
|
55
|
-
configurable options.
|
56
|
-
|
57
|
-
The examples show:
|
58
|
-
TEXT
|
59
|
-
|
60
|
-
list(
|
61
|
-
'Text that flows from page to page automatically starting new pages when necessary',
|
62
|
-
'How to use text boxes and place them on specific positions',
|
63
|
-
'What to do when a text box is too small to fit its content',
|
64
|
-
'Flowing text in columns',
|
65
|
-
'How to change the text style configuring font, size, alignment and many other settings',
|
66
|
-
'How to style specific portions of a text with inline styling and formatted text',
|
67
|
-
'How to define formatted callbacks to reuse common styling definitions',
|
68
|
-
'How to use the different rendering modes available for the text methods',
|
69
|
-
'How to create your custom text box extensions',
|
70
|
-
'How to use external fonts on your pdfs',
|
71
|
-
'What happens when rendering text in different languages'
|
72
|
-
)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Whenever the <code>text_box</code> method truncates text, this truncated bit
|
4
|
-
# is not lost, it is the method return value and we can take advantage of that.
|
5
|
-
#
|
6
|
-
# We just need to take some precautions.
|
7
|
-
#
|
8
|
-
# This example renders as much of the text as will fit in a larger font inside
|
9
|
-
# one text_box and then proceeds to render the remaining text in the default
|
10
|
-
# size in a second text_box.
|
11
|
-
|
12
|
-
require '../example_helper'
|
13
|
-
|
14
|
-
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
15
|
-
Prawn::ManualBuilder::Example.generate(filename) do
|
16
|
-
string = 'This is the beginning of the text. It will be cut somewhere and ' \
|
17
|
-
'the rest of the text will procede to be rendered this time by ' \
|
18
|
-
'calling another method.' + ' . ' * 50
|
19
|
-
|
20
|
-
y_position = cursor - 20
|
21
|
-
excess_text = text_box(
|
22
|
-
string,
|
23
|
-
width: 300,
|
24
|
-
height: 50,
|
25
|
-
overflow: :truncate,
|
26
|
-
at: [100, y_position],
|
27
|
-
size: 18
|
28
|
-
)
|
29
|
-
|
30
|
-
text_box(
|
31
|
-
excess_text,
|
32
|
-
width: 300,
|
33
|
-
at: [100, y_position - 100]
|
34
|
-
)
|
35
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# We've already seen one way of using text boxes with the <code>text_box</code>
|
4
|
-
# method. Turns out this method is just a convenience for using the
|
5
|
-
# <code>Prawn::Text::Box</code> class as it creates a new object and call
|
6
|
-
# <code>render</code> on it.
|
7
|
-
#
|
8
|
-
# Knowing that any extensions we add to <code>Prawn::Text::Box</code> will take
|
9
|
-
# effect when we use the <code>text_box</code> method. To add an extension all
|
10
|
-
# we need to do is append the <code>Prawn::Text::Box.extensions</code> array
|
11
|
-
# with a module.
|
12
|
-
|
13
|
-
require '../example_helper'
|
14
|
-
|
15
|
-
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
16
|
-
Prawn::ManualBuilder::Example.generate(filename) do
|
17
|
-
module TriangleBox
|
18
|
-
def available_width
|
19
|
-
height + 25
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
y_position = cursor - 10
|
24
|
-
width = 100
|
25
|
-
height = 100
|
26
|
-
|
27
|
-
Prawn::Text::Box.extensions << TriangleBox
|
28
|
-
stroke_rectangle([0, y_position], width, height)
|
29
|
-
text_box(
|
30
|
-
'A' * 100,
|
31
|
-
at: [0, y_position],
|
32
|
-
width: width,
|
33
|
-
height: height
|
34
|
-
)
|
35
|
-
|
36
|
-
Prawn::Text::Formatted::Box.extensions << TriangleBox
|
37
|
-
stroke_rectangle([200, y_position], width, height)
|
38
|
-
formatted_text_box(
|
39
|
-
[text: 'A' * 100, color: '009900'],
|
40
|
-
at: [200, y_position],
|
41
|
-
width: width,
|
42
|
-
height: height
|
43
|
-
)
|
44
|
-
|
45
|
-
# Here we clear the extensions array
|
46
|
-
Prawn::Text::Box.extensions.clear
|
47
|
-
Prawn::Text::Formatted::Box.extensions.clear
|
48
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# The <code>text_box</code> method accepts both <code>:width</code> and
|
4
|
-
# <code>:height</code> options. So what happens if the text doesn't fit the box?
|
5
|
-
#
|
6
|
-
# The default behavior is to truncate the text but this can be changed with
|
7
|
-
# the <code>:overflow</code> option. Available modes are <code>:expand</code>
|
8
|
-
# (the box will increase to fit the text) and <code>:shrink_to_fit</code>
|
9
|
-
# (the text font size will be shrunk to fit).
|
10
|
-
#
|
11
|
-
# If <code>:shrink_to_fit</code> mode is used with the
|
12
|
-
# <code>:min_font_size</code> option set, the font size will not be reduced to
|
13
|
-
# less than the value provided even if it means truncating some text.
|
14
|
-
#
|
15
|
-
# If the <code>:disable_wrap_by_char</code> is set to <code>true</code>
|
16
|
-
# then any text wrapping done while using the <code>:shrink_to_fit</code>
|
17
|
-
# mode will not break up the middle of words.
|
18
|
-
|
19
|
-
require_relative '../example_helper'
|
20
|
-
|
21
|
-
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
22
|
-
Prawn::ManualBuilder::Example.generate(filename) do
|
23
|
-
string = 'This is the sample text used for the text boxes. See how it ' \
|
24
|
-
'behave with the various overflow options used.'
|
25
|
-
|
26
|
-
text string
|
27
|
-
|
28
|
-
y_position = cursor - 20
|
29
|
-
%i[truncate expand shrink_to_fit].each_with_index do |mode, i|
|
30
|
-
text_box string, at: [i * 150, y_position],
|
31
|
-
width: 100,
|
32
|
-
height: 50,
|
33
|
-
overflow: mode
|
34
|
-
end
|
35
|
-
|
36
|
-
string = 'If the box is too small for the text, :shrink_to_fit ' \
|
37
|
-
'can render the text in a really small font size.'
|
38
|
-
|
39
|
-
move_down 120
|
40
|
-
text string
|
41
|
-
y_position = cursor - 20
|
42
|
-
[nil, 8, 10, 12].each_with_index do |value, index|
|
43
|
-
text_box string, at: [index * 150, y_position],
|
44
|
-
width: 50,
|
45
|
-
height: 50,
|
46
|
-
overflow: :shrink_to_fit,
|
47
|
-
min_font_size: value
|
48
|
-
end
|
49
|
-
end
|
data/manual/text/utf8.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Multilingualization isn't much of a problem on Prawn as its default encoding
|
4
|
-
# is UTF-8. The only thing you need to worry about is if the font support the
|
5
|
-
# glyphs of your language.
|
6
|
-
|
7
|
-
require_relative '../example_helper'
|
8
|
-
|
9
|
-
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
10
|
-
Prawn::ManualBuilder::Example.generate(filename) do
|
11
|
-
text 'Take this example, a simple Euro sign:'
|
12
|
-
text '€', size: 32
|
13
|
-
move_down 20
|
14
|
-
|
15
|
-
text 'This works, because € is one of the few ' \
|
16
|
-
'non-ASCII glyphs supported in PDF built-in fonts.'
|
17
|
-
|
18
|
-
move_down 20
|
19
|
-
|
20
|
-
text 'For full internationalized text support, we need to use external fonts:'
|
21
|
-
move_down 20
|
22
|
-
|
23
|
-
font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf") do
|
24
|
-
text 'ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.'
|
25
|
-
text 'There you go.'
|
26
|
-
end
|
27
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
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
|
-
require_relative '../example_helper'
|
8
|
-
|
9
|
-
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
10
|
-
Prawn::ManualBuilder::Example.generate(filename) do
|
11
|
-
FONT_SIZE = 9.5
|
12
|
-
|
13
|
-
x = 0
|
14
|
-
y = bounds.top
|
15
|
-
|
16
|
-
fields = [
|
17
|
-
[20, :right], [8, :left], [12, :center], [30, :right], [8, :left],
|
18
|
-
[0, :left]
|
19
|
-
]
|
20
|
-
|
21
|
-
font 'Helvetica', size: FONT_SIZE
|
22
|
-
|
23
|
-
start_new_page
|
24
|
-
|
25
|
-
Prawn::Encoding::WinAnsi::CHARACTERS.each_with_index do |name, index|
|
26
|
-
next if name == '.notdef'
|
27
|
-
|
28
|
-
y -= FONT_SIZE
|
29
|
-
|
30
|
-
if y < FONT_SIZE
|
31
|
-
y = bounds.top - FONT_SIZE
|
32
|
-
x += 170
|
33
|
-
end
|
34
|
-
|
35
|
-
code = format('%<index>d.', index: index)
|
36
|
-
char = index.chr.force_encoding(::Encoding::Windows_1252)
|
37
|
-
|
38
|
-
width = 1000 * width_of(char, size: FONT_SIZE) / FONT_SIZE
|
39
|
-
size = format('%<width>d', width: width)
|
40
|
-
|
41
|
-
data = [code, nil, char, size, nil, name]
|
42
|
-
dx = x
|
43
|
-
fields.zip(data).each do |(total_width, align), field|
|
44
|
-
if field
|
45
|
-
width = width_of(field, size: FONT_SIZE)
|
46
|
-
|
47
|
-
case align
|
48
|
-
when :left then offset = 0
|
49
|
-
when :right then offset = total_width - width
|
50
|
-
when :center then offset = (total_width - width) / 2
|
51
|
-
end
|
52
|
-
|
53
|
-
text_box(
|
54
|
-
field.dup.force_encoding('windows-1252').encode('UTF-8'),
|
55
|
-
at: [dx + offset, y]
|
56
|
-
)
|
57
|
-
end
|
58
|
-
|
59
|
-
dx += total_width
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/prawn.gemspec
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
basedir = __dir__
|
4
|
-
|
5
|
-
require "#{basedir}/lib/prawn/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'prawn'
|
9
|
-
spec.version = Prawn::VERSION
|
10
|
-
spec.platform = Gem::Platform::RUBY
|
11
|
-
spec.summary = 'A fast and nimble PDF generator for Ruby'
|
12
|
-
|
13
|
-
spec.cert_chain = ['certs/pointlessone.pem']
|
14
|
-
if $PROGRAM_NAME.end_with? 'gem'
|
15
|
-
spec.signing_key = File.expand_path('~/.gem/gem-private_key.pem')
|
16
|
-
end
|
17
|
-
|
18
|
-
spec.files = Dir.glob('{examples,lib,spec,manual}/**/**/*') +
|
19
|
-
Dir.glob('data/fonts/{MustRead.html,*.afm}') +
|
20
|
-
[
|
21
|
-
'Rakefile', 'prawn.gemspec', 'Gemfile',
|
22
|
-
'COPYING', 'LICENSE', 'GPLv2', 'GPLv3',
|
23
|
-
'.yardopts'
|
24
|
-
]
|
25
|
-
spec.require_path = 'lib'
|
26
|
-
spec.required_ruby_version = '~> 2.5'
|
27
|
-
spec.required_rubygems_version = '>= 1.3.6'
|
28
|
-
|
29
|
-
spec.authors = [
|
30
|
-
'Gregory Brown', 'Brad Ediger', 'Daniel Nelson', 'Jonathan Greenberg',
|
31
|
-
'James Healy'
|
32
|
-
]
|
33
|
-
spec.email = [
|
34
|
-
'gregory.t.brown@gmail.com', 'brad@bradediger.com', 'dnelson@bluejade.com',
|
35
|
-
'greenberg@entryway.net', 'jimmy@deefa.com'
|
36
|
-
]
|
37
|
-
spec.licenses = %w[PRAWN GPL-2.0 GPL-3.0]
|
38
|
-
|
39
|
-
spec.add_dependency('pdf-core', '~> 0.8.1')
|
40
|
-
spec.add_dependency('ttfunk', '~> 1.6')
|
41
|
-
|
42
|
-
spec.add_development_dependency('pdf-inspector', '>= 1.2.1', '< 2.0.a')
|
43
|
-
spec.add_development_dependency('pdf-reader', ['~> 1.4', '>= 1.4.1'])
|
44
|
-
spec.add_development_dependency('prawn-manual_builder', '>= 0.3.0')
|
45
|
-
spec.add_development_dependency('rake', '~> 12.0')
|
46
|
-
spec.add_development_dependency('rspec', '~> 3.0')
|
47
|
-
spec.add_development_dependency('rubocop', '~> 0.84.0')
|
48
|
-
spec.add_development_dependency('rubocop-performance', '~> 1.1')
|
49
|
-
spec.add_development_dependency('rubocop-rspec', '~> 1.32')
|
50
|
-
spec.add_development_dependency('simplecov')
|
51
|
-
spec.add_development_dependency('yard')
|
52
|
-
|
53
|
-
spec.homepage = 'http://prawnpdf.org'
|
54
|
-
spec.description = <<END_DESC
|
55
|
-
Prawn is a fast, tiny, and nimble PDF generator for Ruby
|
56
|
-
END_DESC
|
57
|
-
end
|
data/spec/data/curves.pdf
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
%PDF-1.3
|
2
|
-
%����
|
3
|
-
1 0 obj
|
4
|
-
<< /Creator (Prawn)
|
5
|
-
/Producer (Prawn)
|
6
|
-
>>
|
7
|
-
endobj
|
8
|
-
2 0 obj
|
9
|
-
<< /Type /Pages
|
10
|
-
/Count 1
|
11
|
-
/Kids [5 0 R]
|
12
|
-
>>
|
13
|
-
endobj
|
14
|
-
3 0 obj
|
15
|
-
<< /Type /Catalog
|
16
|
-
/Pages 2 0 R
|
17
|
-
>>
|
18
|
-
endobj
|
19
|
-
4 0 obj
|
20
|
-
<< /Length 380
|
21
|
-
>>
|
22
|
-
stream
|
23
|
-
/DeviceRGB cs
|
24
|
-
0.000 0.000 0.000 scn
|
25
|
-
/DeviceRGB CS
|
26
|
-
0.000 0.000 0.000 SCN
|
27
|
-
q
|
28
|
-
136.000 136.000 m
|
29
|
-
96.000 126.000 96.000 126.000 86.000 86.000 c
|
30
|
-
S
|
31
|
-
246.000 236.000 m
|
32
|
-
246.000 241.523 241.523 246.000 236.000 246.000 c
|
33
|
-
230.477 246.000 226.000 241.523 226.000 236.000 c
|
34
|
-
226.000 230.477 230.477 226.000 236.000 226.000 c
|
35
|
-
241.523 226.000 246.000 230.477 246.000 236.000 c
|
36
|
-
236.000 236.000 m
|
37
|
-
f
|
38
|
-
Q
|
39
|
-
|
40
|
-
endstream
|
41
|
-
endobj
|
42
|
-
5 0 obj
|
43
|
-
<< /Type /Page
|
44
|
-
/Parent 2 0 R
|
45
|
-
/MediaBox [0 0 612.0 792.0]
|
46
|
-
/Contents 4 0 R
|
47
|
-
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
48
|
-
>>
|
49
|
-
>>
|
50
|
-
endobj
|
51
|
-
xref
|
52
|
-
0 6
|
53
|
-
0000000000 65535 f
|
54
|
-
0000000015 00000 n
|
55
|
-
0000000071 00000 n
|
56
|
-
0000000128 00000 n
|
57
|
-
0000000177 00000 n
|
58
|
-
0000000608 00000 n
|
59
|
-
trailer
|
60
|
-
<< /Size 6
|
61
|
-
/Root 3 0 R
|
62
|
-
/Info 1 0 R
|
63
|
-
>>
|
64
|
-
startxref
|
65
|
-
762
|
66
|
-
%%EOF
|