prawn-core 0.7.2 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/Rakefile +1 -1
  2. data/examples/general/background.rb +1 -1
  3. data/examples/general/measurement_units.rb +2 -2
  4. data/examples/general/outlines.rb +50 -0
  5. data/examples/general/repeaters.rb +11 -7
  6. data/examples/general/stamp.rb +6 -6
  7. data/examples/graphics/basic_images.rb +1 -1
  8. data/examples/graphics/curves.rb +1 -1
  9. data/examples/graphics/rounded_polygons.rb +19 -0
  10. data/examples/graphics/rounded_rectangle.rb +20 -0
  11. data/examples/graphics/transformations.rb +52 -0
  12. data/examples/m17n/win_ansi_charset.rb +1 -1
  13. data/examples/text/font_calculations.rb +3 -3
  14. data/examples/text/indent_paragraphs.rb +18 -0
  15. data/examples/text/kerning.rb +4 -4
  16. data/examples/text/rotated.rb +98 -0
  17. data/examples/text/simple_text.rb +3 -3
  18. data/examples/text/simple_text_ttf.rb +1 -1
  19. data/lib/prawn/byte_string.rb +1 -0
  20. data/lib/prawn/core.rb +12 -5
  21. data/lib/prawn/core/object_store.rb +99 -0
  22. data/lib/prawn/core/page.rb +96 -0
  23. data/lib/prawn/core/text.rb +75 -0
  24. data/lib/prawn/document.rb +71 -78
  25. data/lib/prawn/document/annotations.rb +2 -2
  26. data/lib/prawn/document/bounding_box.rb +19 -9
  27. data/lib/prawn/document/column_box.rb +13 -12
  28. data/lib/prawn/document/graphics_state.rb +49 -0
  29. data/lib/prawn/document/internals.rb +5 -40
  30. data/lib/prawn/document/page_geometry.rb +1 -18
  31. data/lib/prawn/document/snapshot.rb +12 -7
  32. data/lib/prawn/errors.rb +18 -0
  33. data/lib/prawn/font.rb +4 -2
  34. data/lib/prawn/font/afm.rb +8 -0
  35. data/lib/prawn/font/dfont.rb +12 -4
  36. data/lib/prawn/font/ttf.rb +9 -0
  37. data/lib/prawn/graphics.rb +66 -9
  38. data/lib/prawn/graphics/color.rb +1 -1
  39. data/lib/prawn/graphics/transformation.rb +156 -0
  40. data/lib/prawn/graphics/transparency.rb +3 -7
  41. data/lib/prawn/images.rb +4 -3
  42. data/lib/prawn/images/png.rb +2 -2
  43. data/lib/prawn/outline.rb +278 -0
  44. data/lib/prawn/pdf_object.rb +5 -3
  45. data/lib/prawn/repeater.rb +25 -13
  46. data/lib/prawn/stamp.rb +6 -29
  47. data/lib/prawn/text.rb +139 -121
  48. data/lib/prawn/text/box.rb +168 -102
  49. data/spec/bounding_box_spec.rb +7 -2
  50. data/spec/document_spec.rb +7 -5
  51. data/spec/font_spec.rb +9 -1
  52. data/spec/graphics_spec.rb +229 -0
  53. data/spec/object_store_spec.rb +5 -5
  54. data/spec/outline_spec.rb +229 -0
  55. data/spec/repeater_spec.rb +18 -1
  56. data/spec/snapshot_spec.rb +7 -7
  57. data/spec/span_spec.rb +6 -2
  58. data/spec/spec_helper.rb +7 -3
  59. data/spec/stamp_spec.rb +13 -0
  60. data/spec/text_at_spec.rb +119 -0
  61. data/spec/text_box_spec.rb +257 -4
  62. data/spec/text_spec.rb +278 -180
  63. data/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +12 -0
  64. metadata +16 -3
  65. data/lib/prawn/object_store.rb +0 -92
@@ -114,6 +114,18 @@ module PDF
114
114
  end
115
115
  end
116
116
 
117
+ class Matrix < Inspector
118
+ attr_reader :matrices
119
+
120
+ def initialize
121
+ @matrices = []
122
+ end
123
+
124
+ def concatenate_matrix(*values)
125
+ @matrices << values
126
+ end
127
+ end
128
+
117
129
  end
118
130
  end
119
131
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-31 00:00:00 -05:00
12
+ date: 2010-02-24 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,6 +30,7 @@ files:
30
30
  - examples/m17n/win_ansi_charset.rb
31
31
  - examples/m17n/sjis.rb
32
32
  - examples/m17n/chinese_text_wrapping.rb
33
+ - examples/general/outlines.rb
33
34
  - examples/general/page_geometry.rb
34
35
  - examples/general/context_sensitive_headers.rb
35
36
  - examples/general/canvas.rb
@@ -50,6 +51,8 @@ files:
50
51
  - examples/text/font_calculations.rb
51
52
  - examples/text/dfont.rb
52
53
  - examples/text/simple_text.rb
54
+ - examples/text/indent_paragraphs.rb
55
+ - examples/text/rotated.rb
53
56
  - examples/text/family_based_styling.rb
54
57
  - examples/text/text_box_returning_excess.rb
55
58
  - examples/text/text_box.rb
@@ -62,6 +65,7 @@ files:
62
65
  - examples/bounding_box/bounding_boxes.rb
63
66
  - examples/graphics/stroke_bounds.rb
64
67
  - examples/graphics/basic_images.rb
68
+ - examples/graphics/transformations.rb
65
69
  - examples/graphics/image_flow.rb
