eideticpdf 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/fonts/AntiqueOlive-Bold.afm +406 -0
  2. data/fonts/AntiqueOlive-Bold.inf +27 -0
  3. data/fonts/AntiqueOlive-Compact.afm +401 -0
  4. data/fonts/AntiqueOlive-Compact.inf +27 -0
  5. data/fonts/AntiqueOlive-Italic.afm +401 -0
  6. data/fonts/AntiqueOlive-Italic.inf +27 -0
  7. data/fonts/AntiqueOlive-Roman.afm +409 -0
  8. data/fonts/AntiqueOlive-Roman.inf +27 -0
  9. data/fonts/AvantGarde-Book.afm +667 -0
  10. data/fonts/AvantGarde-Book.inf +26 -0
  11. data/fonts/AvantGarde-BookOblique.afm +667 -0
  12. data/fonts/AvantGarde-BookOblique.inf +26 -0
  13. data/fonts/AvantGarde-Demi.afm +673 -0
  14. data/fonts/AvantGarde-Demi.inf +26 -0
  15. data/fonts/AvantGarde-DemiOblique.afm +673 -0
  16. data/fonts/AvantGarde-DemiOblique.inf +26 -0
  17. data/fonts/Bookman-Demi.afm +669 -0
  18. data/fonts/Bookman-Demi.inf +25 -0
  19. data/fonts/Bookman-DemiItalic.afm +669 -0
  20. data/fonts/Bookman-DemiItalic.inf +25 -0
  21. data/fonts/Bookman-Light.afm +643 -0
  22. data/fonts/Bookman-Light.inf +25 -0
  23. data/fonts/Bookman-LightItalic.afm +620 -0
  24. data/fonts/Bookman-LightItalic.inf +25 -0
  25. data/fonts/Clarendon-Bold.afm +412 -0
  26. data/fonts/Clarendon-Bold.inf +27 -0
  27. data/fonts/Clarendon-Light.afm +410 -0
  28. data/fonts/Clarendon-Light.inf +27 -0
  29. data/fonts/Clarendon.afm +410 -0
  30. data/fonts/Clarendon.inf +27 -0
  31. data/fonts/CooperBlack-Italic.afm +421 -0
  32. data/fonts/CooperBlack-Italic.inf +26 -0
  33. data/fonts/CooperBlack.afm +427 -0
  34. data/fonts/CooperBlack.inf +26 -0
  35. data/fonts/Coronet-Regular.afm +327 -0
  36. data/fonts/Coronet-Regular.inf +25 -0
  37. data/fonts/Courier-Bold.afm +342 -0
  38. data/fonts/Courier-Bold.inf +26 -0
  39. data/fonts/Courier-BoldOblique.afm +342 -0
  40. data/fonts/Courier-BoldOblique.inf +26 -0
  41. data/fonts/Courier-Oblique.afm +342 -0
  42. data/fonts/Courier-Oblique.inf +26 -0
  43. data/fonts/Courier.afm +342 -0
  44. data/fonts/Courier.inf +26 -0
  45. data/fonts/Eurostile.afm +419 -0
  46. data/fonts/Eurostile.inf +27 -0
  47. data/fonts/Goudy-ExtraBold.afm +412 -0
  48. data/fonts/Goudy-ExtraBold.inf +27 -0
  49. data/fonts/Helvetica-Bold.afm +2827 -0
  50. data/fonts/Helvetica-Bold.inf +26 -0
  51. data/fonts/Helvetica-BoldOblique.afm +2827 -0
  52. data/fonts/Helvetica-BoldOblique.inf +26 -0
  53. data/fonts/Helvetica-Condensed-Bold.afm +623 -0
  54. data/fonts/Helvetica-Condensed-Bold.inf +25 -0
  55. data/fonts/Helvetica-Condensed-BoldObl.afm +623 -0
  56. data/fonts/Helvetica-Condensed-BoldObl.inf +25 -0
  57. data/fonts/Helvetica-Condensed-Oblique.afm +528 -0
  58. data/fonts/Helvetica-Condensed-Oblique.inf +25 -0
  59. data/fonts/Helvetica-Condensed.afm +528 -0
  60. data/fonts/Helvetica-Condensed.inf +25 -0
  61. data/fonts/Helvetica-Narrow-Bold.afm +1439 -0
  62. data/fonts/Helvetica-Narrow-Bold.inf +26 -0
  63. data/fonts/Helvetica-Narrow-BoldOblique.afm +1439 -0
  64. data/fonts/Helvetica-Narrow-BoldOblique.inf +26 -0
  65. data/fonts/Helvetica-Narrow-Oblique.afm +1556 -0
  66. data/fonts/Helvetica-Narrow-Oblique.inf +26 -0
  67. data/fonts/Helvetica-Narrow.afm +1556 -0
  68. data/fonts/Helvetica-Narrow.inf +26 -0
  69. data/fonts/Helvetica-Oblique.afm +3051 -0
  70. data/fonts/Helvetica-Oblique.inf +26 -0
  71. data/fonts/Helvetica.afm +3051 -0
  72. data/fonts/Helvetica.inf +26 -0
  73. data/fonts/LetterGothic-Bold.afm +443 -0
  74. data/fonts/LetterGothic-Bold.inf +26 -0
  75. data/fonts/LetterGothic-BoldSlanted.afm +443 -0
  76. data/fonts/LetterGothic-BoldSlanted.inf +26 -0
  77. data/fonts/LetterGothic-Slanted.afm +443 -0
  78. data/fonts/LetterGothic-Slanted.inf +26 -0
  79. data/fonts/LetterGothic.afm +443 -0
  80. data/fonts/LetterGothic.inf +26 -0
  81. data/fonts/LubalinGraph-Book.afm +351 -0
  82. data/fonts/LubalinGraph-Book.inf +25 -0
  83. data/fonts/LubalinGraph-BookOblique.afm +351 -0
  84. data/fonts/LubalinGraph-BookOblique.inf +25 -0
  85. data/fonts/LubalinGraph-Demi.afm +351 -0
  86. data/fonts/LubalinGraph-Demi.inf +25 -0
  87. data/fonts/LubalinGraph-DemiOblique.afm +351 -0
  88. data/fonts/LubalinGraph-DemiOblique.inf +25 -0
  89. data/fonts/Marigold.afm +491 -0
  90. data/fonts/Marigold.inf +27 -0
  91. data/fonts/MonaLisa-Recut.afm +663 -0
  92. data/fonts/MonaLisa-Recut.inf +27 -0
  93. data/fonts/NewCenturySchlbk-Bold.afm +886 -0
  94. data/fonts/NewCenturySchlbk-Bold.inf +25 -0
  95. data/fonts/NewCenturySchlbk-BoldItalic.afm +1521 -0
  96. data/fonts/NewCenturySchlbk-BoldItalic.inf +26 -0
  97. data/fonts/NewCenturySchlbk-Italic.afm +1113 -0
  98. data/fonts/NewCenturySchlbk-Italic.inf +26 -0
  99. data/fonts/NewCenturySchlbk-Roman.afm +1067 -0
  100. data/fonts/NewCenturySchlbk-Roman.inf +26 -0
  101. data/fonts/Optima-Bold.afm +515 -0
  102. data/fonts/Optima-Bold.inf +27 -0
  103. data/fonts/Optima-BoldItalic.afm +712 -0
  104. data/fonts/Optima-BoldItalic.inf +26 -0
  105. data/fonts/Optima-Italic.afm +737 -0
  106. data/fonts/Optima-Italic.inf +26 -0
  107. data/fonts/Optima.afm +501 -0
  108. data/fonts/Optima.inf +27 -0
  109. data/fonts/Palatino-Bold.afm +675 -0
  110. data/fonts/Palatino-Bold.inf +26 -0
  111. data/fonts/Palatino-BoldItalic.afm +702 -0
  112. data/fonts/Palatino-BoldItalic.inf +26 -0
  113. data/fonts/Palatino-Italic.afm +700 -0
  114. data/fonts/Palatino-Italic.inf +26 -0
  115. data/fonts/Palatino-Roman.afm +718 -0
  116. data/fonts/Palatino-Roman.inf +26 -0
  117. data/fonts/StempelGaramond-Bold.afm +412 -0
  118. data/fonts/StempelGaramond-Bold.inf +27 -0
  119. data/fonts/StempelGaramond-BoldItalic.afm +413 -0
  120. data/fonts/StempelGaramond-BoldItalic.inf +27 -0
  121. data/fonts/StempelGaramond-Italic.afm +413 -0
  122. data/fonts/StempelGaramond-Italic.inf +27 -0
  123. data/fonts/StempelGaramond-Roman.afm +412 -0
  124. data/fonts/StempelGaramond-Roman.inf +27 -0
  125. data/fonts/Symbol.afm +213 -0
  126. data/fonts/Symbol.inf +27 -0
  127. data/fonts/Times-Bold.afm +2588 -0
  128. data/fonts/Times-Bold.inf +26 -0
  129. data/fonts/Times-BoldItalic.afm +2384 -0
  130. data/fonts/Times-BoldItalic.inf +26 -0
  131. data/fonts/Times-Italic.afm +2667 -0
  132. data/fonts/Times-Italic.inf +26 -0
  133. data/fonts/Times-Roman.afm +2419 -0
  134. data/fonts/Times-Roman.inf +26 -0
  135. data/fonts/Univers-Bold.afm +712 -0
  136. data/fonts/Univers-Bold.inf +27 -0
  137. data/fonts/Univers-BoldOblique.afm +712 -0
  138. data/fonts/Univers-BoldOblique.inf +27 -0
  139. data/fonts/Univers-Condensed.afm +403 -0
  140. data/fonts/Univers-Condensed.inf +27 -0
  141. data/fonts/Univers-CondensedOblique.afm +403 -0
  142. data/fonts/Univers-CondensedOblique.inf +27 -0
  143. data/fonts/Univers-Light.afm +737 -0
  144. data/fonts/Univers-Light.inf +27 -0
  145. data/fonts/Univers-LightOblique.afm +737 -0
  146. data/fonts/Univers-LightOblique.inf +27 -0
  147. data/fonts/Univers-Oblique.afm +656 -0
  148. data/fonts/Univers-Oblique.inf +27 -0
  149. data/fonts/Univers.afm +656 -0
  150. data/fonts/Univers.inf +27 -0
  151. data/fonts/ZapfChancery-MediumItalic.afm +842 -0
  152. data/fonts/ZapfChancery-MediumItalic.inf +26 -0
  153. data/fonts/ZapfDingbats.afm +225 -0
  154. data/fonts/ZapfDingbats.inf +26 -0
  155. data/lib/epdfafm.rb +334 -0
  156. data/lib/epdfdw.rb +710 -0
  157. data/lib/epdfk.rb +3142 -0
  158. data/lib/epdfo.rb +882 -0
  159. data/lib/epdfpw.rb +1749 -0
  160. data/lib/epdfs.rb +101 -0
  161. data/lib/epdfsw.rb +267 -0
  162. data/lib/epdft.rb +145 -0
  163. data/lib/epdftt.rb +458 -0
  164. data/test/pdf_tests.rb +16 -0
  165. data/test/test.rb +816 -0
  166. data/test/test_epdfafm.rb +202 -0
  167. data/test/test_epdfdw.rb +369 -0
  168. data/test/test_epdfk.rb +47 -0
  169. data/test/test_epdfo.rb +762 -0
  170. data/test/test_epdfpw.rb +129 -0
  171. data/test/test_epdfs.rb +54 -0
  172. data/test/test_epdfsw.rb +314 -0
  173. data/test/test_epdft.rb +198 -0
  174. data/test/test_epdftt.rb +34 -0
  175. data/test/test_helpers.rb +18 -0
  176. data/test/testimg.jpg +0 -0
  177. metadata +247 -0
