Permalink
Browse files

Resolve conflicts in merge

  • Loading branch information...
practicingruby committed Jun 15, 2009
2 parents a8cb679 + e1fa931 commit 2ac2ae5d0386ea4c69335283ba3c14bf3b7104d5
View
340 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
View
56 LICENSE
@@ -0,0 +1,56 @@
+Prawn::Layout is copyrighted free software produced by Gregory Brown along with
+many community contributions (see git log for attribution).
+
+Licensing terms follow (License of Ruby 1.8):
+
+You can redistribute Prawn::Layout and/or modify it under either the terms of the GPL
+(see COPYING file), or the conditions below:
+
+ 1. You may make and give away verbatim copies of the source form of the
+ software without restriction, provided that you duplicate all of the
+ original copyright notices and associated disclaimers.
+
+ 2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
+
+ b) use the modified software only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided.
+
+ d) make other distribution arrangements with the author.
+
+ 3. You may distribute the software in object code or executable
+ form, provided that you do at least ONE of the following:
+
+ a) distribute the executables and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
+
+ b) accompany the distribution with the machine-readable source of
+ the software.
+
+ c) give non-standard executables non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d) make other distribution arrangements with the author.
+
+ 4. You may modify and include the part of the software into any other
+ software (possibly commercial).
+
+ 5. The scripts and library files supplied as input to or produced as
+ output from the software do not automatically fall under the
+ copyright of the software, but belong to whomever generated them,
+ and may be sold commercially, and may be aggregated with this
+ software.
+
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
View
1 README
@@ -0,0 +1 @@
+More to come
View
@@ -4,7 +4,7 @@ require 'rake/testtask'
require "rake/rdoctask"
require "rake/gempackagetask"
-PRAWN_LAYOUT_VERSION = "0.1.0"
+PRAWN_LAYOUT_VERSION = "0.2.0.1"
task :default => [:test]
@@ -0,0 +1,24 @@
+# encoding: utf-8
+#
+# As of 40c7bde9690e5174b6a958a5df6b2aabc6b8b041 this code produces an extra
+# empty line of text in row 2.
+#
+# Simple rounding of string_width floats seems to fix this issue, see the patch
+# in 09c837466c31bb715f1276118c606e20477577df.
+#
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require "rubygems"
+require "prawn"
+require "prawn/layout"
+
+Prawn::Document.generate("broken_table.pdf") do
+ font "#{Prawn::BASEDIR}/data/fonts/comicsans.ttf"
+ table [["foo", "baaar", "1" ],
+ ["This is","a sample", "2" ],
+ ["Table", "dont\ncha\nknow?", "3" ]],
+ :font_size => 30,
+ :padding => 10,
+ :border => 2,
+ :position => :center
+end
+
@@ -3,8 +3,10 @@
#
# Resolved in: 9c357bc488d26e7bbc2e442606106106d349e232
#
-$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..','lib')
-require 'prawn'
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require "rubygems"
+require "prawn"
+require "prawn/layout"
@prawn_document_options = {
:page_layout => :landscape,
@@ -12,8 +12,10 @@
#
$DEBUG = true
-$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require "rubygems"
require "prawn"
+require "prawn/layout"
Prawn::Document.generate("table_ignores_align_headers.pdf") do
left = "Left justified"
@@ -9,8 +9,10 @@
# boxes. Ideally, this would instead use the nesting bounding box dimensions
# [#80] , but this works for now.
#
-$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require "rubygems"
require "prawn"
+require "prawn/layout"
Prawn::Document.generate("table_in_bounding_box_without_height.pdf") do
bounding_box bounds.top_left, :width => 200 do
@@ -7,8 +7,10 @@
# Because this almost appears to be a feature display-wise, we will leave it
# alone for now.
#
-$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require "rubygems"
require "prawn"
+require "prawn/layout"
Prawn::Document.generate("table_with_background_color_problems.pdf") do
font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
@@ -3,12 +3,14 @@
#
# Fixed in e28cf53b5d05e6cb343e8dd5265c57d5f24ef4da [#76]
#
-$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require "rubygems"
require "prawn"
+require "prawn/layout"
Prawn::Document.generate("table_supresses_newlines.pdf") do
table [["test\n\naaaa","test\n\nbbbb"],
["test\n\ncccc", "test\n\ndddd"]], :border_style => :grid
cell [100,100], :text => "test\n\naaaa"
-end
+end
@@ -0,0 +1,23 @@
+# encoding: utf-8
+
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
+require "rubygems"
+require "prawn"
+require "prawn/layout"
+
+Prawn::Document.generate('simple_grid.pdf') do |p|
+ p.define_grid(:columns => 5, :rows => 8, :gutter => 10)
+
+ p.grid.rows.times do |i|
+ p.grid.columns.times do |j|
+ b = p.grid(i,j)
+ p.bounding_box b.top_left, :width => b.width, :height => b.height do
+ p.text b.name
+ p.stroke do
+ p.rectangle(p.bounds.top_left, b.width, b.height)
+ end
+ end
+ end
+ end
+end
+
@@ -0,0 +1,39 @@
+# encoding: utf-8
+#
+# Multi-faceted example that demonstrates a document flowing between header
+# and footer regions. At the moment, headers and footers in Prawn are run
+# using the current font settings (among other things), for each page. This
+# means that it is important to non-destructively set your desired styling
+# within your headers and footers, as shown below.
+#
+# Future versions of Prawn may make this more convenient somehow.
+#
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
+require "rubygems"
+require "prawn"
+require "prawn/layout"
+
+Prawn::Document.generate("flow_with_headers_and_footers.pdf") do
+
+ header margin_box.top_left do
+ font "Helvetica" do
+ text "Here's My Fancy Header", :size => 25, :align => :center
+ stroke_horizontal_rule
+ end
+ end
+
+ footer [margin_box.left, margin_box.bottom + 25] do
+ font "Helvetica" do
+ stroke_horizontal_rule
+ text "And here's a sexy footer", :size => 16
+ end
+ end
+
+ bounding_box([bounds.left, bounds.top - 50],
+ :width => bounds.width, :height => bounds.height - 100) do
+ text "this is some flowing text " * 200
+
+
+ end
+
+end
@@ -0,0 +1,30 @@
+# encoding: utf-8
+#
+# This example demonstrates Document#lazy_bounding_box, which is used for
+# storing a set of drawing instructions to be executed later. This is used
+# for header and footer support in Prawn, and can be used for repeating page
+# elements in general.
+#
+# Note that once a lazy bounding box is positioned, it calculates its anchor
+# relative to its parent bounding box. It will be positioned at this exact
+# location each time it is redrawn, regardless of the bounds
+# LazyBoundingBox#draw is in.
+#
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
+require "rubygems"
+require "prawn"
+require "prawn/layout"
+
+file = "lazy_bounding_boxes.pdf"
+Prawn::Document.generate(file, :skip_page_creation => true) do
+ point = [bounds.right-50, bounds.bottom + 25]
+ page_counter = lazy_bounding_box(point, :width => 50) do
+ text "Page: #{page_count}"
+ end
+
+ 10.times do
+ start_new_page
+ text "Some filler text for the page"
+ page_counter.draw
+ end
+end
@@ -0,0 +1,26 @@
+# encoding: utf-8
+#
+# Padded box is a kind of bounding box which places padding on all sides of
+# the current bounds. This is easier to see than explain, so please run the
+# example.
+#
+# Feature borrowed from Josh Knowle's pt at:
+# http://github.com/joshknowles/pt/tree/master
+#
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
+require "rubygems"
+require "prawn"
+require "prawn/layout"
+
+Prawn::Document.generate('padded_box.pdf') do
+ stroke_bounds
+ text "Margin box"
+ padded_box(25) do
+ stroke_bounds
+ text "Bounding box padded by 25 on all sides from the margins"
+ padded_box(50) do
+ stroke_bounds
+ text "Bounding box padded by 50 on all sides from the parent bounds"
+ end
+ end
+end
View
@@ -19,8 +19,8 @@
:border_width => 3, :padding => 10,
:text => "And that puppies are made of gravy", :document => self, :font_size => 9)
cell3 = Prawn::Table::Cell.new(
- :border_width => 3, :padding => 10, :width => 100,
- :text => "This is simply the way of the world", :document => self)
+ :border_width => 3, :padding => 10, :width => 100,
+ :text => "This is simply the way of the world", :document => self, :font_style => :bold)
3.times do
cellblock = Prawn::Table::CellBlock.new(self)
View
@@ -1,4 +1,6 @@
require "prawn/table"
+require "prawn/layout/page"
+require 'prawn/layout/grid'
module Prawn
Oops, something went wrong.

0 comments on commit 2ac2ae5

Please sign in to comment.