66
70
  - examples/graphics/image_fit.rb
67
71
  - examples/graphics/png_types.rb
@@ -70,12 +74,14 @@ files:
70
74
  - examples/graphics/polygons.rb
71
75
  - examples/graphics/line.rb
72
76
  - examples/graphics/cmyk.rb
77
+ - examples/graphics/rounded_rectangle.rb
73
78
  - examples/graphics/remote_images.rb
74
79
  - examples/graphics/transparency.rb
75
80
  - examples/graphics/stroke_cap_and_join.rb
76
81
  - examples/graphics/stroke_dash.rb
77
82
  - examples/graphics/curves.rb
78
83
  - examples/graphics/image_position.rb
84
+ - examples/graphics/rounded_polygons.rb
79
85
  - lib/prawn/text.rb
80
86
  - lib/prawn/measurements.rb
81
87
  - lib/prawn/errors.rb
@@ -86,6 +92,9 @@ files:
86
92
  - lib/prawn/font/afm.rb
87
93
  - lib/prawn/font/dfont.rb
88
94
  - lib/prawn/font/ttf.rb
95
+ - lib/prawn/core/text.rb
96
+ - lib/prawn/core/page.rb
97
+ - lib/prawn/core/object_store.rb
89
98
  - lib/prawn/images/jpg.rb
90
99
  - lib/prawn/images/png.rb
91
100
  - lib/prawn/encoding.rb
@@ -94,13 +103,14 @@ files:
94
103
  - lib/prawn/compatibility.rb
95
104
  - lib/prawn/byte_string.rb
96
105
  - lib/prawn/stamp.rb
97
- - lib/prawn/object_store.rb
98
106
  - lib/prawn/measurement_extensions.rb
99
107
  - lib/prawn/graphics.rb
100
108
  - lib/prawn/images.rb
109
+ - lib/prawn/outline.rb
101
110
  - lib/prawn/literal_string.rb
102
111
  - lib/prawn/document/annotations.rb
103
112
  - lib/prawn/document/span.rb
113
+ - lib/prawn/document/graphics_state.rb
104
114
  - lib/prawn/document/page_geometry.rb
105
115
  - lib/prawn/document/snapshot.rb
106
116
  - lib/prawn/document/internals.rb
@@ -114,10 +124,13 @@ files:
114
124
  - lib/prawn/graphics/dash.rb
115
125
  - lib/prawn/graphics/cap_style.rb
116
126
  - lib/prawn/graphics/transparency.rb
127
+ - lib/prawn/graphics/transformation.rb
117
128
  - spec/name_tree_spec.rb
118
129
  - spec/document_spec.rb
119
130
  - spec/transparency_spec.rb
120
131
  - spec/png_spec.rb
132
+ - spec/outline_spec.rb
133
+ - spec/text_at_spec.rb
121
134
  - spec/measurement_units_spec.rb
122
135
  - spec/jpg_spec.rb
123
136
  - spec/span_spec.rb
@@ -1,92 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # object_store.rb : Implements PDF object repository for Prawn
4
- #
5
- # Copyright August 2009, Brad Ediger. All Rights Reserved.
6
- #
7
- # This is free software. Please see the LICENSE and COPYING files for details.
8
- module Prawn
9
- class ObjectStore #:nodoc:
10
- include Enumerable
11
-
12
- def initialize(info={})
13
- @objects = {}
14
- @identifiers = []
15
-
16
- # Create required PDF roots
17
- @info = ref(info).identifier
18
- @pages = ref(:Type => :Pages, :Count => 0, :Kids => []).identifier
19
- @root = ref(:Type => :Catalog, :Pages => pages).identifier
20
- end
21
-
22
- def ref(data, &block)
23
- push(size + 1, data, &block)
24
- end
25
-
26
- %w[info pages root].each do |name|
27
- define_method(name) do
28
- @objects[instance_variable_get("@#{name}")]
29
- end
30
- end
31
-
32
- # Adds the given reference to the store and returns the reference object.
33
- # If the object provided is not a Prawn::Reference, one is created from the
34
- # arguments provided.
35
- def push(*args, &block)
36
- reference = if args.first.is_a?(Prawn::Reference)
37
- args.first
38
- else
39
- Prawn::Reference.new(*args, &block)
40
- end
41
- @objects[reference.identifier] = reference
42
- @identifiers << reference.identifier
43
- reference
44
- end
45
- alias_method :<<, :push
46
-
47
- def each
48
- @identifiers.each do |id|
49
- yield @objects[id]
50
- end
51
- end
52
-
53
- def [](id)
54
- @objects[id]
55
- end
56
-
57
- def size
58
- @identifiers.size
59
- end
60
- alias_method :length, :size
61
-
62
- def compact
63
- # Clear live markers
64
- each { |o| o.live = false }
65
-
66
- # Recursively mark reachable objects live, starting from the roots
67
- # (the only objects referenced in the trailer)
68
- root.mark_live
69
- info.mark_live
70
-
71
- # Renumber live objects to eliminate gaps (shrink the xref table)
72
- if @objects.any?{ |_, o| !o.live }
73
- new_id = 1
74
- new_objects = {}
75
- new_identifiers = []
76
-
77
- each do |obj|
78
- if obj.live
79
- obj.identifier = new_id
80
- new_objects[new_id] = obj
81
- new_identifiers << new_id
82
- new_id += 1
83
- end
84
- end
85
-
86
- @objects = new_objects
87
- @identifiers = new_identifiers
88
- end
89
- end
90
-
91
- end
92
- end