data/test/test.rb ADDED
@@ -0,0 +1,816 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: ASCII-8BIT
3
+ #
4
+ # Created by Brent Rowland on 2007-09-30.
5
+ # Copyright (c) 2007, Eidetic Software. All rights reserved.
6
+
7
+ $: << File.dirname(__FILE__) + '/../lib'
8
+ require 'epdfdw'
9
+
10
+ TestImg = File.join(File.dirname(__FILE__), 'testimg.jpg')
11
+ BuiltInFonts = false
12
+ LOREM = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
13
+
14
+ def grid(w, width, height, xoff, yoff, step=1)
15
+ w.path(:stroke => true) do
16
+ # vertical lines
17
+ 0.step(width, step) do |x|
18
+ w.move_to(x + xoff, yoff)
19
+ w.line_to(x + xoff, height + yoff)
20
+ end
21
+ # horizontal lines
22
+ 0.step(height, step) do |y|
23
+ w.move_to(xoff, y + yoff)
24
+ w.line_to(width + xoff, y + yoff)
25
+ end
26
+ end
27
+ end
28
+
29
+ def inch_grid(w, width=8, height=10, xoff=0.25, yoff=0.5)
30
+ w.page(:units => :in) do |p|
31
+ p.font("Helvetica", 10)
32
+ p.print_xy(0.25, 0.25, "Inch Squares", :underline => true)
33
+ grid(p, width, height, xoff, yoff)
34
+ end
35
+ end
36
+
37
+ def cm_grid(w, width=20, height=26, xoff=0.75, yoff=1)
38
+ w.page(:units => :cm) do |p|
39
+ p.font("Helvetica", 10)
40
+ p.print_xy(0.5, 0.5, "Centimeter Squares", :underline => true)
41
+ grid(p, width, height, xoff, yoff)
42
+ end
43
+ end
44
+
45
+ def dp_grid(w, width=8000, height=10000, xoff=250, yoff=500)
46
+ # set custom point scale
47
+ EideticPDF::UNIT_CONVERSION[:dp] = 0.072
48
+ w.open_page(:units => :dp)
49
+ w.font("Helvetica", 10)
50
+ w.print_xy(250, 250, "Dave Points Squares", :underline => true)
51
+ grid(w, width, height, xoff, yoff, 1000)
52
+ w.close_page
53
+ end
54
+
55
+ def pt_units(w)
56
+ w.page(:units => :pt) do |p|
57
+ p.rectangle(1,1,p.page_width-2, p.page_height-2, :clip => true) do
58
+ p.print_xy(5, 5, "Point Units", :underline => true)
59
+
60
+ y = 24; size = 12
61
+ while y < 700
62
+ p.font("Helvetica", size)
63
+ p.print_xy(5, y, "Size: #{size}, y: #{y}")
64
+ y += size; size += 12
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ def circles_and_rectangles(w)
71
+ w.open_page(:units => :in)
72
+ w.print_xy(0.5, 0.5, "Circles and Rectangles", :underline => true)
73
+ w.rectangle(1, 1, 6.5, 9)
74
+ w.rectangle(2, 2, 4.5, 7)
75
+ w.circle(4.25, 5.5, 3.25)
76
+ w.circle(4.25, 5.5, 2.25)
77
+ w.close_page
78
+ end
79
+
80
+ def type1_font_names(w)
81
+ w.page(:units => :cm, :margins => [1,2]) do |p|
82
+ p.type1_font_names.sort.each_with_index do |font_name, index|
83
+ p.move_to(p.canvas_width / 2, 0) if index == 40
84
+ encoding = ['Symbol','ZapfDingbats'].include?(font_name) ? 'StandardEncoding' : 'WinAnsiEncoding'
85
+ p.font(font_name, 12, :encoding => encoding)
86
+ p.puts(font_name, :indent => true)
87
+ end
88
+ end
89
+ end
90
+
91
+ def truetype_font_names(w)
92
+ w.page(:units => :cm, :margins => [1,2]) do |p|
93
+ p.truetype_font_names.sort.each_with_index do |font_name, index|
94
+ p.move_to(p.canvas_width / 2, 0) if index == 40
95
+ p.font(font_name, 12, :sub_type => 'TrueType')
96
+ p.puts(font_name)
97
+ end
98
+ end
99
+ end
100
+
101
+ def print_text(w)
102
+ w.open_page(:units => :cm, :margins => 1)
103
+ w.font("Helvetica", 12)
104
+ w.puts("Print Text", :underline => true)
105
+ w.new_line
106
+ w.puts("Version: #{EideticPDF::VERSION}")
107
+ # test vertical text alignment
108
+ w.move_to(0, 3); w.line_to(w.canvas_width, 3)
109
+ w.move_to(0, 3)
110
+
111
+ w.v_text_align :base
112
+ w.print("v_text_align = ")
113
+ w.v_text_align :below
114
+ w.print(":below ")
115
+ w.v_text_align :base
116
+ w.print(":base ")
117
+ w.v_text_align :middle
118
+ w.print(":middle ")
119
+ w.v_text_align :top
120
+ w.print(":top ")
121
+ w.v_text_align :above
122
+ w.print(":above ")
123
+
124
+ w.v_text_align :top
125
+ w.move_to(0, 5)
126
+ ['Black', 'Blue', 'Brown', 'Crimson', 'Gold', 'Green', 'Gray', 'Indigo'].each do |color|
127
+ w.font_color color
128
+ w.print "#{color} "
129
+ end
130
+
131
+ w.font_color 'Black'
132
+ w.move_to(0, 7); w.line_to(0, 9); w.move_to(w.canvas_width, 7); w.line_to(w.canvas_width, 9)
133
+ lorem2 = w.paragraph_xy(0.5, 7, LOREM, :width => 18, :height => 2)
134
+ w.puts
135
+ w.paragraph(lorem2, :width => 18) unless lorem2.nil?
136
+ w.puts
137
+ w.paragraph(LOREM, :width => 18, :align => :justify)
138
+ w.puts
139
+ w.paragraph(LOREM, :width => 18, :align => :right)
140
+ w.puts
141
+ w.move_to((w.canvas_width - 10) / 2.0, w.pen_pos.y)
142
+ w.paragraph(LOREM, :width => 10, :align => :center)
143
+ w.close_page
144
+ end
145
+
146
+ def print_angled_text_etc(w)
147
+ w.page(:units => :in) do |p|
148
+ p.font("Helvetica", 12)
149
+ p.print_xy(0.5, 0.5, "Tabs and Angled Text", :underline => true)
150
+ p.move_to(0, 1)
151
+ p.tabs [1, 4.25, 7.5]
152
+ p.tab; p.print "|<--", :align => :left
153
+ p.tab; p.print "-|-", :align => :center
154
+ p.tab; p.print "-->|", :align => :right
155
+ p.tab; p.print "Align: Left", :align => :left
156
+ p.tab; p.print "Align: Center", :align => :center
157
+ p.tab; p.print "Align: Right", :align => :right
158
+
159
+ grid(p, 6, 3, 1, 2)
160
+ p.v_text_align :middle
161
+ p.move_to(0, 2)
162
+ p.tabs [1, 2, 3, 4, 5, 6]
163
+ ["Words", "of", "varying", "lengths", "aligned", "left."].each do |word|
164
+ p.tab
165
+ p.print " #{word}", :align => :left, :angle => 315
166
+ end
167
+ p.move_to(0, 3.5)
168
+ p.tabs [1.5, 2.5, 3.5, 4.5, 5.5, 6.5]
169
+ ["Words", "of", "varying", "lengths", "aligned", "center."].each do |word|
170
+ p.tab
171
+ p.print word, :align => :center, :angle => 45
172
+ end
173
+
174
+ p.move_to(0, 5)
175
+ p.tabs [2, 3, 4, 5, 6, 7]
176
+ ["Words", "of", "varying", "lengths", "aligned", "right."].each do |word|
177
+ p.tab
178
+ p.print "#{word} ", :align => :right, :angle => 315
179
+ end
180
+
181
+ angle = 0
182
+ while angle < 360
183
+ p.move_to(4.25, 7.5)
184
+ p.print(" Text at #{angle} degrees", :angle => angle, :underline => true)
185
+ angle += 45
186
+ end
187
+ end
188
+ end
189
+
190
+ def landscape_orientation(w)
191
+ w.page(:units => :in, :orientation => :landscape) do |p|
192
+ p.font("Times", 12)
193
+ p.print_xy(0.5, 0.5, "Landscape Orientation", :underline => true)
194
+ p.rectangle(1, 1, p.page_width - 2, p.page_height - 2)
195
+ end
196
+ end
197
+
198
+ def line_widths_and_patterns(w)
199
+ w.page(:units => :cm) do |p|
200
+ p.print_xy(1, 1, "Line Widths and Patterns", :underline => true)
201
+ p.v_text_align :base
202
+
203
+ 0.upto(10) do |i|
204
+ p.line_width "#{i}pt"
205
+ p.move_to(1, 2 + i)
206
+ p.line_to(p.page_width - 5, 2 + i)
207
+ p.print(" #{i} points")
208
+ end
209
+
210
+ 0.upto(8) do |i|
211
+ pattern = [:solid,:dotted,:dashed][i % 3]
212
+ p.line_width "#{i}pt"
213
+ p.line_dash_pattern pattern
214
+ p.line_cap_style :round_cap
215
+ p.move_to(1, 13 + i)
216
+ p.line_to(p.page_width - 5, 13 + i)
217
+ p.print(" #{pattern}")
218
+ end
219
+
220
+ p.line_width "3pt"
221
+ p.line_dash_pattern :solid
222
+ p.line_cap_style :butt_cap
223
+ p.print_xy(1, 22, "Line Colors")
224
+ y = 23.0
225
+
226
+ # blue
227
+ p.line_color 0x0000FF
228
+ p.line_color [0,0,255]
229
+ p.move_to(1, 23)
230
+ p.line_to(p.page_width - 5, 23)
231
+ p.print(" #{p.line_color}")
232
+
233
+ # green
234
+ p.line_color 0x00FF00
235
+ p.line_color [0,255,0]
236
+ p.move_to(1, 23.5)
237
+ p.line_to(p.page_width - 5, 23.5)
238
+ p.print(" #{p.line_color}")
239
+
240
+ # red
241
+ p.line_color 0xFF0000
242
+ #p.line_color [255,0,0]
243
+ p.move_to(1, 24)
244
+ p.line_to(p.page_width - 5, 24)
245
+ p.print(" #{p.line_color}")
246
+
247
+ # fuchsia
248
+ p.line_color [0xFF, 0, 0xFF]
249
+ p.move_to(1, 24.5)
250
+ p.line_to(p.page_width - 5, 24.5)
251
+ p.print(" #{p.line_color}")
252
+
253
+ # yellow
254
+ p.line_color [0xFF, 0xFF, 0]
255
+ p.move_to(1, 25)
256
+ p.line_to(p.page_width - 5, 25)
257
+ p.print(" #{p.line_color}")
258
+
259
+ # black custom pattern
260
+ EideticPDF::LINE_PATTERNS[:dotted2] = [1, 10]
261
+ p.line_color 0
262
+ p.line_dash_pattern :dotted2
263
+ p.move_to(1, 26)
264
+ p.line_to(p.page_width - 5, 26)
265
+ p.print(" (custom pattern)")
266
+ end
267
+ end
268
+
269
+ def arcs(w)
270
+ w.page(:units => :in) do |p|
271
+ p.print_xy(0.5, 0.5, "Arcs", :underline => true)
272
+
273
+ x1, x2, y1, y2 = 4.0, 4.5, 2.25, 2.75
274
+ s = 0
275
+ [0.75, 1.00, 1.25].each do |r|
276
+ p.arc(x2, y1, r, s, s+90, true)
277
+ p.arc(x1, y1, r, s+90, s+180, true)
278
+ p.arc(x1, y2, r, s+180, s+270, true)
279
+ p.arc(x2, y2, r, s+270, s+360, true)
280
+ end
281
+
282
+ x1, x2, x3, y1, y2, y3 = 4.0, 4.25, 4.5, 8.25, 8.5, 8.75
283
+ s = 45
284
+ [0.75, 1.00, 1.25].each do |r|
285
+ p.arc(x2, y1, r, s, s+90, true)
286
+ p.arc(x1, y2, r, s+90, s+180, true)
287
+ p.arc(x2, y3, r, s+180, s+270, true)
288
+ p.arc(x3, y2, r, s+270, s+360, true)
289
+ end
290
+ end
291
+ end
292
+
293
+ def filled_rectangles(w)
294
+ page_no = 0
295
+ rows, cols = 18, 3
296
+ left, top = 0.75, 1.0
297
+ col_width, row_height, label_width = 2.0, 0.5, 1.25
298
+ names = w.named_colors.keys.sort
299
+ lists = []
300
+ while names.size > 0
301
+ lists << names.slice!(0, rows)
302
+ end
303
+ pages = []
304
+ while lists.size > 0
305
+ pages << lists.slice!(0, cols)
306
+ end
307
+ pages.each_with_index do |page, page_index|
308
+ w.open_page(:units => :in)
309
+ w.font("Helvetica", 10)
310
+ w.print_xy(0.5, 0.5, "Filled Rectangles with Named Colors - #{page_index + 1}", :underline => true)
311
+ w.line_height 1.3
312
+ page.each_with_index do |list, list_index|
313
+ list.each_with_index do |name, name_index|
314
+ w.move_to(left + list_index * col_width, top + name_index * row_height)
315
+ w.puts(name.scan(/[A-Z][a-z]*/), :indent => true)
316
+ w.fill_color name
317
+ w.rectangle(left + list_index * col_width + label_width, top + name_index * row_height, 0.5, 0.4, :fill => true)
318
+ end
319
+ end
320
+ w.close_page
321
+ end
322
+ end
323
+
324
+ def ellipses(w)
325
+ w.page(:units => :in) do |p|
326
+ p.print_xy(0.5, 0.5, "Ellipses", :underline => true)
327
+ p.ellipse(4.25, 5.5, 3.75, 3.25)
328
+ p.ellipse(4.25, 5.5, 3.75, 4.5)
329
+ p.ellipse(4.25, 5.5, 3, 2, :rotation => 45)
330
+ end
331
+ end
332
+
333
+ def filled_shapes(w)
334
+ x1, x2, x3 = 0.75, 3.25, 5.75
335
+ y1, y2, y3, y4 = 1.0, 3.5, 6.0, 8.5
336
+ w.page(:units => :in) do |p|
337
+ p.print_xy(0.5, 0.5, "Filled Shapes", :underline => true)
338
+ p.line_color 'Black'
339
+ p.fill_color 'LightSteelBlue'
340
+
341
+ # empty rectangle w/ border
342
+ p.rectangle(x1, y1, 2, 2)
343
+ # filled rectangle w/ border
344
+ p.rectangle(x1, y2, 2, 2, :fill => true)
345
+ # filled rectangle w/o border
346
+ p.rectangle(x1, y3, 2, 2, :fill => true, :border => false)
347
+
348
+ # empty circle w/ border
349
+ p.circle(x2 + 1, y1 + 1, 1)
350
+ # filled circle w/ border
351
+ p.circle(x2 + 1, y2 + 1, 1, :fill => true)
352
+ # filled circle w/o border
353
+ p.circle(x2 + 1, y3 + 1, 1, :fill => true, :border => false)
354
+
355
+ # empty ellipse w/ border
356
+ p.ellipse(x3 + 1, y1 + 1, 0.75, 1)
357
+ # filled ellipse w/ border
358
+ p.ellipse(x3 + 1, y2 + 1, 0.75, 1, :fill => true)
359
+ # filled ellipse w/o border
360
+ p.ellipse(x3 + 1, y3 + 1, 0.75, 1, :fill => true, :border => false)
361
+
362
+ # filled rectangles w/ borders
363
+ p.fill_color 'LightSteelBlue'
364
+ p.rectangle(x1, y4, 2, 2, :fill => true)
365
+ p.fill_color 'White'
366
+ p.rectangle(x1 + 0.5, y4 + 0.5, 1, 1, :fill => true)
367
+ # filled circles w/ borders
368
+ p.fill_color 'LightSteelBlue'
369
+ p.circle(x2 + 1, y4 + 1, 1, :fill => true)
370
+ p.fill_color 'White'
371
+ p.circle(x2 + 1, y4 + 1, 0.5, :fill => true)
372
+ # filled ellipses w/ borders
373
+ p.fill_color 'LightSteelBlue'
374
+ p.ellipse(x3 + 1, y4 + 1, 0.75, 1, :fill => true)
375
+ p.fill_color 'White'
376
+ p.ellipse(x3 + 1, y4 + 1, 0.25, 0.5, :fill => true)
377
+ end
378
+ end
379
+
380
+ def compound_paths(w)
381
+ w.page(:units => :in) do |p|
382
+ p.print_xy(0.5, 0.5, "Compound Paths", :underline => true)
383
+ p.fill_color 'LightSteelBlue'
384
+
385
+ # filled rectangle w/ only 3 borders
386
+ p.path
387
+ p.move_to(1, 1)
388
+ p.line_to(3, 1)
389
+ p.line_to(3, 2)
390
+ p.line_to(1, 2)
391
+ p.fill_and_stroke
392
+
393
+ p.path(:fill => true, :stroke => true) do
394
+ p.rectangle(1, 3, 3, 3, :path => true)
395
+ p.rectangle(1.5, 3.5, 1, 1, :reverse => true)
396
+ p.rectangle(2.75, 4.75, 1, 1, :reverse => true)
397
+ end
398
+
399
+ p.path(:fill => true, :stroke => true) do
400
+ p.circle(2.5, 8.5, 1.5)
401
+ p.circle(2.5, 8.5, 0.5, :reverse => true)
402
+ end
403
+
404
+ p.path(:fill => true, :stroke => true) do
405
+ p.ellipse(6.5, 2.5, 1.5, 2)
406
+ p.ellipse(6.5, 2.5, 1, 1.5, :reverse => true)
407
+ end
408
+
409
+ p.path(:fill => true, :stroke => true) do
410
+ p.rectangle(5, 6, 3, 4, :corners => [0.5])
411
+ p.rectangle(5.5, 6.5, 2, 3, :corners => [1, 0.5, 1, 0.5, 0.5, 1, 0.5, 1], :reverse => true)
412
+ end
413
+ end
414
+ end
415
+
416
+ def pies(w)
417
+ w.page(:units => :in) do |p|
418
+ p.print_xy(0.5, 0.5, "Pies", :underline => true)
419
+ p.line_color 0
420
+
421
+ x, y, r = 4, 3, 2
422
+ p.path(:fill => true, :stroke => true) do
423
+ p.fill_color 'Crimson'
424
+ p.pie(x, y, r, 0, 90)
425
+ p.circle(4.75, 2.25, 0.5, :reverse => true)
426
+ end
427
+ p.pie(x, y, r, 90, 135, :fill => 'DarkOrange')
428
+ p.pie(x, y, r, 135, 225, :fill => 'Orchid')
429
+ p.pie(x, y, r, 225, 270, :fill => 'Gold')
430
+
431
+ p.pie(x + 0.25, y + 0.25, r, 270, 360, :fill => 'MediumSeaGreen')
432
+
433
+ y = 8
434
+ p.print_xy(0.5, 6, "Arches", :underline => true)
435
+ p.arch(x, y, 1.5, 2, 0, 90, :fill => 'MediumSeaGreen')
436
+ p.arch(x, y, 1, 1.5, 90, 180, :fill => 'Crimson')
437
+ p.arch(x, y, 0.5, 1, 0, 90, :fill => 'DarkOrange')
438
+ p.arch(x, y, 0, 0.5, 90, 180, :fill => 'Gold')
439
+ end
440
+ end
441
+
442
+ def polygons(w)
443
+ w.page(:units => :in) do |p|
444
+ p.print_xy(0.5, 0.5, "Polygons", :underline => true)
445
+ p.fill_color 'LightSteelBlue'
446
+
447
+ x1, x2, x3 = 1.75, 4.25, 6.75
448
+ y1, y2, y3, y4 = 2, 4.5, 7, 9.5
449
+ r = 1
450
+
451
+ p.polygon(x1, y1, r, 3, :fill => true)
452
+ p.polygon(x2, y1, r, 4, :fill => true, :border => 'Blue')
453
+ p.polygon(x3, y1, r, 5, :fill => true, :border => 'ForestGreen')
454
+ p.polygon(x1, y2, r, 6, :fill => true, :border => 'Crimson')
455
+ p.polygon(x2, y2, r, 7, :fill => true, :border => 'Gray')
456
+ p.polygon(x3, y2, r, 8, :fill => true)
457
+
458
+ w.polygon(x1, y3, r, 3, :fill => 'DarkSlateGray', :rotation => 360.0 / 6)
459
+ w.polygon(x2, y3, r, 4, :fill => 'DarkTurquoise', :rotation => 360.0 / 8)
460
+ w.polygon(x3, y3, r, 5, :fill => 'DeepSkyBlue', :rotation => 360.0 / 10)
461
+ w.polygon(x1, y4, r, 6, :fill => 'ForestGreen', :rotation => 360.0 / 12)
462
+ w.polygon(x2, y4, r, 7, :fill => 'DarkSlateBlue', :rotation => 360.0 / 14)
463
+ w.polygon(x3, y4, r, 8, :fill => true, :rotation => 360.0 / 16)
464
+ end
465
+ end
466
+
467
+ def stars(w)
468
+ w.page(:units => :in) do |p|
469
+ p.print_xy(0.5, 0.5, "Stars", :underline => true)
470
+ p.fill_color 'LightSteelBlue'
471
+
472
+ x1, x2, x3 = 1.75, 4.25, 6.75
473
+ y1, y2, y3, y4 = 2, 4.5, 7, 9.5
474
+ r = 1
475
+
476
+ p.star(x1, y1, r, nil, 5, :fill => true)
477
+ p.star(x2, y1, r, nil, 6, :fill => true, :border => 'Blue')
478
+ p.star(x3, y1, r, nil, 7, :fill => true, :border => 'ForestGreen')
479
+ p.star(x1, y2, r, nil, 8, :fill => true, :border => 'Crimson')
480
+ p.star(x2, y2, r, nil, 9, :fill => true, :border => 'Gray')
481
+ p.star(x3, y2, r, nil, 10, :fill => true)
482
+
483
+ w.star(x1, y3, r, nil, 5, :fill => 'DarkSlateGray', :rotation => 360.0 / 10)
484
+ w.star(x2, y3, r, nil, 6, :fill => 'DarkTurquoise', :rotation => 360.0 / 12)
485
+ w.star(x3, y3, r, nil, 7, :fill => 'DeepSkyBlue', :rotation => 360.0 / 14)
486
+ w.star(x1, y4, r, nil, 8, :fill => 'ForestGreen', :rotation => 360.0 / 16)
487
+ w.star(x2, y4, r, nil, 9, :fill => 'DarkSlateBlue', :rotation => 360.0 / 18)
488
+ w.star(x3, y4, r, nil, 10, :fill => true, :rotation => 360.0 / 20)
489
+ end
490
+ end
491
+
492
+ def images(w)
493
+ w.page(:units => :in, :margins => 1) do |p|
494
+ p.print_xy(-0.5, -0.5, "Images", :underline => true)
495
+ # natural size @ current location
496
+ p.print_image_file(TestImg, 0, 0)
497
+ # from a buffer at a specified position and width with auto-height
498
+ img = open(TestImg, EideticPDF::ImageReadMode) { |f| f.read }
499
+ p.print_image(img, 1, 3, 4.5)
500
+ # specified height with auto-width
501
+ p.print_image_file(TestImg, 3.25, 7, nil, 2)
502
+ # specified width and height
503
+ p.print_image_file(TestImg, 0, 8, 1, 1)
504
+ end
505
+ end
506
+
507
+ def clipping(w)
508
+ w.page(:units => :in, :margins => 1) do |p|
509
+ p.print_xy(-0.5, -0.5, "Clipping", :underline => true)
510
+ # grid(p, 6.5, 9, 0, 0)
511
+ p.star(1, 1, 1, nil, 5, :border => false, :clip => true) do
512
+ p.print_image_file(TestImg, 0, 0, nil, 2)
513
+ end
514
+ p.circle(4.5, 1, 1, :clip => true) do
515
+ p.print_image_file(TestImg, 3, 0, 3)
516
+ end
517
+ p.ellipse(1.5, 4, 1.5, 1, :clip => true) do
518
+ p.paragraph_xy(0, 3, LOREM, :width => 3, :height => 2)
519
+ end
520
+ p.path
521
+ p.rectangle(0, 6, 4.5, 3, :corners => [1])
522
+ p.clip do
523
+ p.print_image_file(TestImg, 0, 6, nil, 3)
524
+ end
525
+
526
+ p.path
527
+ p.circle(4.5, 3.5, 0.3)
528
+ p.circle(5.5, 3.5, 0.3)
529
+ p.circle(5, 4, 0.2)
530
+ p.arch(5, 4, 0.5, 0.9, 210, 330)
531
+ p.clip do
532
+ p.print_image_file(TestImg, 3.5, 3, 3)
533
+ end
534
+ end
535
+ end
536
+
537
+ def text_clipping(w)
538
+ w.page(:units => :in, :margins => 1) do |p|
539
+ p.print_xy(-0.5, -0.5, "Text Clipping", :underline => true)
540
+ # grid(p, 6.5, 9, 0, 0)
541
+ p.font('Helvetica', 144, :weight => 'Bold')
542
+ p.print_xy(0.25, 0.5, "ROSE", :clip => true, :stroke => true) do
543
+ p.print_image_file(TestImg, 0, 0, 6.5)
544
+ end
545
+ end
546
+ end
547
+
548
+ def text_encodings(w)
549
+ fonts = [
550
+ ['Helvetica', 'WinAnsiEncoding'],
551
+ ['Helvetica', 'ISO-8859-1'],
552
+ ['Helvetica', 'ISO-8859-2'],
553
+ ['Helvetica', 'ISO-8859-3'],
554
+ ['Helvetica', 'ISO-8859-4'],
555
+ ['Helvetica', 'ISO-8859-7'],
556
+ ['Helvetica', 'ISO-8859-9'],
557
+ ['Helvetica', 'ISO-8859-10'],
558
+ ['Helvetica', 'ISO-8859-13'],
559
+ ['Helvetica', 'ISO-8859-14'],
560
+ ['Helvetica', 'ISO-8859-15'],
561
+ ['Helvetica', 'ISO-8859-16'],
562
+ ['Times-Roman', 'CP1250'],
563
+ ['Times-Roman', 'CP1252'],
564
+ ['Times-Roman', 'CP1254'],
565
+ ['Courier', 'MacTurkish'],
566
+ ['Courier', 'Macintosh'],
567
+ # ['Times-Roman', 'WinAnsiEncoding'],
568
+ # ['Courier', 'WinAnsiEncoding'],
569
+ ['Symbol', 'StandardEncoding'],
570
+ ['ZapfDingbats', 'StandardEncoding']
571
+ ]
572
+ fonts.each do |name, encoding|
573
+ w.page(:units => :in, :margins => 0.5) do |p|
574
+ p.print "#{name} - #{encoding}", :underline => true
575
+ p.font 'Courier', 10
576
+ p.move_to 0, 0.5
577
+ stops = (1..16).map { |stop| stop.quo(2.3) }
578
+ p.tabs stops
579
+ 16.times do |offset|
580
+ p.tab { 1 / 2.3 }
581
+ p.print offset.to_s(16).upcase
582
+ end
583
+ p.font name, 16, :encoding => encoding
584
+ 32.upto(255) do |i|
585
+ p.tab { 1 / 2.3 }
586
+ p.print i.chr
587
+ end
588
+ p.vtabs stops.map { |stop| stop + 0.5 }
589
+ p.move_to 0, 0
590
+ p.font 'Courier', 10
591
+ 2.upto(15) do |offset|
592
+ p.vtab
593
+ p.print offset.to_s(16).upcase, :align => :left
594
+ end
595
+ end
596
+ end
597
+ end
598
+
599
+ def bullets(w)
600
+ w.page(:units => :in, :margins => 0.5) do |p|
601
+ p.puts("Bullets", :underline => true)
602
+ p.new_line
603
+ p.font('Helvetica', 12)
604
+ p.v_text_align :top
605
+
606
+ lines = LOREM.split('.').map { |sentence| sentence << '.' }
607
+ p.bullet(:star, :width => 0.25) do |w|
608
+ prev_font = w.font('ZapfDingbats', 12)
609
+ w.print(0x4E.chr)
610
+ w.font(prev_font)
611
+ end
612
+ p.bullet('diamond', :width => 0.635, :units => :cm) do |w|
613
+ prev_font = w.font('Symbol', 12)
614
+ w.print(0xA8.chr)
615
+ w.font(prev_font)
616
+ end
617
+ r = p.text_height.quo(3)
618
+ p.bullet(:triangle, :width => 0.25) do |w|
619
+ pos = w.pen_pos
620
+ w.circle(pos.x + r, pos.y + r, r)
621
+ end
622
+
623
+ lines.each { |para| p.paragraph(para, :bullet => :star) }
624
+ lines.each { |para| p.paragraph(para, :bullet => :diamond, :align => :justify) }
625
+ lines.each { |para| p.paragraph(para, :bullet => :triangle) }
626
+ end
627
+ end
628
+
629
+ def rich_text(w)
630
+ w.page(:units => :in, :margins => 0.5) do |p|
631
+ p.puts("Rich Text", :underline => true)
632
+ p.new_line
633
+
634
+ rt = EideticPDF::PdfText::RichText.new
635
+ p.font('Helvetica', 12)
636
+ rt.add("Here is some ", p.font)
637
+ p.font('Helvetica', 12, :weight => 'Bold')
638
+ rt.add("Bold", p.font)
639
+ p.font('Helvetica', 12)
640
+ rt.add(" text.", p.font)
641
+ p.paragraph(rt)
642
+
643
+ rt = EideticPDF::PdfText::RichText.new
644
+ p.font('Helvetica', 12)
645
+ rt.add("Here is some ", p.font)
646
+ p.font('Helvetica', 12, :style => 'Italic')
647
+ rt.add("Italic", p.font)
648
+ p.font('Helvetica', 12)
649
+ rt.add(" text.", p.font)
650
+ p.paragraph(rt)
651
+
652
+ rt = EideticPDF::PdfText::RichText.new
653
+ p.font('Helvetica', 12)
654
+ rt.add("Here is some ", p.font)
655
+ p.font('Helvetica', 12, :style => 'BoldItalic')
656
+ rt.add("Bold, Italic", p.font)
657
+ p.font('Helvetica', 12)
658
+ rt.add(" text.", p.font)
659
+ p.paragraph(rt)
660
+
661
+ rt = EideticPDF::PdfText::RichText.new
662
+ p.font('Helvetica', 12)
663
+ rt.add("Here is some ", p.font)
664
+ rt.add("Red", p.font, :color => 'Red')
665
+ rt.add(" text.", p.font)
666
+ p.paragraph(rt)
667
+
668
+ rt = EideticPDF::PdfText::RichText.new
669
+ p.font('Helvetica', 12)
670
+ rt.add("Here is some ", p.font)
671
+ rt.add("Underlined", p.font, :underline => true)
672
+ rt.add(" text.", p.font)
673
+ p.paragraph(rt)
674
+
675
+ rt = EideticPDF::PdfText::RichText.new
676
+ p.font('Helvetica', 12)
677
+ rt.add("This text is ", p.font)
678
+ p.font('Helvetica', 12, :weight => 'Bold')
679
+ rt.add("Bold. ", p.font)
680
+
681
+ p.font('Helvetica', 12)
682
+ rt.add("This text is ", p.font)
683
+ rt.add("Underlined", p.font, :underline => true)
684
+ rt.add(". ", p.font)
685
+
686
+ rt.add("This text is ", p.font)
687
+ rt.add("Red. ", p.font, :color => 'Red')
688
+
689
+ rt.add("This text is normal.", p.font)
690
+
691
+ p.paragraph(rt)
692
+ end
693
+ end
694
+
695
+ def angled_lines(w)
696
+ w.page(:units => :in, :margins => 0.5) do |p|
697
+ p.puts("Angled Lines", :underline => true)
698
+ p.new_line
699
+ x, y = 3.75, 5
700
+ p.line_color 'Black'
701
+ 0.upto(14) do |step|
702
+ p.line(x, y, step * 6, x)
703
+ end
704
+ p.line_color 'Red'
705
+ 15.upto(29) do |step|
706
+ p.line(x, y, step * 6, x)
707
+ end
708
+ p.line_color 'Green'
709
+ 30.upto(44) do |step|
710
+ p.line(x, y, step * 6, x)
711
+ end
712
+ p.line_color 'Blue'
713
+ 45.upto(59) do |step|
714
+ p.line(x, y, step * 6, x)
715
+ end
716
+ end
717
+ end
718
+
719
+ def rotations(w)
720
+ w.page(:units => :in, :margins => 0.5) do |p|
721
+ p.puts("Rotate", :underline => true)
722
+ p.line_dash_pattern :dashed
723
+ p.move_to(0, 2); p.line_to(p.canvas_width, 2)
724
+ p.move_to(p.canvas_width.quo(2), 0); p.line_to(p.canvas_width.quo(2), 4)
725
+ p.line_dash_pattern :dotted
726
+ 0.step(90, 30) do |angle|
727
+ p.rotate(angle, p.canvas_width.quo(2), 2) do
728
+ p.rectangle(p.canvas_width.quo(2), 2, 2, 1)
729
+ p.print_xy(p.canvas_width.quo(2) + 0.25, 2.25, "Hello")
730
+ end
731
+ end
732
+ p.line_dash_pattern :dashed
733
+ p.font("Helvetica", 12)
734
+ x, y = p.canvas_width.quo(2), p.canvas_height - 2
735
+ p.move_to(0, y); p.line_to(p.canvas_width, y)
736
+ p.move_to(x, y - 2); p.line_to(x, y + 2)
737
+ p.line_dash_pattern :dotted
738
+ p.rotate(30, x, y) do
739
+ p.rectangle(x - 2, y - 1.25, 4, 2.5)
740
+ p.paragraph_xy(x - 2, y - 1.25, LOREM, :width => 4, :height => 2.5)
741
+ end
742
+ end
743
+ end
744
+
745
+ def scaling(w)
746
+ w.page(:units => :in, :margins => 0.5) do |p|
747
+ p.puts("Scale", :underline => true)
748
+ 1.upto(10) { |i| p.move_to(0, i); p.line_to(0.125, i) }
749
+ p.line_dash_pattern :dotted
750
+ [[0.5, 1, 1.0, 1.0],
751
+ [0.5, 4, 0.75, 0.75],
752
+ [0.5, 7, 0.5, 0.5]
753
+ ].each do |parms|
754
+ p.scale(*parms) do
755
+ p.font("Helvetica", 12)
756
+ p.rectangle(0, 0, 4.0, 2.5)
757
+ p.paragraph_xy(0, 0, LOREM, :width => 4.0, :height => 2.5)
758
+ end
759
+ end
760
+ end
761
+ end
762
+
763
+ def justification(w)
764
+ width = 1.5
765
+ w.page(:units => :in, :margins => 0.5) do |p|
766
+ p.puts("Justification", :underline => true)
767
+ p.paragraph(LOREM, :align => :justify, :width => 7.5)
768
+ p.new_line
769
+ p.paragraph(LOREM, :align => :justify, :width => 3)
770
+ p.new_line
771
+ p.paragraph(LOREM + " abcdefghijklmnopqrstuvwxyz", :align => :justify, :width => width)
772
+ # p.move_to(width, 0); p.line_to(width, w.canvas_height)
773
+ end
774
+ end
775
+
776
+ start = Time.now
777
+ docw = EideticPDF::DocumentWriter.new
778
+
779
+ # docw.doc(:font => { :name => 'Courier', :size => 10 }, :orientation => :landscape, :pages_up => [3, 2], :pages_up_layout => :down) do |w|
780
+ docw.doc(:font => { :name => 'Courier', :size => 10 }, :built_in_fonts => BuiltInFonts) do |w|
781
+ justification(w)
782
+ scaling(w)
783
+ rotations(w)
784
+ angled_lines(w)
785
+ rich_text(w)
786
+ bullets(w)
787
+ print_text(w)
788
+ type1_font_names(w) # 1.9
789
+ truetype_font_names(w) if BuiltInFonts
790
+ stars(w)
791
+ polygons(w)
792
+ pies(w)
793
+ compound_paths(w)
794
+ filled_shapes(w)
795
+ circles_and_rectangles(w)
796
+ ellipses(w)
797
+ filled_rectangles(w)
798
+ line_widths_and_patterns(w)
799
+ print_angled_text_etc(w)
800
+ arcs(w)
801
+ pt_units(w)
802
+ cm_grid(w)
803
+ inch_grid(w)
804
+ dp_grid(w)
805
+ images(w) # 1.9
806
+ clipping(w) # 1.9
807
+ text_clipping(w) # 1.9
808
+ text_encodings(w) unless BuiltInFonts # 1.9
809
+ landscape_orientation(w)
810
+ end
811
+
812
+ File.open("test.pdf","w") { |f| f.write(docw) }
813
+
814
+ elapsed = Time.now - start
815
+ puts "Elapsed: #{(elapsed * 1000).round} ms"
816
+ `open test.pdf` if RUBY_PLATFORM =~ /darwin/ and ($0 !~ /rake_test_loader/ and $0 !~ /rcov/)