prawn-layout 0.3.2 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,121 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Copyright September 2008, Gregory Brown, James Healy All Rights Reserved.
|
4
|
-
#
|
5
|
-
# This is free software. Please see the LICENSE and COPYING files for details.
|
6
|
-
#
|
7
|
-
module Prawn
|
8
|
-
module Encoding
|
9
|
-
# Map between unicode and WinAnsiEnoding
|
10
|
-
#
|
11
|
-
class WinAnsi #:nodoc:
|
12
|
-
CHARACTERS = %w[
|
13
|
-
.notdef .notdef .notdef .notdef
|
14
|
-
.notdef .notdef .notdef .notdef
|
15
|
-
.notdef .notdef .notdef .notdef
|
16
|
-
.notdef .notdef .notdef .notdef
|
17
|
-
.notdef .notdef .notdef .notdef
|
18
|
-
.notdef .notdef .notdef .notdef
|
19
|
-
.notdef .notdef .notdef .notdef
|
20
|
-
.notdef .notdef .notdef .notdef
|
21
|
-
|
22
|
-
space exclam quotedbl numbersign
|
23
|
-
dollar percent ampersand quotesingle
|
24
|
-
parenleft parenright asterisk plus
|
25
|
-
comma hyphen period slash
|
26
|
-
zero one two three
|
27
|
-
four five six seven
|
28
|
-
eight nine colon semicolon
|
29
|
-
less equal greater question
|
30
|
-
|
31
|
-
at A B C
|
32
|
-
D E F G
|
33
|
-
H I J K
|
34
|
-
L M N O
|
35
|
-
P Q R S
|
36
|
-
T U V W
|
37
|
-
X Y Z bracketleft
|
38
|
-
backslash bracketright asciicircum underscore
|
39
|
-
|
40
|
-
grave a b c
|
41
|
-
d e f g
|
42
|
-
h i j k
|
43
|
-
l m n o
|
44
|
-
p q r s
|
45
|
-
t u v w
|
46
|
-
x y z braceleft
|
47
|
-
bar braceright asciitilde .notdef
|
48
|
-
|
49
|
-
Euro .notdef quotesinglbase florin
|
50
|
-
quotedblbase ellipsis dagger daggerdbl
|
51
|
-
circumflex perthousand Scaron guilsinglleft
|
52
|
-
OE .notdef Zcaron .notdef
|
53
|
-
.notdef quoteleft quoteright quotedblleft
|
54
|
-
quotedblright bullet endash emdash
|
55
|
-
tilde trademark scaron guilsinglright
|
56
|
-
oe .notdef zcaron ydieresis
|
57
|
-
|
58
|
-
space exclamdown cent sterling
|
59
|
-
currency yen brokenbar section
|
60
|
-
dieresis copyright ordfeminine guillemotleft
|
61
|
-
logicalnot hyphen registered macron
|
62
|
-
degree plusminus twosuperior threesuperior
|
63
|
-
acute mu paragraph periodcentered
|
64
|
-
cedilla onesuperior ordmasculine guillemotright
|
65
|
-
onequarter onehalf threequarters questiondown
|
66
|
-
|
67
|
-
Agrave Aacute Acircumflex Atilde
|
68
|
-
Adieresis Aring AE Ccedilla
|
69
|
-
Egrave Eacute Ecircumflex Edieresis
|
70
|
-
Igrave Iacute Icircumflex Idieresis
|
71
|
-
Eth Ntilde Ograve Oacute
|
72
|
-
Ocircumflex Otilde Odieresis multiply
|
73
|
-
Oslash Ugrave Uacute Ucircumflex
|
74
|
-
Udieresis Yacute Thorn germandbls
|
75
|
-
|
76
|
-
agrave aacute acircumflex atilde
|
77
|
-
adieresis aring ae ccedilla
|
78
|
-
egrave eacute ecircumflex edieresis
|
79
|
-
igrave iacute icircumflex idieresis
|
80
|
-
eth ntilde ograve oacute
|
81
|
-
ocircumflex otilde odieresis divide
|
82
|
-
oslash ugrave uacute ucircumflex
|
83
|
-
udieresis yacute thorn ydieresis
|
84
|
-
]
|
85
|
-
|
86
|
-
def initialize
|
87
|
-
@mapping_file = "#{Prawn::BASEDIR}/data/encodings/win_ansi.txt"
|
88
|
-
load_mapping if self.class.mapping.empty?
|
89
|
-
end
|
90
|
-
|
91
|
-
# Converts a Unicode codepoint into a valid WinAnsi single byte character.
|
92
|
-
#
|
93
|
-
# If there is no WinAnsi equivlant for a character, a _ will be substituted.
|
94
|
-
#
|
95
|
-
def [](codepoint)
|
96
|
-
# unicode codepoints < 255 map directly to the single byte value in WinAnsi
|
97
|
-
return codepoint if codepoint <= 255
|
98
|
-
|
99
|
-
# There are a handful of codepoints > 255 that have equivilants in WinAnsi.
|
100
|
-
# Replace anything else with an underscore
|
101
|
-
self.class.mapping[codepoint] || 95
|
102
|
-
end
|
103
|
-
|
104
|
-
def self.mapping
|
105
|
-
@mapping ||= {}
|
106
|
-
end
|
107
|
-
|
108
|
-
private
|
109
|
-
|
110
|
-
def load_mapping
|
111
|
-
RUBY_VERSION >= "1.9" ? mode = "r:BINARY" : mode = "r"
|
112
|
-
File.open(@mapping_file, mode) do |f|
|
113
|
-
f.each do |l|
|
114
|
-
m, single_byte, unicode = *l.match(/([0-9A-Za-z]+);([0-9A-F]{4})/)
|
115
|
-
self.class.mapping["0x#{unicode}".hex] = "0x#{single_byte}".hex if single_byte
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# errors.rb : Implements custom error classes for Prawn
|
4
|
-
#
|
5
|
-
# Copyright April 2008, Gregory Brown. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# This is free software. Please see the LICENSE and COPYING files for details.
|
8
|
-
#
|
9
|
-
module Prawn
|
10
|
-
module Errors
|
11
|
-
|
12
|
-
# This error is raised when Prawn::PdfObject() encounters a Ruby object it
|
13
|
-
# cannot convert to PDF
|
14
|
-
#
|
15
|
-
FailedObjectConversion = Class.new(StandardError)
|
16
|
-
|
17
|
-
# This error is raised when Document#page_layout is set to anything
|
18
|
-
# other than :portrait or :landscape
|
19
|
-
#
|
20
|
-
InvalidPageLayout = Class.new(StandardError)
|
21
|
-
|
22
|
-
# This error is raised when a method requiring a current page is called
|
23
|
-
# without being on a page.
|
24
|
-
#
|
25
|
-
NotOnPage = Class.new(StandardError)
|
26
|
-
|
27
|
-
# This error is raised when Prawn cannot find a specified font
|
28
|
-
#
|
29
|
-
UnknownFont = Class.new(StandardError)
|
30
|
-
|
31
|
-
# This error is raised when Prawn is being used on a M17N aware VM,
|
32
|
-
# and the user attempts to add text that isn't compatible with UTF-8
|
33
|
-
# to their document
|
34
|
-
#
|
35
|
-
IncompatibleStringEncoding = Class.new(StandardError)
|
36
|
-
|
37
|
-
# This error is raised when Prawn encounters an unknown key in functions
|
38
|
-
# that accept an options hash. This usually means there is a typo in your
|
39
|
-
# code or that the option you are trying to use has a different name than
|
40
|
-
# what you have specified.
|
41
|
-
#
|
42
|
-
UnknownOption = Class.new(StandardError)
|
43
|
-
|
44
|
-
# this error is raised when a user attempts to embed an image of an unsupported
|
45
|
-
# type. This can either a completely unsupported format, or a dialect of a
|
46
|
-
# supported format (ie. some types of PNG)
|
47
|
-
UnsupportedImageType = Class.new(StandardError)
|
48
|
-
|
49
|
-
# This error is raised when a named element has alredy been
|
50
|
-
# created. For example, in the stamp module, stamps must have
|
51
|
-
# unique names within a document
|
52
|
-
NameTaken = Class.new(StandardError)
|
53
|
-
|
54
|
-
# This error is raised when a name is not a valid format
|
55
|
-
InvalidName = Class.new(StandardError)
|
56
|
-
|
57
|
-
# This error is raised when an object is attempted to be
|
58
|
-
# referenced by name, but no such name is associated with an object
|
59
|
-
UndefinedObjectName = Class.new(StandardError)
|
60
|
-
end
|
61
|
-
end
|
@@ -1,297 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# font.rb : The Prawn font class
|
4
|
-
#
|
5
|
-
# Copyright May 2008, Gregory Brown / James Healy. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# This is free software. Please see the LICENSE and COPYING files for details.
|
8
|
-
require "prawn/font/afm"
|
9
|
-
require "prawn/font/ttf"
|
10
|
-
require "prawn/font/dfont"
|
11
|
-
|
12
|
-
module Prawn
|
13
|
-
|
14
|
-
class Document
|
15
|
-
# Without arguments, this returns the currently selected font. Otherwise,
|
16
|
-
# it sets the current font.
|
17
|
-
#
|
18
|
-
# The single parameter must be a string. It can be one of the 14 built-in
|
19
|
-
# fonts supported by PDF, or the location of a TTF file. The Font::AFM::BUILT_INS
|
20
|
-
# array specifies the valid built in font values.
|
21
|
-
#
|
22
|
-
# pdf.font "Times-Roman"
|
23
|
-
# pdf.font "Chalkboard.ttf"
|
24
|
-
#
|
25
|
-
# If a ttf font is specified, the glyphs necessary to render your document
|
26
|
-
# will be embedded in the rendered PDF. This should be your preferred option
|
27
|
-
# in most cases. It will increase the size of the resulting file, but also
|
28
|
-
# make it more portable.
|
29
|
-
#
|
30
|
-
def font(name=nil, options={})
|
31
|
-
return((defined?(@font) && @font) || font("Helvetica")) if name.nil?
|
32
|
-
|
33
|
-
raise Errors::NotOnPage unless defined?(@current_page) && @current_page
|
34
|
-
new_font = find_font(name, options)
|
35
|
-
|
36
|
-
if block_given?
|
37
|
-
save_font do
|
38
|
-
set_font(new_font, options[:size])
|
39
|
-
yield
|
40
|
-
end
|
41
|
-
else
|
42
|
-
set_font(new_font, options[:size])
|
43
|
-
end
|
44
|
-
|
45
|
-
@font
|
46
|
-
end
|
47
|
-
|
48
|
-
# When called with no argument, returns the current font size.
|
49
|
-
# When called with a single argument but no block, sets the current font
|
50
|
-
# size. When a block is used, the font size is applied transactionally and
|
51
|
-
# is rolled back when the block exits. You may still change the font size
|
52
|
-
# within a transactional block for individual text segments, or nested calls
|
53
|
-
# to font_size.
|
54
|
-
#
|
55
|
-
# Prawn::Document.generate("font_size.pdf") do
|
56
|
-
# font_size 16
|
57
|
-
# text "At size 16"
|
58
|
-
#
|
59
|
-
# font_size(10) do
|
60
|
-
# text "At size 10"
|
61
|
-
# text "At size 6", :size => 6
|
62
|
-
# text "At size 10"
|
63
|
-
# end
|
64
|
-
#
|
65
|
-
# text "At size 16"
|
66
|
-
# end
|
67
|
-
#
|
68
|
-
# When called without an argument, this method returns the current font
|
69
|
-
# size.
|
70
|
-
#
|
71
|
-
def font_size(points=nil)
|
72
|
-
return @font_size unless points
|
73
|
-
size_before_yield = @font_size
|
74
|
-
@font_size = points
|
75
|
-
block_given? ? yield : return
|
76
|
-
@font_size = size_before_yield
|
77
|
-
end
|
78
|
-
|
79
|
-
# Sets the font directly, given an actual Font object
|
80
|
-
# and size.
|
81
|
-
#
|
82
|
-
def set_font(font, size=nil) # :nodoc:
|
83
|
-
@font = font
|
84
|
-
@font_size = size if size
|
85
|
-
end
|
86
|
-
|
87
|
-
# Saves the current font, and then yields. When the block
|
88
|
-
# finishes, the original font is restored.
|
89
|
-
#
|
90
|
-
def save_font
|
91
|
-
@font ||= find_font("Helvetica")
|
92
|
-
original_font = @font
|
93
|
-
original_size = @font_size
|
94
|
-
|
95
|
-
yield
|
96
|
-
ensure
|
97
|
-
set_font(original_font, original_size) if original_font
|
98
|
-
end
|
99
|
-
|
100
|
-
# Looks up the given font using the given criteria. Once a font has been
|
101
|
-
# found by that matches the criteria, it will be cached to subsequent lookups
|
102
|
-
# for that font will return the same object.
|
103
|
-
#--
|
104
|
-
# Challenges involved: the name alone is not sufficient to uniquely identify
|
105
|
-
# a font (think dfont suitcases that can hold multiple different fonts in a
|
106
|
-
# single file). Thus, the :name key is included in the cache key.
|
107
|
-
#
|
108
|
-
# It is further complicated, however, since fonts in some formats (like the
|
109
|
-
# dfont suitcases) can be identified either by numeric index, OR by their
|
110
|
-
# name within the suitcase, and both should hash to the same font object
|
111
|
-
# (to avoid the font being embedded multiple times). This is not yet implemented,
|
112
|
-
# which means if someone selects a font both by name, and by index, the
|
113
|
-
# font will be embedded twice. Since we do font subsetting, this double
|
114
|
-
# embedding won't be catastrophic, just annoying.
|
115
|
-
# ++
|
116
|
-
#
|
117
|
-
def find_font(name, options={}) #:nodoc:
|
118
|
-
if font_families.key?(name)
|
119
|
-
family, name = name, font_families[name][options[:style] || :normal]
|
120
|
-
|
121
|
-
if name.is_a?(Hash)
|
122
|
-
options = options.merge(name)
|
123
|
-
name = options[:file]
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
key = "#{name}:#{options[:font] || 0}"
|
128
|
-
font_registry[key] ||= Font.load(self, name, options.merge(:family => family))
|
129
|
-
end
|
130
|
-
|
131
|
-
# Hash of Font objects keyed by names
|
132
|
-
#
|
133
|
-
def font_registry #:nodoc:
|
134
|
-
@font_registry ||= {}
|
135
|
-
end
|
136
|
-
|
137
|
-
# Hash that maps font family names to their styled individual font names
|
138
|
-
#
|
139
|
-
# To add support for another font family, append to this hash, e.g:
|
140
|
-
#
|
141
|
-
# pdf.font_families.update(
|
142
|
-
# "MyTrueTypeFamily" => { :bold => "foo-bold.ttf",
|
143
|
-
# :italic => "foo-italic.ttf",
|
144
|
-
# :bold_italic => "foo-bold-italic.ttf",
|
145
|
-
# :normal => "foo.ttf" })
|
146
|
-
#
|
147
|
-
# This will then allow you to use the fonts like so:
|
148
|
-
#
|
149
|
-
# pdf.font("MyTrueTypeFamily", :style => :bold)
|
150
|
-
# pdf.text "Some bold text"
|
151
|
-
# pdf.font("MyTrueTypeFamily")
|
152
|
-
# pdf.text "Some normal text"
|
153
|
-
#
|
154
|
-
# This assumes that you have appropriate TTF fonts for each style you
|
155
|
-
# wish to support.
|
156
|
-
#
|
157
|
-
def font_families
|
158
|
-
@font_families ||= Hash.new { |h,k| h[k] = {} }.merge!(
|
159
|
-
{ "Courier" => { :bold => "Courier-Bold",
|
160
|
-
:italic => "Courier-Oblique",
|
161
|
-
:bold_italic => "Courier-BoldOblique",
|
162
|
-
:normal => "Courier" },
|
163
|
-
|
164
|
-
"Times-Roman" => { :bold => "Times-Bold",
|
165
|
-
:italic => "Times-Italic",
|
166
|
-
:bold_italic => "Times-BoldItalic",
|
167
|
-
:normal => "Times-Roman" },
|
168
|
-
|
169
|
-
"Helvetica" => { :bold => "Helvetica-Bold",
|
170
|
-
:italic => "Helvetica-Oblique",
|
171
|
-
:bold_italic => "Helvetica-BoldOblique",
|
172
|
-
:normal => "Helvetica" }
|
173
|
-
})
|
174
|
-
end
|
175
|
-
|
176
|
-
# Returns the width of the given string using the given font. If :size is not
|
177
|
-
# specified as one of the options, the string is measured using the current
|
178
|
-
# font size. You can also pass :kerning as an option to indicate whether
|
179
|
-
# kerning should be used when measuring the width (defaults to +false+).
|
180
|
-
#
|
181
|
-
# Note that the string _must_ be encoded properly for the font being used.
|
182
|
-
# For AFM fonts, this is WinAnsi. For TTF, make sure the font is encoded as
|
183
|
-
# UTF-8. You can use the Font#normalize_encoding method to make sure strings
|
184
|
-
# are in an encoding appropriate for the current font.
|
185
|
-
#--
|
186
|
-
# For the record, this method used to be a method of Font (and still delegates
|
187
|
-
# to width computations on Font). However, having the primary interface for
|
188
|
-
# calculating string widths exist on Font made it tricky to write extensions
|
189
|
-
# for Prawn in which widths are computed differently (e.g., taking formatting
|
190
|
-
# tags into account, or the like).
|
191
|
-
#
|
192
|
-
# By putting width_of here, on Document itself, extensions may easily override
|
193
|
-
# it and redefine the width calculation behavior.
|
194
|
-
#++
|
195
|
-
def width_of(string, options={})
|
196
|
-
font.compute_width_of(string, options)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
# Provides font information and helper functions.
|
201
|
-
#
|
202
|
-
class Font
|
203
|
-
|
204
|
-
# The current font name
|
205
|
-
attr_reader :name
|
206
|
-
|
207
|
-
# The current font family
|
208
|
-
attr_reader :family
|
209
|
-
|
210
|
-
# The options hash used to initialize the font
|
211
|
-
attr_reader :options
|
212
|
-
|
213
|
-
def self.load(document,name,options={})
|
214
|
-
case name
|
215
|
-
when /\.ttf$/ then TTF.new(document, name, options)
|
216
|
-
when /\.dfont$/ then DFont.new(document, name, options)
|
217
|
-
when /\.afm$/ then AFM.new(document, name, options)
|
218
|
-
else AFM.new(document, name, options)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
def initialize(document,name,options={}) #:nodoc:
|
223
|
-
@document = document
|
224
|
-
@name = name
|
225
|
-
@options = options
|
226
|
-
|
227
|
-
@family = options[:family]
|
228
|
-
|
229
|
-
@document.proc_set :PDF, :Text
|
230
|
-
@identifier = :"F#{@document.font_registry.size + 1}"
|
231
|
-
|
232
|
-
@references = {}
|
233
|
-
end
|
234
|
-
|
235
|
-
def ascender
|
236
|
-
@ascender / 1000.0 * size
|
237
|
-
end
|
238
|
-
|
239
|
-
def descender
|
240
|
-
@descender / 1000.0 * size
|
241
|
-
end
|
242
|
-
|
243
|
-
def line_gap
|
244
|
-
@line_gap / 1000.0 * size
|
245
|
-
end
|
246
|
-
|
247
|
-
def identifier_for(subset)
|
248
|
-
"#{@identifier}.#{subset}"
|
249
|
-
end
|
250
|
-
|
251
|
-
def inspect
|
252
|
-
"#{self.class.name}< #{name}: #{size} >"
|
253
|
-
end
|
254
|
-
|
255
|
-
# Normalizes the encoding of the string to an encoding supported by the
|
256
|
-
# font. The string is expected to be UTF-8 going in. It will be re-encoded
|
257
|
-
# and the new string will be returned. For an in-place (destructive)
|
258
|
-
# version, see normalize_encoding!.
|
259
|
-
def normalize_encoding(string)
|
260
|
-
raise NotImplementedError, "subclasses of Prawn::Font must implement #normalize_encoding"
|
261
|
-
end
|
262
|
-
|
263
|
-
# Destructive version of normalize_encoding; normalizes the encoding of a
|
264
|
-
# string in place.
|
265
|
-
def normalize_encoding!(str)
|
266
|
-
str.replace(normalize_encoding(str))
|
267
|
-
end
|
268
|
-
|
269
|
-
def height_at(size)
|
270
|
-
@normalized_height ||= (@ascender - @descender + @line_gap) / 1000.0
|
271
|
-
@normalized_height * size
|
272
|
-
end
|
273
|
-
|
274
|
-
# Gets height of current font in PDF points at current font size
|
275
|
-
#
|
276
|
-
def height
|
277
|
-
height_at(size)
|
278
|
-
end
|
279
|
-
|
280
|
-
# Registers the given subset of the current font with the current PDF
|
281
|
-
# page. This is safe to call multiple times for a given font and subset,
|
282
|
-
# as it will only add the font the first time it is called.
|
283
|
-
#
|
284
|
-
def add_to_current_page(subset)
|
285
|
-
@references[subset] ||= register(subset)
|
286
|
-
@document.page_fonts.merge!(identifier_for(subset) => @references[subset])
|
287
|
-
end
|
288
|
-
|
289
|
-
private
|
290
|
-
|
291
|
-
def size
|
292
|
-
@document.font_size
|
293
|
-
end
|
294
|
-
|
295
|
-
end
|
296
|
-
|
297
|
-
end
|