prawn-layout 0.2.1 → 0.3.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/Rakefile +1 -1
- data/examples/example_helper.rb +5 -1
- data/examples/grid/bounding_boxes.rb +21 -0
- data/examples/grid/column_gutter_grid.rb +20 -0
- data/examples/grid/multi_boxes.rb +51 -0
- data/examples/grid/show_grid.rb +13 -0
- data/lib/prawn/layout.rb +1 -1
- data/lib/prawn/layout/grid.rb +36 -18
- data/lib/prawn/table.rb +20 -8
- data/lib/prawn/table/cell.rb +24 -15
- data/spec/spec_helper.rb +2 -1
- data/spec/table_spec.rb +32 -0
- data/vendor/prawn-core/COPYING +340 -0
- data/vendor/prawn-core/HACKING +46 -0
- data/vendor/prawn-core/LICENSE +56 -0
- data/vendor/prawn-core/README +142 -0
- data/vendor/prawn-core/Rakefile +75 -0
- data/vendor/prawn-core/bench/afm_text_bench.rb +18 -0
- data/vendor/prawn-core/bench/png_type_6.rb +15 -0
- data/vendor/prawn-core/bench/ttf_text_bench.rb +19 -0
- data/vendor/prawn-core/bugs/canvas_sets_y_to_0.rb +15 -0
- data/vendor/prawn-core/bugs/png_barcode_issue.rb +11 -0
- data/vendor/prawn-core/bugs/resolved/canvas_sets_y_to_0.rb +15 -0
- data/vendor/prawn-core/data/encodings/win_ansi.txt +29 -0
- 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 +342 -0
- data/vendor/prawn-core/data/fonts/Courier-BoldOblique.afm +342 -0
- data/vendor/prawn-core/data/fonts/Courier-Oblique.afm +342 -0
- data/vendor/prawn-core/data/fonts/Courier.afm +342 -0
- 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 +2827 -0
- data/vendor/prawn-core/data/fonts/Helvetica-BoldOblique.afm +2827 -0
- data/vendor/prawn-core/data/fonts/Helvetica-Oblique.afm +3051 -0
- data/vendor/prawn-core/data/fonts/Helvetica.afm +3051 -0
- data/vendor/prawn-core/data/fonts/MustRead.html +19 -0
- data/vendor/prawn-core/data/fonts/Symbol.afm +213 -0
- data/vendor/prawn-core/data/fonts/Times-Bold.afm +2588 -0
- data/vendor/prawn-core/data/fonts/Times-BoldItalic.afm +2384 -0
- data/vendor/prawn-core/data/fonts/Times-Italic.afm +2667 -0
- data/vendor/prawn-core/data/fonts/Times-Roman.afm +2419 -0
- data/vendor/prawn-core/data/fonts/ZapfDingbats.afm +225 -0
- 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 +1 -0
- data/vendor/prawn-core/data/images/web-links.png +0 -0
- data/vendor/prawn-core/data/shift_jis_text.txt +1 -0
- data/vendor/prawn-core/examples/bounding_box/bounding_boxes.rb +43 -0
- data/vendor/prawn-core/examples/bounding_box/indentation.rb +34 -0
- data/vendor/prawn-core/examples/bounding_box/russian_boxes.rb +36 -0
- data/vendor/prawn-core/examples/bounding_box/stretched_nesting.rb +67 -0
- data/vendor/prawn-core/examples/column_box/column_box_example.rb +43 -0
- data/vendor/prawn-core/examples/example_helper.rb +3 -0
- data/vendor/prawn-core/examples/general/background.rb +23 -0
- data/vendor/prawn-core/examples/general/canvas.rb +15 -0
- data/vendor/prawn-core/examples/general/margin.rb +36 -0
- data/vendor/prawn-core/examples/general/measurement_units.rb +51 -0
- data/vendor/prawn-core/examples/general/metadata-info.rb +16 -0
- data/vendor/prawn-core/examples/general/multi_page_layout.rb +18 -0
- data/vendor/prawn-core/examples/general/page_geometry.rb +31 -0
- data/vendor/prawn-core/examples/general/page_numbering.rb +15 -0
- data/vendor/prawn-core/examples/general/stamp.rb +45 -0
- data/vendor/prawn-core/examples/graphics/basic_images.rb +23 -0
- data/vendor/prawn-core/examples/graphics/cmyk.rb +12 -0
- data/vendor/prawn-core/examples/graphics/curves.rb +11 -0
- data/vendor/prawn-core/examples/graphics/hexagon.rb +13 -0
- data/vendor/prawn-core/examples/graphics/image_fit.rb +15 -0
- data/vendor/prawn-core/examples/graphics/image_flow.rb +37 -0
- data/vendor/prawn-core/examples/graphics/image_position.rb +17 -0
- data/vendor/prawn-core/examples/graphics/line.rb +32 -0
- data/vendor/prawn-core/examples/graphics/png_types.rb +22 -0
- data/vendor/prawn-core/examples/graphics/polygons.rb +16 -0
- data/vendor/prawn-core/examples/graphics/remote_images.rb +12 -0
- data/vendor/prawn-core/examples/graphics/ruport_style_helpers.rb +19 -0
- data/vendor/prawn-core/examples/graphics/stroke_bounds.rb +20 -0
- data/vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb +45 -0
- data/vendor/prawn-core/examples/graphics/stroke_dash.rb +42 -0
- data/vendor/prawn-core/examples/graphics/transparency.rb +26 -0
- data/vendor/prawn-core/examples/m17n/chinese_text_wrapping.rb +19 -0
- data/vendor/prawn-core/examples/m17n/euro.rb +15 -0
- data/vendor/prawn-core/examples/m17n/sjis.rb +28 -0
- data/vendor/prawn-core/examples/m17n/utf8.rb +13 -0
- data/vendor/prawn-core/examples/m17n/win_ansi_charset.rb +54 -0
- data/vendor/prawn-core/examples/text/alignment.rb +18 -0
- data/vendor/prawn-core/examples/text/dfont.rb +48 -0
- data/vendor/prawn-core/examples/text/family_based_styling.rb +24 -0
- data/vendor/prawn-core/examples/text/font_calculations.rb +91 -0
- data/vendor/prawn-core/examples/text/font_size.rb +33 -0
- data/vendor/prawn-core/examples/text/kerning.rb +30 -0
- data/vendor/prawn-core/examples/text/simple_text.rb +17 -0
- data/vendor/prawn-core/examples/text/simple_text_ttf.rb +17 -0
- data/vendor/prawn-core/examples/text/span.rb +29 -0
- data/vendor/prawn-core/examples/text/text_box.rb +25 -0
- data/vendor/prawn-core/examples/text/text_box_returning_excess.rb +51 -0
- data/vendor/prawn-core/examples/text/text_flow.rb +67 -0
- data/vendor/prawn-core/lib/prawn/byte_string.rb +7 -0
- data/vendor/prawn-core/lib/prawn/compatibility.rb +38 -0
- data/vendor/prawn-core/lib/prawn/core.rb +85 -0
- data/vendor/prawn-core/lib/prawn/document.rb +534 -0
- data/vendor/prawn-core/lib/prawn/document/annotations.rb +65 -0
- data/vendor/prawn-core/lib/prawn/document/bounding_box.rb +390 -0
- data/vendor/prawn-core/lib/prawn/document/column_box.rb +102 -0
- data/vendor/prawn-core/lib/prawn/document/destinations.rb +92 -0
- data/vendor/prawn-core/lib/prawn/document/internals.rb +180 -0
- data/vendor/prawn-core/lib/prawn/document/page_geometry.rb +153 -0
- data/vendor/prawn-core/lib/prawn/document/snapshot.rb +71 -0
- data/vendor/prawn-core/lib/prawn/document/span.rb +55 -0
- data/vendor/prawn-core/lib/prawn/document/text.rb +184 -0
- data/vendor/prawn-core/lib/prawn/document/text/box.rb +90 -0
- data/vendor/prawn-core/lib/prawn/document/text/wrapping.rb +62 -0
- data/vendor/prawn-core/lib/prawn/encoding.rb +121 -0
- data/vendor/prawn-core/lib/prawn/errors.rb +61 -0
- data/vendor/prawn-core/lib/prawn/font.rb +297 -0
- data/vendor/prawn-core/lib/prawn/font/afm.rb +202 -0
- data/vendor/prawn-core/lib/prawn/font/dfont.rb +34 -0
- data/vendor/prawn-core/lib/prawn/font/ttf.rb +329 -0
- data/vendor/prawn-core/lib/prawn/graphics.rb +264 -0
- data/vendor/prawn-core/lib/prawn/graphics/cap_style.rb +35 -0
- data/vendor/prawn-core/lib/prawn/graphics/color.rb +141 -0
- data/vendor/prawn-core/lib/prawn/graphics/dash.rb +69 -0
- data/vendor/prawn-core/lib/prawn/graphics/join_style.rb +35 -0
- data/vendor/prawn-core/lib/prawn/graphics/transparency.rb +56 -0
- data/vendor/prawn-core/lib/prawn/images.rb +339 -0
- data/vendor/prawn-core/lib/prawn/images/jpg.rb +46 -0
- data/vendor/prawn-core/lib/prawn/images/png.rb +219 -0
- data/vendor/prawn-core/lib/prawn/literal_string.rb +14 -0
- data/vendor/prawn-core/lib/prawn/measurement_extensions.rb +46 -0
- data/vendor/prawn-core/lib/prawn/measurements.rb +71 -0
- data/vendor/prawn-core/lib/prawn/name_tree.rb +166 -0
- data/vendor/prawn-core/lib/prawn/object_store.rb +63 -0
- data/vendor/prawn-core/lib/prawn/pdf_object.rb +81 -0
- data/vendor/prawn-core/lib/prawn/reference.rb +72 -0
- data/vendor/prawn-core/lib/prawn/stamp.rb +87 -0
- data/vendor/prawn-core/meta/Rakefile +62 -0
- data/vendor/prawn-core/meta/lib/prawn.rb +2 -0
- data/vendor/prawn-core/reference_pdfs/alignment.pdf +229 -0
- 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 +128 -0
- data/vendor/prawn-core/reference_pdfs/canvas.pdf +78 -0
- 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 +3671 -0
- data/vendor/prawn-core/reference_pdfs/curves.pdf +62 -0
- data/vendor/prawn-core/reference_pdfs/dfont.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/euro.pdf +75 -0
- data/vendor/prawn-core/reference_pdfs/family_style.pdf +286 -0
- data/vendor/prawn-core/reference_pdfs/flow.pdf +964 -0
- data/vendor/prawn-core/reference_pdfs/font_calculations.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/font_size.pdf +142 -0
- data/vendor/prawn-core/reference_pdfs/hexagon.pdf +61 -0
- 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 +124 -0
- data/vendor/prawn-core/reference_pdfs/kerning.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/landscape_a4.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/landscape_legal.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/landscape_letter.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/lines.pdf +116 -0
- data/vendor/prawn-core/reference_pdfs/margin.pdf +3850 -0
- data/vendor/prawn-core/reference_pdfs/measurement_units.pdf +4667 -0
- data/vendor/prawn-core/reference_pdfs/metadata-info.pdf +88 -0
- data/vendor/prawn-core/reference_pdfs/multi-layout.pdf +209 -0
- data/vendor/prawn-core/reference_pdfs/page_with_numbering.pdf +156 -0
- data/vendor/prawn-core/reference_pdfs/png_types.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/portrait_a4.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/portrait_legal.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/portrait_letter.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/pretty_polygons.pdf +122 -0
- data/vendor/prawn-core/reference_pdfs/remote_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/ruport.pdf +101 -0
- data/vendor/prawn-core/reference_pdfs/russian_boxes.pdf +2780 -0
- data/vendor/prawn-core/reference_pdfs/simple_text.pdf +136 -0
- 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 +1975 -0
- data/vendor/prawn-core/reference_pdfs/stamp.pdf +696 -0
- data/vendor/prawn-core/reference_pdfs/stretched_nesting.pdf +200 -0
- data/vendor/prawn-core/reference_pdfs/stroke_bounds.pdf +135 -0
- data/vendor/prawn-core/reference_pdfs/stroke_cap_and_join.pdf +80 -0
- data/vendor/prawn-core/reference_pdfs/stroke_dash.pdf +457 -0
- data/vendor/prawn-core/reference_pdfs/text_box.pdf +315 -0
- data/vendor/prawn-core/reference_pdfs/text_box_returning_excess.pdf +271 -0
- data/vendor/prawn-core/reference_pdfs/transparency.pdf +347 -0
- data/vendor/prawn-core/reference_pdfs/utf8.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/win-ansi.pdf +6172 -0
- data/vendor/prawn-core/spec/annotations_spec.rb +90 -0
- data/vendor/prawn-core/spec/bounding_box_spec.rb +185 -0
- data/vendor/prawn-core/spec/destinations_spec.rb +15 -0
- data/vendor/prawn-core/spec/document_spec.rb +231 -0
- data/vendor/prawn-core/spec/font_spec.rb +273 -0
- data/vendor/prawn-core/spec/graphics_spec.rb +209 -0
- data/vendor/prawn-core/spec/images_spec.rb +79 -0
- data/vendor/prawn-core/spec/jpg_spec.rb +25 -0
- data/vendor/prawn-core/spec/measurement_units_spec.rb +23 -0
- data/vendor/prawn-core/spec/name_tree_spec.rb +112 -0
- data/vendor/prawn-core/spec/object_store_spec.rb +42 -0
- data/vendor/prawn-core/spec/pdf_object_spec.rb +122 -0
- data/vendor/prawn-core/spec/png_spec.rb +236 -0
- data/vendor/prawn-core/spec/reference_spec.rb +82 -0
- data/vendor/prawn-core/spec/snapshot_spec.rb +115 -0
- data/vendor/prawn-core/spec/span_spec.rb +45 -0
- data/vendor/prawn-core/spec/spec_helper.rb +20 -0
- data/vendor/prawn-core/spec/stamp_spec.rb +98 -0
- data/vendor/prawn-core/spec/stroke_styles_spec.rb +152 -0
- data/vendor/prawn-core/spec/text_box_spec.rb +109 -0
- data/vendor/prawn-core/spec/text_spec.rb +185 -0
- data/vendor/prawn-core/spec/transparency_spec.rb +61 -0
- data/vendor/prawn-core/vendor/pdf-inspector/README +18 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector.rb +26 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +18 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +119 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/page.rb +25 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/text.rb +31 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +19 -0
- 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 +45 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk.rb +102 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/directory.rb +17 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +88 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +69 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/reader.rb +44 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/resource_file.rb +78 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset.rb +18 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/base.rb +141 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +46 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +48 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +63 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +51 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset_collection.rb +72 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table.rb +46 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap.rb +34 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +54 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +126 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +79 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf.rb +64 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +81 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +37 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/head.rb +44 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hhea.rb +41 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +47 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern.rb +79 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +62 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/loca.rb +43 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/maxp.rb +40 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/name.rb +119 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/os2.rb +78 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post.rb +91 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +43 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +35 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +23 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +17 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +17 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/simple.rb +14 -0
- data/vendor/prawn-core/www/index.html +196 -0
- data/vendor/prawn-core/www/media/bounding_boxes.pdf +146 -0
- 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 +350 -0
- 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 +113 -0
- data/vendor/prawn-core/www/prawn.css +86 -0
- data/vendor/prawn-core/www/twilight.css +266 -0
- metadata +291 -3
|
@@ -0,0 +1,273 @@
|
|
|
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
|
|
@@ -0,0 +1,209 @@
|
|
|
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
|