prawn-layout 0.3.2 → 0.7.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.
- data/README +1 -0
- data/Rakefile +6 -3
- data/lib/prawn/layout.rb +1 -1
- data/lib/prawn/layout/page.rb +0 -40
- data/lib/prawn/table/cell.rb +15 -13
- metadata +31 -309
- data/examples/page_layout/flowing_text_with_header_and_footer.rb +0 -36
- data/spec/page_layout_spec.rb +0 -41
- data/vendor/prawn-core/COPYING +0 -340
- data/vendor/prawn-core/HACKING +0 -46
- data/vendor/prawn-core/LICENSE +0 -56
- data/vendor/prawn-core/README +0 -142
- data/vendor/prawn-core/Rakefile +0 -75
- data/vendor/prawn-core/bench/afm_text_bench.rb +0 -18
- data/vendor/prawn-core/bench/png_type_6.rb +0 -15
- data/vendor/prawn-core/bench/ttf_text_bench.rb +0 -19
- data/vendor/prawn-core/bugs/canvas_sets_y_to_0.rb +0 -15
- data/vendor/prawn-core/bugs/png_barcode_issue.rb +0 -11
- data/vendor/prawn-core/bugs/resolved/canvas_sets_y_to_0.rb +0 -15
- data/vendor/prawn-core/data/encodings/win_ansi.txt +0 -29
- data/vendor/prawn-core/data/fonts/Action Man.dfont +0 -0
- data/vendor/prawn-core/data/fonts/Activa.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Chalkboard.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Courier-Bold.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier-BoldOblique.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier-Oblique.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier.afm +0 -342
- data/vendor/prawn-core/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Dustismo_Roman.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Helvetica-Bold.afm +0 -2827
- data/vendor/prawn-core/data/fonts/Helvetica-BoldOblique.afm +0 -2827
- data/vendor/prawn-core/data/fonts/Helvetica-Oblique.afm +0 -3051
- data/vendor/prawn-core/data/fonts/Helvetica.afm +0 -3051
- data/vendor/prawn-core/data/fonts/MustRead.html +0 -19
- data/vendor/prawn-core/data/fonts/Symbol.afm +0 -213
- data/vendor/prawn-core/data/fonts/Times-Bold.afm +0 -2588
- data/vendor/prawn-core/data/fonts/Times-BoldItalic.afm +0 -2384
- data/vendor/prawn-core/data/fonts/Times-Italic.afm +0 -2667
- data/vendor/prawn-core/data/fonts/Times-Roman.afm +0 -2419
- data/vendor/prawn-core/data/fonts/ZapfDingbats.afm +0 -225
- data/vendor/prawn-core/data/fonts/comicsans.ttf +0 -0
- data/vendor/prawn-core/data/fonts/gkai00mp.ttf +0 -0
- data/vendor/prawn-core/data/images/16bit.alpha +0 -0
- data/vendor/prawn-core/data/images/16bit.dat +0 -0
- data/vendor/prawn-core/data/images/16bit.png +0 -0
- data/vendor/prawn-core/data/images/arrow.png +0 -0
- data/vendor/prawn-core/data/images/arrow2.png +0 -0
- data/vendor/prawn-core/data/images/barcode_issue.png +0 -0
- data/vendor/prawn-core/data/images/dice.alpha +0 -0
- data/vendor/prawn-core/data/images/dice.dat +0 -0
- data/vendor/prawn-core/data/images/dice.png +0 -0
- data/vendor/prawn-core/data/images/dice_interlaced.png +0 -0
- data/vendor/prawn-core/data/images/fractal.jpg +0 -0
- data/vendor/prawn-core/data/images/letterhead.jpg +0 -0
- data/vendor/prawn-core/data/images/page_white_text.alpha +0 -0
- data/vendor/prawn-core/data/images/page_white_text.dat +0 -0
- data/vendor/prawn-core/data/images/page_white_text.png +0 -0
- data/vendor/prawn-core/data/images/pigs.jpg +0 -0
- data/vendor/prawn-core/data/images/rails.dat +0 -0
- data/vendor/prawn-core/data/images/rails.png +0 -0
- data/vendor/prawn-core/data/images/ruport.png +0 -0
- data/vendor/prawn-core/data/images/ruport_data.dat +0 -0
- data/vendor/prawn-core/data/images/ruport_transparent.png +0 -0
- data/vendor/prawn-core/data/images/ruport_type0.png +0 -0
- data/vendor/prawn-core/data/images/stef.jpg +0 -0
- data/vendor/prawn-core/data/images/tru256.bmp +0 -0
- data/vendor/prawn-core/data/images/web-links.dat +0 -1
- data/vendor/prawn-core/data/images/web-links.png +0 -0
- data/vendor/prawn-core/data/shift_jis_text.txt +0 -1
- data/vendor/prawn-core/examples/bounding_box/bounding_boxes.rb +0 -43
- data/vendor/prawn-core/examples/bounding_box/indentation.rb +0 -34
- data/vendor/prawn-core/examples/bounding_box/russian_boxes.rb +0 -36
- data/vendor/prawn-core/examples/bounding_box/stretched_nesting.rb +0 -67
- data/vendor/prawn-core/examples/column_box/column_box_example.rb +0 -43
- data/vendor/prawn-core/examples/example_helper.rb +0 -3
- data/vendor/prawn-core/examples/general/background.rb +0 -23
- data/vendor/prawn-core/examples/general/canvas.rb +0 -15
- data/vendor/prawn-core/examples/general/margin.rb +0 -36
- data/vendor/prawn-core/examples/general/measurement_units.rb +0 -51
- data/vendor/prawn-core/examples/general/metadata-info.rb +0 -16
- data/vendor/prawn-core/examples/general/multi_page_layout.rb +0 -18
- data/vendor/prawn-core/examples/general/page_geometry.rb +0 -31
- data/vendor/prawn-core/examples/general/page_numbering.rb +0 -15
- data/vendor/prawn-core/examples/general/stamp.rb +0 -45
- data/vendor/prawn-core/examples/graphics/basic_images.rb +0 -23
- data/vendor/prawn-core/examples/graphics/cmyk.rb +0 -12
- data/vendor/prawn-core/examples/graphics/curves.rb +0 -11
- data/vendor/prawn-core/examples/graphics/hexagon.rb +0 -13
- data/vendor/prawn-core/examples/graphics/image_fit.rb +0 -15
- data/vendor/prawn-core/examples/graphics/image_flow.rb +0 -37
- data/vendor/prawn-core/examples/graphics/image_position.rb +0 -17
- data/vendor/prawn-core/examples/graphics/line.rb +0 -32
- data/vendor/prawn-core/examples/graphics/png_types.rb +0 -22
- data/vendor/prawn-core/examples/graphics/polygons.rb +0 -16
- data/vendor/prawn-core/examples/graphics/remote_images.rb +0 -12
- data/vendor/prawn-core/examples/graphics/ruport_style_helpers.rb +0 -19
- data/vendor/prawn-core/examples/graphics/stroke_bounds.rb +0 -20
- data/vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb +0 -45
- data/vendor/prawn-core/examples/graphics/stroke_dash.rb +0 -42
- data/vendor/prawn-core/examples/graphics/transparency.rb +0 -26
- data/vendor/prawn-core/examples/m17n/chinese_text_wrapping.rb +0 -19
- data/vendor/prawn-core/examples/m17n/euro.rb +0 -15
- data/vendor/prawn-core/examples/m17n/sjis.rb +0 -28
- data/vendor/prawn-core/examples/m17n/utf8.rb +0 -13
- data/vendor/prawn-core/examples/m17n/win_ansi_charset.rb +0 -54
- data/vendor/prawn-core/examples/text/alignment.rb +0 -18
- data/vendor/prawn-core/examples/text/dfont.rb +0 -48
- data/vendor/prawn-core/examples/text/family_based_styling.rb +0 -24
- data/vendor/prawn-core/examples/text/font_calculations.rb +0 -91
- data/vendor/prawn-core/examples/text/font_size.rb +0 -33
- data/vendor/prawn-core/examples/text/kerning.rb +0 -30
- data/vendor/prawn-core/examples/text/simple_text.rb +0 -17
- data/vendor/prawn-core/examples/text/simple_text_ttf.rb +0 -17
- data/vendor/prawn-core/examples/text/span.rb +0 -29
- data/vendor/prawn-core/examples/text/text_box.rb +0 -25
- data/vendor/prawn-core/examples/text/text_box_returning_excess.rb +0 -51
- data/vendor/prawn-core/examples/text/text_flow.rb +0 -67
- data/vendor/prawn-core/lib/prawn/byte_string.rb +0 -7
- data/vendor/prawn-core/lib/prawn/compatibility.rb +0 -38
- data/vendor/prawn-core/lib/prawn/core.rb +0 -85
- data/vendor/prawn-core/lib/prawn/document.rb +0 -534
- data/vendor/prawn-core/lib/prawn/document/annotations.rb +0 -65
- data/vendor/prawn-core/lib/prawn/document/bounding_box.rb +0 -390
- data/vendor/prawn-core/lib/prawn/document/column_box.rb +0 -102
- data/vendor/prawn-core/lib/prawn/document/destinations.rb +0 -92
- data/vendor/prawn-core/lib/prawn/document/internals.rb +0 -180
- data/vendor/prawn-core/lib/prawn/document/page_geometry.rb +0 -153
- data/vendor/prawn-core/lib/prawn/document/snapshot.rb +0 -71
- data/vendor/prawn-core/lib/prawn/document/span.rb +0 -55
- data/vendor/prawn-core/lib/prawn/document/text.rb +0 -184
- data/vendor/prawn-core/lib/prawn/document/text/box.rb +0 -90
- data/vendor/prawn-core/lib/prawn/document/text/wrapping.rb +0 -62
- data/vendor/prawn-core/lib/prawn/encoding.rb +0 -121
- data/vendor/prawn-core/lib/prawn/errors.rb +0 -61
- data/vendor/prawn-core/lib/prawn/font.rb +0 -297
- data/vendor/prawn-core/lib/prawn/font/afm.rb +0 -202
- data/vendor/prawn-core/lib/prawn/font/dfont.rb +0 -34
- data/vendor/prawn-core/lib/prawn/font/ttf.rb +0 -329
- data/vendor/prawn-core/lib/prawn/graphics.rb +0 -264
- data/vendor/prawn-core/lib/prawn/graphics/cap_style.rb +0 -35
- data/vendor/prawn-core/lib/prawn/graphics/color.rb +0 -141
- data/vendor/prawn-core/lib/prawn/graphics/dash.rb +0 -69
- data/vendor/prawn-core/lib/prawn/graphics/join_style.rb +0 -35
- data/vendor/prawn-core/lib/prawn/graphics/transparency.rb +0 -56
- data/vendor/prawn-core/lib/prawn/images.rb +0 -339
- data/vendor/prawn-core/lib/prawn/images/jpg.rb +0 -46
- data/vendor/prawn-core/lib/prawn/images/png.rb +0 -219
- data/vendor/prawn-core/lib/prawn/literal_string.rb +0 -14
- data/vendor/prawn-core/lib/prawn/measurement_extensions.rb +0 -46
- data/vendor/prawn-core/lib/prawn/measurements.rb +0 -71
- data/vendor/prawn-core/lib/prawn/name_tree.rb +0 -166
- data/vendor/prawn-core/lib/prawn/object_store.rb +0 -63
- data/vendor/prawn-core/lib/prawn/pdf_object.rb +0 -81
- data/vendor/prawn-core/lib/prawn/reference.rb +0 -72
- data/vendor/prawn-core/lib/prawn/stamp.rb +0 -87
- data/vendor/prawn-core/meta/Rakefile +0 -62
- data/vendor/prawn-core/meta/lib/prawn.rb +0 -2
- data/vendor/prawn-core/reference_pdfs/alignment.pdf +0 -229
- data/vendor/prawn-core/reference_pdfs/background.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/basic_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/bounding_boxes.pdf +0 -128
- data/vendor/prawn-core/reference_pdfs/canvas.pdf +0 -78
- data/vendor/prawn-core/reference_pdfs/chinese_flow.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/cmyk.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/column_box.pdf +0 -3671
- data/vendor/prawn-core/reference_pdfs/curves.pdf +0 -62
- data/vendor/prawn-core/reference_pdfs/dfont.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/euro.pdf +0 -75
- data/vendor/prawn-core/reference_pdfs/family_style.pdf +0 -286
- data/vendor/prawn-core/reference_pdfs/flow.pdf +0 -964
- data/vendor/prawn-core/reference_pdfs/font_calculations.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/font_size.pdf +0 -142
- data/vendor/prawn-core/reference_pdfs/hexagon.pdf +0 -61
- data/vendor/prawn-core/reference_pdfs/image-flow.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/image_fit.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/image_position.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/indentation.pdf +0 -124
- data/vendor/prawn-core/reference_pdfs/kerning.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/landscape_a4.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/landscape_legal.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/landscape_letter.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/lines.pdf +0 -116
- data/vendor/prawn-core/reference_pdfs/margin.pdf +0 -3850
- data/vendor/prawn-core/reference_pdfs/measurement_units.pdf +0 -4667
- data/vendor/prawn-core/reference_pdfs/metadata-info.pdf +0 -88
- data/vendor/prawn-core/reference_pdfs/multi-layout.pdf +0 -209
- data/vendor/prawn-core/reference_pdfs/page_with_numbering.pdf +0 -156
- data/vendor/prawn-core/reference_pdfs/png_types.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/portrait_a4.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/portrait_legal.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/portrait_letter.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/pretty_polygons.pdf +0 -122
- data/vendor/prawn-core/reference_pdfs/remote_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/ruport.pdf +0 -101
- data/vendor/prawn-core/reference_pdfs/russian_boxes.pdf +0 -2780
- data/vendor/prawn-core/reference_pdfs/simple_text.pdf +0 -136
- data/vendor/prawn-core/reference_pdfs/simple_text_ttf.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/sjis.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/span.pdf +0 -1975
- data/vendor/prawn-core/reference_pdfs/stamp.pdf +0 -696
- data/vendor/prawn-core/reference_pdfs/stretched_nesting.pdf +0 -200
- data/vendor/prawn-core/reference_pdfs/stroke_bounds.pdf +0 -135
- data/vendor/prawn-core/reference_pdfs/stroke_cap_and_join.pdf +0 -80
- data/vendor/prawn-core/reference_pdfs/stroke_dash.pdf +0 -457
- data/vendor/prawn-core/reference_pdfs/text_box.pdf +0 -315
- data/vendor/prawn-core/reference_pdfs/text_box_returning_excess.pdf +0 -271
- data/vendor/prawn-core/reference_pdfs/transparency.pdf +0 -347
- data/vendor/prawn-core/reference_pdfs/utf8.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/win-ansi.pdf +0 -6172
- data/vendor/prawn-core/spec/annotations_spec.rb +0 -90
- data/vendor/prawn-core/spec/bounding_box_spec.rb +0 -185
- data/vendor/prawn-core/spec/destinations_spec.rb +0 -15
- data/vendor/prawn-core/spec/document_spec.rb +0 -231
- data/vendor/prawn-core/spec/font_spec.rb +0 -273
- data/vendor/prawn-core/spec/graphics_spec.rb +0 -209
- data/vendor/prawn-core/spec/images_spec.rb +0 -79
- data/vendor/prawn-core/spec/jpg_spec.rb +0 -25
- data/vendor/prawn-core/spec/measurement_units_spec.rb +0 -23
- data/vendor/prawn-core/spec/name_tree_spec.rb +0 -112
- data/vendor/prawn-core/spec/object_store_spec.rb +0 -42
- data/vendor/prawn-core/spec/pdf_object_spec.rb +0 -122
- data/vendor/prawn-core/spec/png_spec.rb +0 -236
- data/vendor/prawn-core/spec/reference_spec.rb +0 -82
- data/vendor/prawn-core/spec/snapshot_spec.rb +0 -115
- data/vendor/prawn-core/spec/span_spec.rb +0 -45
- data/vendor/prawn-core/spec/spec_helper.rb +0 -20
- data/vendor/prawn-core/spec/stamp_spec.rb +0 -98
- data/vendor/prawn-core/spec/stroke_styles_spec.rb +0 -152
- data/vendor/prawn-core/spec/text_box_spec.rb +0 -109
- data/vendor/prawn-core/spec/text_spec.rb +0 -185
- data/vendor/prawn-core/spec/transparency_spec.rb +0 -61
- data/vendor/prawn-core/vendor/pdf-inspector/README +0 -18
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector.rb +0 -26
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +0 -18
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +0 -119
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/page.rb +0 -25
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/text.rb +0 -31
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +0 -19
- data/vendor/prawn-core/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/prawn-core/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
- data/vendor/prawn-core/vendor/ttfunk/example.rb +0 -45
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk.rb +0 -102
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/directory.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +0 -88
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +0 -69
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/reader.rb +0 -44
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/resource_file.rb +0 -78
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset.rb +0 -18
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/base.rb +0 -141
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +0 -46
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +0 -48
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +0 -63
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +0 -51
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset_collection.rb +0 -72
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table.rb +0 -46
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap.rb +0 -34
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +0 -54
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +0 -126
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +0 -79
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf.rb +0 -64
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +0 -81
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +0 -37
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/head.rb +0 -44
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hhea.rb +0 -41
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +0 -47
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern.rb +0 -79
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +0 -62
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/loca.rb +0 -43
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/maxp.rb +0 -40
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/name.rb +0 -119
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/os2.rb +0 -78
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post.rb +0 -91
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +0 -43
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +0 -35
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +0 -23
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/simple.rb +0 -14
- data/vendor/prawn-core/www/index.html +0 -196
- data/vendor/prawn-core/www/media/bounding_boxes.pdf +0 -146
- data/vendor/prawn-core/www/media/bounding_boxes.png +0 -0
- data/vendor/prawn-core/www/media/bounding_boxes_out.png +0 -0
- data/vendor/prawn-core/www/media/fancy_table.pdf +0 -350
- data/vendor/prawn-core/www/media/image.pdf +0 -0
- data/vendor/prawn-core/www/media/images.png +0 -0
- data/vendor/prawn-core/www/media/prawn_logo.png +0 -0
- data/vendor/prawn-core/www/media/tables.png +0 -0
- data/vendor/prawn-core/www/media/utf8.pdf +0 -0
- data/vendor/prawn-core/www/media/utf8.png +0 -0
- data/vendor/prawn-core/www/prawn-Chinese.html +0 -113
- data/vendor/prawn-core/www/prawn.css +0 -86
- data/vendor/prawn-core/www/twilight.css +0 -266
@@ -1,273 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
4
|
-
require 'iconv'
|
5
|
-
|
6
|
-
describe "Font behavior" do
|
7
|
-
|
8
|
-
it "should default to Helvetica if no font is specified" do
|
9
|
-
@pdf = Prawn::Document.new
|
10
|
-
@pdf.font.name.should == "Helvetica"
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "font style support" do
|
16
|
-
before(:each) { create_pdf }
|
17
|
-
|
18
|
-
it "should complain if there is no @current_page" do
|
19
|
-
pdf_without_page = Prawn::Document.new(:skip_page_creation => true)
|
20
|
-
|
21
|
-
lambda{ pdf_without_page.font "Helvetica" }.
|
22
|
-
should.raise(Prawn::Errors::NotOnPage)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should allow specifying font style by style name and font family" do
|
26
|
-
@pdf.font "Courier", :style => :bold
|
27
|
-
@pdf.text "In Courier bold"
|
28
|
-
|
29
|
-
@pdf.font "Courier", :style => :bold_italic
|
30
|
-
@pdf.text "In Courier bold-italic"
|
31
|
-
|
32
|
-
@pdf.font "Courier", :style => :italic
|
33
|
-
@pdf.text "In Courier italic"
|
34
|
-
|
35
|
-
@pdf.font "Courier", :style => :normal
|
36
|
-
@pdf.text "In Normal Courier"
|
37
|
-
|
38
|
-
@pdf.font "Helvetica"
|
39
|
-
@pdf.text "In Normal Helvetica"
|
40
|
-
|
41
|
-
text = PDF::Inspector::Text.analyze(@pdf.render)
|
42
|
-
text.font_settings.map { |e| e[:name] }.should ==
|
43
|
-
[:"Courier-Bold", :"Courier-BoldOblique", :"Courier-Oblique",
|
44
|
-
:Courier, :Helvetica]
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should allow font familes to be defined in a single dfont" do
|
48
|
-
file = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
|
49
|
-
@pdf.font_families["Action Man"] = {
|
50
|
-
:normal => { :file => file, :font => "ActionMan" },
|
51
|
-
:italic => { :file => file, :font => "ActionMan-Italic" },
|
52
|
-
:bold => { :file => file, :font => "ActionMan-Bold" },
|
53
|
-
:bold_italic => { :file => file, :font => "ActionMan-BoldItalic" }
|
54
|
-
}
|
55
|
-
|
56
|
-
@pdf.font "Action Man", :style => :italic
|
57
|
-
@pdf.text "In ActionMan-Italic"
|
58
|
-
|
59
|
-
text = PDF::Inspector::Text.analyze(@pdf.render)
|
60
|
-
name = text.font_settings.map { |e| e[:name] }.first.to_s
|
61
|
-
name = name.sub(/\w+\+/, "subset+")
|
62
|
-
name.should == "subset+ActionMan-Italic"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "Transactional font handling" do
|
67
|
-
before(:each) { create_pdf }
|
68
|
-
|
69
|
-
it "should allow setting of size directly when font is created" do
|
70
|
-
@pdf.font "Courier", :size => 16
|
71
|
-
@pdf.font_size.should == 16
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should allow temporary setting of a new font using a transaction" do
|
75
|
-
@pdf.font "Helvetica", :size => 12
|
76
|
-
|
77
|
-
@pdf.font "Courier", :size => 16 do
|
78
|
-
@pdf.font.name.should == "Courier"
|
79
|
-
@pdf.font_size.should == 16
|
80
|
-
end
|
81
|
-
|
82
|
-
@pdf.font.name.should == "Helvetica"
|
83
|
-
@pdf.font_size.should == 12
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should mask font size when using a transacation" do
|
87
|
-
@pdf.font "Courier", :size => 16 do
|
88
|
-
@pdf.font_size.should == 16
|
89
|
-
end
|
90
|
-
|
91
|
-
@pdf.font "Times-Roman"
|
92
|
-
@pdf.font "Courier"
|
93
|
-
|
94
|
-
@pdf.font_size.should == 12
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
describe "Document#page_fonts" do
|
100
|
-
before(:each) { create_pdf }
|
101
|
-
|
102
|
-
it "should register fonts properly by page" do
|
103
|
-
@pdf.font "Courier"; @pdf.text("hello")
|
104
|
-
@pdf.font "Helvetica"; @pdf.text("hello")
|
105
|
-
@pdf.font "Times-Roman"; @pdf.text("hello")
|
106
|
-
["Courier","Helvetica","Times-Roman"].each { |f|
|
107
|
-
page_should_include_font(f)
|
108
|
-
}
|
109
|
-
|
110
|
-
@pdf.start_new_page
|
111
|
-
@pdf.font "Helvetica"; @pdf.text("hello")
|
112
|
-
page_should_include_font("Helvetica")
|
113
|
-
page_should_not_include_font("Courier")
|
114
|
-
page_should_not_include_font("Times-Roman")
|
115
|
-
end
|
116
|
-
|
117
|
-
def page_includes_font?(font)
|
118
|
-
@pdf.page_fonts.values.map { |e| e.data[:BaseFont] }.include?(font.to_sym)
|
119
|
-
end
|
120
|
-
|
121
|
-
def page_should_include_font(font)
|
122
|
-
assert_block("Expected page to include font: #{font}") do
|
123
|
-
page_includes_font?(font)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def page_should_not_include_font(font)
|
128
|
-
assert_block("Did not expect page to include font: #{font}") do
|
129
|
-
not page_includes_font?(font)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
|
-
describe "AFM fonts" do
|
136
|
-
|
137
|
-
setup do
|
138
|
-
create_pdf
|
139
|
-
@times = @pdf.find_font "Times-Roman"
|
140
|
-
@iconv = ::Iconv.new('Windows-1252', 'utf-8')
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should calculate string width taking into account accented characters" do
|
144
|
-
@times.compute_width_of(@iconv.iconv("é"), :size => 12).should == @times.compute_width_of("e", :size => 12)
|
145
|
-
end
|
146
|
-
|
147
|
-
it "should calculate string width taking into account kerning pairs" do
|
148
|
-
@times.compute_width_of(@iconv.iconv("To"), :size => 12).should == 13.332
|
149
|
-
@times.compute_width_of(@iconv.iconv("To"), :size => 12, :kerning => true).should == 12.372
|
150
|
-
@times.compute_width_of(@iconv.iconv("Tö"), :size => 12, :kerning => true).should == 12.372
|
151
|
-
end
|
152
|
-
|
153
|
-
it "should encode text without kerning by default" do
|
154
|
-
@times.encode_text(@iconv.iconv("To")).should == [[0, "To"]]
|
155
|
-
@times.encode_text(@iconv.iconv("Télé")).should == [[0, @iconv.iconv("Télé")]]
|
156
|
-
@times.encode_text(@iconv.iconv("Technology")).should == [[0, "Technology"]]
|
157
|
-
@times.encode_text(@iconv.iconv("Technology...")).should == [[0, "Technology..."]]
|
158
|
-
end
|
159
|
-
|
160
|
-
it "should encode text with kerning if requested" do
|
161
|
-
@times.encode_text(@iconv.iconv("To"), :kerning => true).should == [[0, ["T", 80, "o"]]]
|
162
|
-
@times.encode_text(@iconv.iconv("Télé"), :kerning => true).should == [[0, ["T", 70, @iconv.iconv("élé")]]]
|
163
|
-
@times.encode_text(@iconv.iconv("Technology"), :kerning => true).should == [[0, ["T", 70, "echnology"]]]
|
164
|
-
@times.encode_text(@iconv.iconv("Technology..."), :kerning => true).should == [[0, ["T", 70, "echnology", 65, "..."]]]
|
165
|
-
end
|
166
|
-
|
167
|
-
describe "when normalizing encoding" do
|
168
|
-
|
169
|
-
it "should not modify the original string when normalize_encoding() is used" do
|
170
|
-
original = "Foo"
|
171
|
-
normalized = @times.normalize_encoding(original)
|
172
|
-
assert ! original.equal?(normalized)
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should modify the original string when normalize_encoding!() is used" do
|
176
|
-
original = "Foo"
|
177
|
-
normalized = @times.normalize_encoding!(original)
|
178
|
-
assert original.equal?(normalized)
|
179
|
-
end
|
180
|
-
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
184
|
-
|
185
|
-
describe "TTF fonts" do
|
186
|
-
|
187
|
-
setup do
|
188
|
-
create_pdf
|
189
|
-
@activa = @pdf.find_font "#{Prawn::BASEDIR}/data/fonts/Activa.ttf"
|
190
|
-
end
|
191
|
-
|
192
|
-
it "should calculate string width taking into account accented characters" do
|
193
|
-
@activa.compute_width_of("é", :size => 12).should == @activa.compute_width_of("e", :size => 12)
|
194
|
-
end
|
195
|
-
|
196
|
-
it "should calculate string width taking into account kerning pairs" do
|
197
|
-
@activa.compute_width_of("To", :size => 12).should == 15.228
|
198
|
-
@activa.compute_width_of("To", :size => 12, :kerning => true).should == 12.996
|
199
|
-
end
|
200
|
-
|
201
|
-
it "should encode text without kerning by default" do
|
202
|
-
@activa.encode_text("To").should == [[0, "To"]]
|
203
|
-
@activa.encode_text("Télé").should == [[0, "T\216l\216"]]
|
204
|
-
@activa.encode_text("Technology").should == [[0, "Technology"]]
|
205
|
-
@activa.encode_text("Technology...").should == [[0, "Technology..."]]
|
206
|
-
@activa.encode_text("Teχnology...").should == [[0, "Te"], [1, "!"], [0, "nology..."]]
|
207
|
-
end
|
208
|
-
|
209
|
-
it "should encode text with kerning if requested" do
|
210
|
-
@activa.encode_text("To", :kerning => true).should == [[0, ["T", 186.0, "o"]]]
|
211
|
-
@activa.encode_text("To", :kerning => true).should == [[0, ["T", 186.0, "o"]]]
|
212
|
-
@activa.encode_text("Technology", :kerning => true).should == [[0, ["T", 186.0, "echnology"]]]
|
213
|
-
@activa.encode_text("Technology...", :kerning => true).should == [[0, ["T", 186.0, "echnology", 88.0, "..."]]]
|
214
|
-
@activa.encode_text("Teχnology...", :kerning => true).should == [[0, ["T", 186.0, "e"]], [1, "!"], [0, ["nology", 88.0, "..."]]]
|
215
|
-
end
|
216
|
-
|
217
|
-
describe "when normalizing encoding" do
|
218
|
-
|
219
|
-
it "should not modify the original string when normalize_encoding() is used" do
|
220
|
-
original = "Foo"
|
221
|
-
normalized = @activa.normalize_encoding(original)
|
222
|
-
assert ! original.equal?(normalized)
|
223
|
-
end
|
224
|
-
|
225
|
-
it "should modify the original string when normalize_encoding!() is used" do
|
226
|
-
original = "Foo"
|
227
|
-
normalized = @activa.normalize_encoding!(original)
|
228
|
-
assert original.equal?(normalized)
|
229
|
-
end
|
230
|
-
|
231
|
-
end
|
232
|
-
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
describe "DFont fonts" do
|
237
|
-
setup do
|
238
|
-
create_pdf
|
239
|
-
@file = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
|
240
|
-
end
|
241
|
-
|
242
|
-
it "should list all named fonts" do
|
243
|
-
list = Prawn::Font::DFont.named_fonts(@file)
|
244
|
-
list.sort.should == %w(ActionMan ActionMan-Italic ActionMan-Bold ActionMan-BoldItalic).sort
|
245
|
-
end
|
246
|
-
|
247
|
-
it "should count the number of fonts in the file" do
|
248
|
-
Prawn::Font::DFont.font_count(@file).should == 4
|
249
|
-
end
|
250
|
-
|
251
|
-
it "should default selected font to the first one if not specified" do
|
252
|
-
font = @pdf.find_font(@file)
|
253
|
-
font.basename.should == "ActionMan"
|
254
|
-
end
|
255
|
-
|
256
|
-
it "should allow font to be selected by index" do
|
257
|
-
font = @pdf.find_font(@file, :font => 2)
|
258
|
-
font.basename.should == "ActionMan-Italic"
|
259
|
-
end
|
260
|
-
|
261
|
-
it "should allow font to be selected by name" do
|
262
|
-
font = @pdf.find_font(@file, :font => "ActionMan-BoldItalic")
|
263
|
-
font.basename.should == "ActionMan-BoldItalic"
|
264
|
-
end
|
265
|
-
|
266
|
-
it "should cache font object based on selected font" do
|
267
|
-
f1 = @pdf.find_font(@file, :font => "ActionMan")
|
268
|
-
f2 = @pdf.find_font(@file, :font => "ActionMan-Bold")
|
269
|
-
assert_not_equal f1.object_id, f2.object_id
|
270
|
-
assert_equal f1.object_id, @pdf.find_font(@file, :font => "ActionMan").object_id
|
271
|
-
assert_equal f2.object_id, @pdf.find_font(@file, :font => "ActionMan-Bold").object_id
|
272
|
-
end
|
273
|
-
end
|
@@ -1,209 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
4
|
-
|
5
|
-
describe "When drawing a line" do
|
6
|
-
|
7
|
-
before(:each) { create_pdf }
|
8
|
-
|
9
|
-
it "should draw a line from (100,600) to (100,500)" do
|
10
|
-
@pdf.line([100,600],[100,500])
|
11
|
-
|
12
|
-
line_drawing = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
13
|
-
|
14
|
-
line_drawing.points.should == [[100,600],[100,500]]
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should draw two lines at (100,600) to (100,500) " +
|
18
|
-
"and (75,100) to (50,125)" do
|
19
|
-
@pdf.line(100,600,100,500)
|
20
|
-
@pdf.line(75,100,50,125)
|
21
|
-
|
22
|
-
line_drawing = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
23
|
-
|
24
|
-
line_drawing.points.should ==
|
25
|
-
[[100.0, 600.0], [100.0, 500.0], [75.0, 100.0], [50.0, 125.0]]
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should properly set line width via line_width=" do
|
29
|
-
@pdf.line_width = 10
|
30
|
-
line = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
31
|
-
line.widths.first.should == 10
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should properly set line width via line_width(width)" do
|
35
|
-
@pdf.line_width(10)
|
36
|
-
line = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
37
|
-
line.widths.first.should == 10
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "(Horizontally)" do
|
41
|
-
it "should draw from [x1,pdf.y],[x2,pdf.y]" do
|
42
|
-
@pdf.horizontal_line(100,150)
|
43
|
-
@line = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
44
|
-
@line.points.should == [[100.0 + @pdf.bounds.absolute_left, @pdf.y],
|
45
|
-
[150.0 + @pdf.bounds.absolute_left, @pdf.y]]
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should draw a line from (200, 250) to (300, 250)" do
|
49
|
-
@pdf.horizontal_line(200,300,:at => 250)
|
50
|
-
line_drawing = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
51
|
-
line_drawing.points.should == [[200,250],[300,250]]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "(Vertically)" do
|
56
|
-
it "should draw a line from (350, 300) to (350, 400)" do
|
57
|
-
@pdf.vertical_line(300,400,:at => 350)
|
58
|
-
line_drawing = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
59
|
-
line_drawing.points.should == [[350,300],[350,400]]
|
60
|
-
end
|
61
|
-
it "should require a y coordinate" do
|
62
|
-
lambda { @pdf.vertical_line(400,500) }.
|
63
|
-
should.raise(ArgumentError)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "When drawing a polygon" do
|
70
|
-
|
71
|
-
before(:each) { create_pdf }
|
72
|
-
|
73
|
-
it "should draw each line passed to polygon()" do
|
74
|
-
@pdf.polygon([100,500],[100,400],[200,400])
|
75
|
-
|
76
|
-
line_drawing = PDF::Inspector::Graphics::Line.analyze(@pdf.render)
|
77
|
-
line_drawing.points.should == [[100,500],[100,400],[200,400],[100,500]]
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "When drawing a rectangle" do
|
83
|
-
|
84
|
-
before(:each) { create_pdf }
|
85
|
-
|
86
|
-
it "should use a point, width, and height for coords" do
|
87
|
-
@pdf.rectangle [200,200], 50, 100
|
88
|
-
|
89
|
-
rectangles = PDF::Inspector::Graphics::Rectangle.
|
90
|
-
analyze(@pdf.render).rectangles
|
91
|
-
# PDF uses bottom left corner
|
92
|
-
rectangles[0][:point].should == [200,100]
|
93
|
-
rectangles[0][:width].should == 50
|
94
|
-
rectangles[0][:height].should == 100
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "When drawing a curve" do
|
101
|
-
|
102
|
-
before(:each) { create_pdf }
|
103
|
-
|
104
|
-
it "should draw a bezier curve from 50,50 to 100,100" do
|
105
|
-
@pdf.move_to [50,50]
|
106
|
-
@pdf.curve_to [100,100],:bounds => [[20,90], [90,70]]
|
107
|
-
curve = PDF::Inspector::Graphics::Curve.analyze(@pdf.render)
|
108
|
-
curve.coords.should == [50.0, 50.0, 20.0, 90.0, 90.0, 70.0, 100.0, 100.0]
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should draw a bezier curve from 100,100 to 50,50" do
|
112
|
-
@pdf.curve [100,100], [50,50], :bounds => [[20,90], [90,75]]
|
113
|
-
curve = PDF::Inspector::Graphics::Curve.analyze(@pdf.render)
|
114
|
-
curve.coords.should == [100.0, 100.0, 20.0, 90.0, 90.0, 75.0, 50.0, 50.0]
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
118
|
-
|
119
|
-
describe "When drawing an ellipse" do
|
120
|
-
before(:each) do
|
121
|
-
create_pdf
|
122
|
-
@pdf.ellipse_at [100,100], 25, 50
|
123
|
-
@curve = PDF::Inspector::Graphics::Curve.analyze(@pdf.render)
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should move the pointer to the center of the ellipse after drawing" do
|
127
|
-
@curve.coords[-2..-1].should == [100,100]
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
describe "When drawing a circle" do
|
133
|
-
before(:each) do
|
134
|
-
create_pdf
|
135
|
-
@pdf.circle_at [100,100], :radius => 25
|
136
|
-
@pdf.ellipse_at [100,100], 25, 25
|
137
|
-
@curve = PDF::Inspector::Graphics::Curve.analyze(@pdf.render)
|
138
|
-
end
|
139
|
-
|
140
|
-
it "should stroke the same path as the equivalent ellipse" do
|
141
|
-
middle = @curve.coords.length / 2
|
142
|
-
@curve.coords[0...middle].should == @curve.coords[middle..-1]
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
describe "When setting colors" do
|
147
|
-
|
148
|
-
before(:each) { create_pdf }
|
149
|
-
|
150
|
-
it "should set stroke colors" do
|
151
|
-
@pdf.stroke_color "ffcccc"
|
152
|
-
colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
|
153
|
-
# 100% red, 80% green, 80% blue
|
154
|
-
colors.stroke_color.should == [1.0, 0.8, 0.8]
|
155
|
-
end
|
156
|
-
|
157
|
-
it "should set fill colors" do
|
158
|
-
@pdf.fill_color "ccff00"
|
159
|
-
colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
|
160
|
-
# 80% red, 100% green, 0% blue
|
161
|
-
colors.fill_color.should == [0.8,1.0,0]
|
162
|
-
end
|
163
|
-
|
164
|
-
it "should reset the colors on each new page if they have been defined" do
|
165
|
-
@pdf.fill_color "ccff00"
|
166
|
-
colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
|
167
|
-
|
168
|
-
colors.fill_color_count.should == 2
|
169
|
-
colors.stroke_color_count.should == 1
|
170
|
-
@pdf.start_new_page
|
171
|
-
@pdf.stroke_color "ff00cc"
|
172
|
-
|
173
|
-
colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
|
174
|
-
colors.fill_color_count.should == 3
|
175
|
-
colors.stroke_color_count.should == 3
|
176
|
-
|
177
|
-
@pdf.start_new_page
|
178
|
-
colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
|
179
|
-
colors.fill_color_count.should == 4
|
180
|
-
colors.stroke_color_count.should == 4
|
181
|
-
|
182
|
-
colors.fill_color.should == [0.8,1.0,0.0]
|
183
|
-
colors.stroke_color.should == [1.0,0.0,0.8]
|
184
|
-
end
|
185
|
-
|
186
|
-
end
|
187
|
-
|
188
|
-
describe "When using painting shortcuts" do
|
189
|
-
before(:each) { create_pdf }
|
190
|
-
|
191
|
-
it "should convert stroke_some_method(args) into some_method(args); stroke" do
|
192
|
-
@pdf.expects(:line_to).with([100,100])
|
193
|
-
@pdf.expects(:stroke)
|
194
|
-
|
195
|
-
@pdf.stroke_line_to [100,100]
|
196
|
-
end
|
197
|
-
|
198
|
-
it "should convert fill_some_method(args) into some_method(args); fill" do
|
199
|
-
@pdf.expects(:line_to).with([100,100])
|
200
|
-
@pdf.expects(:fill)
|
201
|
-
|
202
|
-
@pdf.fill_line_to [100,100]
|
203
|
-
end
|
204
|
-
|
205
|
-
it "should not break method_missing" do
|
206
|
-
lambda { @pdf.i_have_a_pretty_girlfriend_named_jia }.
|
207
|
-
should.raise(NoMethodError)
|
208
|
-
end
|
209
|
-
end
|