| 1 | package PDF::Create::Page; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 18 | our $VERSION = '1.28'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =encoding utf8 | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | PDF::Create::Page - PDF pages tree for PDF::Create | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 VERSION | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Version 1.28 | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =cut | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 18 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 18 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 18 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 18 | ▶ | use FileHandle; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 18 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 18 | ▶ | use POSIX qw(setlocale LC_NUMERIC); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 18 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 18 | our $DEBUG = 0; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 18 | my $font_widths = &init_widths; | |||||||||||||||||||||||||||
| 29 | # Global variable for text function | ||||||||||||||||||||||||||||
| 30 | 18 | my $ptext = ''; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | B<FOR INTERNAL USE ONLY> | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =cut | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub new { | ||||||||||||||||||||||||||||
| 39 | 59 | ▶ | my ($this) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 59 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||
| 42 | 59 | my $self = {}; | |||||||||||||||||||||||||||
| 43 | 59 | bless $self, $class; | |||||||||||||||||||||||||||
| 44 | 59 | $self->{'Kids'} = []; | |||||||||||||||||||||||||||
| 45 | 59 | $self->{'Content'} = []; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 59 | return $self; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head1 METHODS | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head2 add($id, $name) | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | Adds a page to the PDF document. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | sub add { | ||||||||||||||||||||||||||||
| 59 | 36 | ▶ | my ($self, $id, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
add: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 36 | my $page = PDF::Create::Page->new(); | |||||||||||||||||||||||||||
| 62 | 36 | $page->{'pdf'} = $self->{'pdf'}; | |||||||||||||||||||||||||||
| 63 | 36 | weaken $page->{pdf}; | |||||||||||||||||||||||||||
| 64 | 36 | $page->{'Parent'} = $self; | |||||||||||||||||||||||||||
| 65 | 36 | weaken $page->{Parent}; | |||||||||||||||||||||||||||
| 66 | 36 | $page->{'id'} = $id; | |||||||||||||||||||||||||||
| 67 | 36 | $page->{'name'} = $name; | |||||||||||||||||||||||||||
| 68 | 36 | push @{$self->{'Kids'}}, $page; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 36 | return $page; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head2 count() | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Returns page count. | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =cut | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | sub count { | ||||||||||||||||||||||||||||
| 80 | 71 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
count: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 71 | my $c = 0; | |||||||||||||||||||||||||||
| 83 | 71 | ▶ | $c++ unless scalar @{$self->{'Kids'}}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 71 | foreach my $page (@{$self->{'Kids'}}) { | |||||||||||||||||||||||||||
| 85 | 48 | $c += $page->count; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 71 | return $c; | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head2 kids() | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Returns ref to a list of page ids. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | sub kids { | ||||||||||||||||||||||||||||
| 98 | 23 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
kids: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 23 | my $t = []; | |||||||||||||||||||||||||||
| 101 | 23 | map { push @$t, $_->{'id'} } @{$self->{'Kids'}}; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 23 | return $t; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =head2 list() | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | Returns page list. | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =cut | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | sub list { | ||||||||||||||||||||||||||||
| 113 | 42 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
list: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 42 | my @l; | |||||||||||||||||||||||||||
| 116 | 42 | foreach my $e (@{$self->{'Kids'}}) { | |||||||||||||||||||||||||||
| 117 | 30 | my @t = $e->list; | |||||||||||||||||||||||||||
| 118 | 30 | push @l, $e; | |||||||||||||||||||||||||||
| 119 | 30 | ▶ | push @l, @t if scalar @t; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 42 | return @l; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | =head2 new_page() | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | Return new page. | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =cut | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | sub new_page { | ||||||||||||||||||||||||||||
| 132 | 20 | ▶ | my ($self, @params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new_page: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 20 | return $self->{'pdf'}->new_page('Parent' => $self, @params); | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||
| 139 | # Drawing functions | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =head2 moveto($x, $y) | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | Moves the current point to (x, y), omitting any connecting line segment. | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =cut | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | sub moveto { | ||||||||||||||||||||||||||||
| 149 | 6 | ▶ | my ($self, $x, $y) = @_; | ||||||||||||||||||||||||||
|
Subroutine
moveto: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 6 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 152 | 6 | $self->{'pdf'}->add("$x $y m"); | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | =head2 lineto($x, $y) | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | Appends a straight line segment from the current point to (x, y). | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =cut | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | sub lineto { | ||||||||||||||||||||||||||||
| 162 | 366 | ▶ | my ($self, $x, $y) = @_; | ||||||||||||||||||||||||||
|
Subroutine
lineto: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 366 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 165 | 366 | $self->{'pdf'}->add("$x $y l"); | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | =head2 curveto($x1, $y1, $x2, $y2, $x3, $y3) | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | Appends a Bezier curve to the path. The curve extends from the current point to | ||||||||||||||||||||||||||||
| 171 | (x3 ,y3) using (x1 ,y1) and (x2 ,y2) as the Bezier control points.The new current | ||||||||||||||||||||||||||||
| 172 | point is (x3 ,y3). | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =cut | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | sub curveto { | ||||||||||||||||||||||||||||
| 177 | 4 | ▶ | my ($self, $x1, $y1, $x2, $y2, $x3, $y3) = @_; | ||||||||||||||||||||||||||
|
Subroutine
curveto: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 4 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 180 | 4 | $self->{'pdf'}->add("$x1 $y1 $x2 $y2 $x3 $y3 c"); | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | =head2 rectangle($x, $y, $w, $h) | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | Adds a rectangle to the current path. | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | =cut | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | sub rectangle { | ||||||||||||||||||||||||||||
| 190 | 0 | ▶ | my ($self, $x, $y, $w, $h) = @_; | ||||||||||||||||||||||||||
|
Subroutine
rectangle: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 193 | 0 | $self->{'pdf'}->add("$x $y $w $h re"); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | =head2 closepath() | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | Closes the current subpath by appending a straight line segment from the current | ||||||||||||||||||||||||||||
| 199 | point to the starting point of the subpath. | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | sub closepath { | ||||||||||||||||||||||||||||
| 204 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
closepath: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 207 | 0 | $self->{'pdf'}->add("h"); | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | =head2 newpath() | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | Ends the path without filling or stroking it. | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | =cut | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | sub newpath { | ||||||||||||||||||||||||||||
| 217 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
newpath: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 5 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 220 | 5 | $self->{'pdf'}->add("n"); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | =head2 stroke() | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | Strokes the path. | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | =cut | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | sub stroke { | ||||||||||||||||||||||||||||
| 230 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stroke: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 6 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 233 | 6 | $self->{'pdf'}->add("S"); | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | =head2 closestroke() | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | Closes and strokes the path. | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =cut | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | sub closestroke { | ||||||||||||||||||||||||||||
| 243 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
closestroke: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 246 | 0 | $self->{'pdf'}->add("s"); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | =head2 fill() | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | Fills the path using the non-zero winding number rule. | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | =cut | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | sub fill { | ||||||||||||||||||||||||||||
| 256 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
fill: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 1 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 259 | 1 | $self->{'pdf'}->add("f"); | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | =head2 fill2() | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | Fills the path using the even-odd rule. | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =cut | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | sub fill2 { | ||||||||||||||||||||||||||||
| 269 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
fill2: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 272 | 0 | $self->{'pdf'}->add("f*"); | |||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | =head2 line($x1, $y1, $x2, $y2) | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | Draw a line between ($x1, $y1) and ($x2, $y2). Combined moveto / lineto / stroke | ||||||||||||||||||||||||||||
| 278 | command. | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =cut | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | sub line { | ||||||||||||||||||||||||||||
| 283 | 56 | ▶ | my ($self, $x1, $y1, $x2, $y2) = @_; | ||||||||||||||||||||||||||
|
Subroutine
line: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 56 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 286 | 56 | $self->{'pdf'}->add("$x1 $y1 m $x2 $y2 l S"); | |||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =head2 set_width($w) | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | Set the width of subsequent lines to C<w> points. | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | =cut | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | sub set_width { | ||||||||||||||||||||||||||||
| 296 | 6 | ▶ | my ($self, $w) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_width: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 6 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 299 | 6 | $self->{'pdf'}->add("$w w"); | |||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | # | ||||||||||||||||||||||||||||
| 303 | # | ||||||||||||||||||||||||||||
| 304 | # Color functions | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =head2 setgray($value) | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | Sets the color space to DeviceGray and sets the gray tint to use for filling paths. | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | =cut | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | sub setgray { | ||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||
|
Subroutine
setgray: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 316 | 0 | $self->{'pdf'}->add("$val g"); | |||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | =head2 setgraystroke($value) | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | Sets the color space to DeviceGray and sets the gray tint to use for stroking paths. | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =cut | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | sub setgraystroke { | ||||||||||||||||||||||||||||
| 326 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||
|
Subroutine
setgraystroke: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 329 | 0 | $self->{'pdf'}->add("$val G"); | |||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | =head2 setrgbcolor($r, $g, $b) | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | Sets the fill colors used for normal text or filled objects. | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | =cut | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | sub setrgbcolor { | ||||||||||||||||||||||||||||
| 339 | 1 | ▶ | my ($self, $r, $g, $b) = @_; | ||||||||||||||||||||||||||
|
Subroutine
setrgbcolor: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 1 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 342 | 1 | $self->{'pdf'}->add("$r $g $b rg"); | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | =head2 setrgbcolorstroke($r, $g, $b) | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | Set the color of the subsequent drawing operations. Valid r, g, and b values are | ||||||||||||||||||||||||||||
| 348 | each between 0.0 and 1.0, inclusive. | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | Each color ranges from 0.0 to 1.0, i.e., darkest red (0.0) to brightest red(1.0). | ||||||||||||||||||||||||||||
| 351 | The same holds for green and blue. These three colors mix additively to produce | ||||||||||||||||||||||||||||
| 352 | the colors between black (0.0, 0.0, 0.0) and white (1.0, 1.0, 1.0). | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | PDF distinguishes between the stroke and fill operations and provides separate | ||||||||||||||||||||||||||||
| 355 | color settings for each. | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | =cut | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | sub setrgbcolorstroke { | ||||||||||||||||||||||||||||
| 360 | 4 | ▶ | my ($self, $r, $g, $b) = @_; | ||||||||||||||||||||||||||
|
Subroutine
setrgbcolorstroke: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | 4 | ▶ | croak "Error setting colors, need three values" if !defined $b; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 363 | 4 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 364 | 4 | $self->{'pdf'}->add("$r $g $b RG"); | |||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | # | ||||||||||||||||||||||||||||
| 368 | # | ||||||||||||||||||||||||||||
| 369 | # Text functions | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =head2 text(%params) | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | Renders the text. Parameters are explained as below: | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | +--------+------------------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 376 | | Key | Description | | ||||||||||||||||||||||||||||
| 377 | +--------+------------------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 378 | | start | The start marker, add directive BT | | ||||||||||||||||||||||||||||
| 379 | | end | The end marker, add directive ET | | ||||||||||||||||||||||||||||
| 380 | | text | Text to add to the pdf | | ||||||||||||||||||||||||||||
| 381 | | F | Font index to be used, add directive /F<font_index> | | ||||||||||||||||||||||||||||
| 382 | | Tf | Font size for the text, add directive <font_size> Tf | | ||||||||||||||||||||||||||||
| 383 | | Ts | Text rise (super/subscript), add directive <mode> Ts | | ||||||||||||||||||||||||||||
| 384 | | Tr | Text rendering mode, add directive <mode> Tr | | ||||||||||||||||||||||||||||
| 385 | | TL | Text leading, add directive <number> TL | | ||||||||||||||||||||||||||||
| 386 | | Tc | Character spacing, add directive <number> Tc | | ||||||||||||||||||||||||||||
| 387 | | Tw | Word spacing, add directive <number> Tw | | ||||||||||||||||||||||||||||
| 388 | | Tz | Horizontal scaling, add directive <number> Tz | | ||||||||||||||||||||||||||||
| 389 | | Td | Move to, add directive <x> <y> Td | | ||||||||||||||||||||||||||||
| 390 | | TD | Move to and set TL, add directive <x> <y> TD | | ||||||||||||||||||||||||||||
| 391 | | rot | Move to and rotate (<r> <x> <y>), add directive | | ||||||||||||||||||||||||||||
| 392 | | | <cos(r)>, <sin(r)>, <sin(r)>, <cos(r)>, <x>, <y> Tm | | ||||||||||||||||||||||||||||
| 393 | | T* | Add new line. | | ||||||||||||||||||||||||||||
| 394 | +--------+------------------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | =cut | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | sub text { | ||||||||||||||||||||||||||||
| 399 | 0 | ▶ | my ($self, %params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
text: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | 0 | PDF::Create::debug( 2, "text(%params):" ); | |||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | 0 | my @directives = (); | |||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 0 | ▶ | if (defined $params{'start'}) { push @directives, "BT"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | # Font index | ||||||||||||||||||||||||||||
| 408 | 0 | ▶ | if (defined $params{'F'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 409 | 0 | push @directives, "/F$params{'F'}"; | |||||||||||||||||||||||||||
| 410 | 0 | $self->{'pdf'}->uses_font($self, $params{'F'}); | |||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||
| 412 | # Font size | ||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if (defined $params{'Tf'}) { push @directives, "$params{'Tf'} Tf"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 414 | # Text Rise (Super/Subscript) | ||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if (defined $params{'Ts'}) { push @directives, "$params{'Ts'} Ts"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 416 | # Rendering Mode | ||||||||||||||||||||||||||||
| 417 | 0 | ▶ | if (defined $params{'Tr'}) { push @directives, "$params{'Tr'} Tr"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | # Text Leading | ||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if (defined $params{'TL'}) { push @directives, "$params{'TL'} TL"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | # Character spacing | ||||||||||||||||||||||||||||
| 421 | 0 | ▶ | if (defined $params{'Tc'}) { push @directives, "$params{'Tc'} Tc"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | # Word Spacing | ||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if (defined $params{'Tw'}) { push @directives, "$params{'Tw'} Tw"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | # Horizontal Scaling | ||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if (defined $params{'Tz'}) { push @directives, "$params{'Tz'} Tz"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 426 | # Moveto | ||||||||||||||||||||||||||||
| 427 | 0 | ▶ | if (defined $params{'Td'}) { push @directives, "$params{'Td'} Td"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 428 | # Moveto and set TL | ||||||||||||||||||||||||||||
| 429 | 0 | ▶ | if (defined $params{'TD'}) { push @directives, "$params{'TD'} TD"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | # Moveto and rotateOA | ||||||||||||||||||||||||||||
| 432 | 0 | my $pi = atan2(1, 1) * 4; | |||||||||||||||||||||||||||
| 433 | 0 | my $piover180 = $pi / 180; | |||||||||||||||||||||||||||
| 434 | 0 | ▶ | if (defined $params{'rot'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 435 | 0 | my ($r, $x, $y) = split( /\s+/, $params{'rot'}, 3 ); | |||||||||||||||||||||||||||
| 436 | 0 | ▶ | $x = 0 unless ($x > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 437 | 0 | ▶ | $y = 0 unless ($y > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 438 | 0 | my $cos = cos($r * $piover180); | |||||||||||||||||||||||||||
| 439 | 0 | my $sin = sin($r * $piover180); | |||||||||||||||||||||||||||
| 440 | 0 | push @directives, sprintf("%.5f %.5f -%.5f %.5f %s %s Tm", $cos, $sin, $sin, $cos, $x, $y); | |||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | # New line | ||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if (defined $params{'T*'}) { push @directives, "T*"; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 0 | ▶ | if (defined $params{'text'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 447 | 0 | $params{'text'} =~ s|([()])|\\$1|g; | |||||||||||||||||||||||||||
| 448 | 0 | push @directives, "($params{'text'}) Tj"; | |||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 0 | ▶ | if (defined $params{'end'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 452 | 0 | push @directives, "ET"; | |||||||||||||||||||||||||||
| 453 | 0 | $ptext = join(' ', @directives); | |||||||||||||||||||||||||||
| 454 | 0 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 455 | 0 | $self->{'pdf'}->add($ptext); | |||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 0 | PDF::Create::debug( 3, "text(): $ptext" ); | |||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 0 | 1; | |||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | =head2 string($font, $size, $x, $y, $text $alignment) | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | Add text to the current page using the font object at the given size and position. | ||||||||||||||||||||||||||||
| 466 | The point (x, y) is the bottom left corner of the rectangle containing the text. | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | The optional alignment can be 'r' for right-alignment and 'c' for centered. | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | Example : | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | my $f1 = $pdf->font( | ||||||||||||||||||||||||||||
| 473 | 'Subtype' => 'Type1', | ||||||||||||||||||||||||||||
| 474 | 'Encoding' => 'WinAnsiEncoding', | ||||||||||||||||||||||||||||
| 475 | 'BaseFont' => 'Helvetica' | ||||||||||||||||||||||||||||
| 476 | ); | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | $page->string($f1, 20, 306, 396, "some text"); | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | =cut | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | sub string { | ||||||||||||||||||||||||||||
| 483 | 10 | ▶ | my ($self, $font, $size, $x, $y, $string, $align, | ||||||||||||||||||||||||||
|
Subroutine
string: called CC=8 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||
| 484 | $char_spacing, $word_spacing) = @_; | ||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||
| 486 | 10 | ▶ | $align = 'L' unless defined $align; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | 10 | ▶ | if (uc($align) eq "R") { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 489 | 1 | $x -= $size * $self->string_width($font, $string); | |||||||||||||||||||||||||||
| 490 | } elsif (uc($align) eq "C") { | ||||||||||||||||||||||||||||
| 491 | 2 | $x -= $size * $self->string_width($font, $string) / 2; | |||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | 10 | my @directives = ( | |||||||||||||||||||||||||||
| 495 | 'BT', | ||||||||||||||||||||||||||||
| 496 | "/F$font", | ||||||||||||||||||||||||||||
| 497 | "$size Tf", | ||||||||||||||||||||||||||||
| 498 | ); | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 10 | ▶ | if (defined $char_spacing && $char_spacing =~ m/[0-9]+\.?[0-9]*/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $char_spacing and $char_spacing =~ /[0-9]+\.?[0-9]*/
MC/DC0%0/2
defined $char_spacing and $char_spacing =~ /[0-9]+\.?[0-9]*/
defined $char_spacing
$char_spacing =~ /[0-9]+\.?[0-9]*/
Truth table33%1/3
A and B
A= defined $char_spacingB= $char_spacing =~ /[0-9]+\.?[0-9]*/
| |||||||||||||||||||||||||||||
| 501 | 0 | push @directives, sprintf("%s Tc", $char_spacing); | |||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | 10 | ▶ | if (defined $word_spacing && $word_spacing =~ m/[0-9]+\.?[0-9]*/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $word_spacing and $word_spacing =~ /[0-9]+\.?[0-9]*/
MC/DC0%0/2
defined $word_spacing and $word_spacing =~ /[0-9]+\.?[0-9]*/
defined $word_spacing
$word_spacing =~ /[0-9]+\.?[0-9]*/
Truth table33%1/3
A and B
A= defined $word_spacingB= $word_spacing =~ /[0-9]+\.?[0-9]*/
| |||||||||||||||||||||||||||||
| 505 | 0 | push @directives, sprintf("%s Tw", $word_spacing); | |||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | 10 | $string =~ s|([()])|\\$1|g; | |||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | 10 | push @directives, | |||||||||||||||||||||||||||
| 511 | "$x $y Td", | ||||||||||||||||||||||||||||
| 512 | "($string) Tj", | ||||||||||||||||||||||||||||
| 513 | 'ET'; | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | 10 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 516 | 10 | $self->{'pdf'}->uses_font($self, $font); | |||||||||||||||||||||||||||
| 517 | 10 | $self->{'pdf'}->add(join(' ', @directives)); | |||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | =head2 string_underline($font, $size, $x, $y, $text, $alignment) | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | Draw a line for underlining.The parameters are the same as for the string function | ||||||||||||||||||||||||||||
| 523 | but only the line is drawn. To draw an underlined string you must call both,string | ||||||||||||||||||||||||||||
| 524 | and string_underline. To change the color of your text use the C<setrgbcolor()>. | ||||||||||||||||||||||||||||
| 525 | It returns the length of the string. So its return value can be used directly for | ||||||||||||||||||||||||||||
| 526 | the bounding box of an annotation. | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | Example : | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | $page->string($f1, 20, 306, 396, "some underlined text"); | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | $page->string_underline($f1, 20, 306, 396, "some underlined text"); | ||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||
| 534 | =cut | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | sub string_underline { | ||||||||||||||||||||||||||||
| 537 | 6 | ▶ | my ($self, $font, $size, $x, $y, $string, $align) = @_; | ||||||||||||||||||||||||||
|
Subroutine
string_underline: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | 6 | ▶ | $align = 'L' unless defined $align; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 540 | 6 | my $len1 = $self->string_width($font, $string) * $size; | |||||||||||||||||||||||||||
| 541 | 6 | my $len2 = $len1 / 2; | |||||||||||||||||||||||||||
| 542 | 6 | ▶ | if (uc($align) eq "R") { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 543 | 1 | $self->line($x - $len1, $y - 1, $x, $y - 1); | |||||||||||||||||||||||||||
| 544 | } elsif (uc($align) eq "C") { | ||||||||||||||||||||||||||||
| 545 | 2 | $self->line($x - $len2, $y - 1, $x + $len2, $y - 1); | |||||||||||||||||||||||||||
| 546 | } else { | ||||||||||||||||||||||||||||
| 547 | 3 | $self->line($x, $y - 1, $x + $len1, $y - 1); | |||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||
| 550 | 6 | return $len1; | |||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | =head2 stringl($font, $size, $x, $y $text) | ||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||
| 555 | Same as C<string()>. | ||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | =cut | ||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||
| 559 | sub stringl { | ||||||||||||||||||||||||||||
| 560 | 11 | ▶ | my ($self, $font, $size, $x, $y, $string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stringl: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||
| 562 | 11 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 563 | 11 | $self->{'pdf'}->uses_font($self, $font); | |||||||||||||||||||||||||||
| 564 | 11 | $string =~ s|([()])|\\$1|g; | |||||||||||||||||||||||||||
| 565 | 11 | $self->{'pdf'}->add("BT /F$font $size Tf $x $y Td ($string) Tj ET"); | |||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | =head2 stringr($font, $size, $x, $y, $text) | ||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | Same as C<string()> but right aligned (alignment 'r'). | ||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | =cut | ||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||
| 574 | sub stringr { | ||||||||||||||||||||||||||||
| 575 | 1 | ▶ | my ($self, $font, $size, $x, $y, $string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stringr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | 1 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 578 | 1 | $self->{'pdf'}->uses_font($self, $font); | |||||||||||||||||||||||||||
| 579 | 1 | $x -= $size * $self->string_width($font, $string); | |||||||||||||||||||||||||||
| 580 | 1 | $string =~ s|([()])|\\$1|g; | |||||||||||||||||||||||||||
| 581 | 1 | $self->{'pdf'}->add(" BT /F$font $size Tf $x $y Td ($string) Tj ET"); | |||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||
| 584 | =head2 stringc($font, $size, $x, $y, $text) | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | Same as C<string()> but centered (alignment 'c'). | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | =cut | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | sub stringc { | ||||||||||||||||||||||||||||
| 591 | 61 | ▶ | my ($self, $font, $size, $x, $y, $string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stringc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | 61 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 594 | 61 | $self->{'pdf'}->uses_font($self, $font); | |||||||||||||||||||||||||||
| 595 | 61 | $x -= $size * $self->string_width($font, $string) / 2; | |||||||||||||||||||||||||||
| 596 | 61 | $string =~ s|([()])|\\$1|g; | |||||||||||||||||||||||||||
| 597 | 61 | $self->{'pdf'}->add(" BT /F$font $size Tf $x $y Td ($string) Tj ET"); | |||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | =head2 string_width($font, $text) | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | Return the size of the text using the given font in default user space units.This | ||||||||||||||||||||||||||||
| 603 | does not contain the size of the font yet, to get the length you must multiply by | ||||||||||||||||||||||||||||
| 604 | the font size. | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | =cut | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | sub string_width { | ||||||||||||||||||||||||||||
| 609 | 71 | ▶ | my ($self, $font, $string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
string_width: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||
| 611 | 71 | ▶ | croak 'No string given' unless defined $string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||
| 613 | 71 | my $fname = $self->{'pdf'}{'fonts'}{$font}{'BaseFont'}[1]; | |||||||||||||||||||||||||||
| 614 | 71 | ▶ | croak('Unknown font: ' . $fname) unless defined $$font_widths{$fname}[ ord "M" ]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | 71 | my $w = 0; | |||||||||||||||||||||||||||
| 617 | 71 | for my $c ( split '', $string ) { | |||||||||||||||||||||||||||
| 618 | 1391 | $w += $$font_widths{$fname}[ ord $c ]; | |||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | 71 | return $w / 1000; | |||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||
| 624 | =head2 printnl($text, $font, $size, $x, $y) | ||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | Similar to C<string()> but parses the string for newline and prints each part on | ||||||||||||||||||||||||||||
| 627 | a separate line. Lines spacing is the same as the font-size.Returns the number of | ||||||||||||||||||||||||||||
| 628 | lines. | ||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | Note the different parameter sequence.The first call should specify all parameters, | ||||||||||||||||||||||||||||
| 631 | font is the absolute minimum, a warning will be given for the missing y position | ||||||||||||||||||||||||||||
| 632 | and 800 will be assumed. All subsequent invocations can omit all but the string | ||||||||||||||||||||||||||||
| 633 | parameters. | ||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||
| 635 | ATTENTION:There is no provision for changing pages.If you run out of space on the | ||||||||||||||||||||||||||||
| 636 | current page this will draw the string(s) outside the page and it will be invisble. | ||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||
| 638 | =cut | ||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||
| 640 | sub printnl { | ||||||||||||||||||||||||||||
| 641 | 0 | ▶ | my ($self, $s, $font, $size, $x, $y) = @_; | ||||||||||||||||||||||||||
|
Subroutine
printnl: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||
| 643 | 0 | ▶ | $self->{'current_font'} = $font if defined $font; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 644 | 0 | ▶ | croak 'No font found !' if !defined $self->{'current_font'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||
| 646 | # set up current_x/y used in stringml | ||||||||||||||||||||||||||||
| 647 | 0 | ▶ | $self->{'current_y'} = $y if defined $y; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 648 | 0 | ▶ | carp 'No starting position given, using 800' if !defined $self->{'current_y'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 649 | 0 | ▶ | $self->{'current_y'} = 800 if !defined $self->{'current_y'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 650 | 0 | ▶ | $self->{'current_x'} = $x if defined $x; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 651 | 0 | ▶ | $self->{'current_x'} = 20 if !defined $self->{'current_x'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 652 | 0 | ▶ | $self->{'current_size'} = $size if defined $size; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 653 | 0 | ▶ | $self->{'current_size'} = 12 if !defined $self->{'current_size'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||
| 655 | # print the line(s) | ||||||||||||||||||||||||||||
| 656 | 0 | my $n = 0; | |||||||||||||||||||||||||||
| 657 | 0 | for my $line ( split '\n', $s ) { | |||||||||||||||||||||||||||
| 658 | 0 | $n++; | |||||||||||||||||||||||||||
| 659 | 0 | $self->string($self->{'current_font'}, $self->{'current_size'}, $self->{'current_x'}, $self->{'current_y'}, $line); | |||||||||||||||||||||||||||
| 660 | 0 | $self->{'current_y'} = $self->{'current_y'} - $self->{'current_size'}; | |||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||
| 663 | 0 | return $n; | |||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||
| 666 | =head2 block_text(\%params) | ||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||
| 668 | Add block of text to the page. Parameters are explained as below: | ||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||
| 670 | +------------+--------------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 671 | | Key | Description | | ||||||||||||||||||||||||||||
| 672 | +------------+--------------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 673 | | page | Object of type PDF::Create::Page | | ||||||||||||||||||||||||||||
| 674 | | font | Font index to be used. | | ||||||||||||||||||||||||||||
| 675 | | text | Text block to be used. | | ||||||||||||||||||||||||||||
| 676 | | font_size | Font size for the text. | | ||||||||||||||||||||||||||||
| 677 | | text_color | Text color as arrayref i.e. [r, g, b] | | ||||||||||||||||||||||||||||
| 678 | | line_width | Line width (in points) | | ||||||||||||||||||||||||||||
| 679 | | start_y | First row number (in points) when adding new page. | | ||||||||||||||||||||||||||||
| 680 | | end_y | Last row number (in points) when to add new page. | | ||||||||||||||||||||||||||||
| 681 | | x | x co-ordinate to start the text. | | ||||||||||||||||||||||||||||
| 682 | | y | y co-ordinate to start the text. | | ||||||||||||||||||||||||||||
| 683 | +------------+--------------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||
| 685 | =cut | ||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||
| 687 | sub block_text { | ||||||||||||||||||||||||||||
| 688 | 0 | ▶ | my ($self, $params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
block_text: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||
| 690 | 0 | my $page = $params->{page}; | |||||||||||||||||||||||||||
| 691 | 0 | my $font = $params->{font}; | |||||||||||||||||||||||||||
| 692 | 0 | my $text = $params->{text}; | |||||||||||||||||||||||||||
| 693 | 0 | my $font_size = $params->{font_size}; | |||||||||||||||||||||||||||
| 694 | 0 | my $text_color = $params->{text_color}; | |||||||||||||||||||||||||||
| 695 | 0 | my $line_width = $params->{line_width}; | |||||||||||||||||||||||||||
| 696 | 0 | my $start_y = $params->{start_y}; | |||||||||||||||||||||||||||
| 697 | 0 | my $end_y = $params->{end_y}; | |||||||||||||||||||||||||||
| 698 | 0 | my $x = $params->{x}; | |||||||||||||||||||||||||||
| 699 | 0 | my $y = $params->{y}; | |||||||||||||||||||||||||||
| 700 | 0 | my $one_space = $page->string_width($font, ' ') * $font_size; | |||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||
| 702 | 0 | my @lines = (); | |||||||||||||||||||||||||||
| 703 | 0 | foreach my $block (split /\n/, $text) { | |||||||||||||||||||||||||||
| 704 | 0 | my @words = split(/ /, $block); | |||||||||||||||||||||||||||
| 705 | 0 | my $para_last_line = 0; | |||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||
| 707 | 0 | ▶ | while (@words) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 708 | 0 | my $num_words = 1; | |||||||||||||||||||||||||||
| 709 | 0 | my $string_width = 0; | |||||||||||||||||||||||||||
| 710 | 0 | my $space_width = undef; | |||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | 0 | while (1) { | |||||||||||||||||||||||||||
| 713 | 0 | $string_width = $font_size * $page->string_width( | |||||||||||||||||||||||||||
| 714 | $font, _get_text(\@words, $num_words)); | ||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||
| 716 | # Shorter, try one more word | ||||||||||||||||||||||||||||
| 717 | 0 | ▶ | if ($string_width + $one_space < $line_width) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 718 | 0 | ▶ | if (scalar(@words) > $num_words) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 719 | 0 | $num_words++; | |||||||||||||||||||||||||||
| 720 | 0 | next; | |||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||
| 724 | 0 | ▶ | last if ($num_words == 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||
| 726 | # Longer, chop a word off, then space accordingly | ||||||||||||||||||||||||||||
| 727 | 0 | $para_last_line = scalar(@words) == $num_words; | |||||||||||||||||||||||||||
| 728 | 0 | ▶ | if ($string_width + $one_space > $line_width || $para_last_line) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$string_width + $one_space > $line_width or $para_last_line
MC/DC0%0/2
$string_width + $one_space > $line_width or $para_last_line
$string_width + $one_space > $line_width
$para_last_line
Truth table0%0/3
A or B
A= $string_width + $one_space > $line_widthB= $para_last_line
| |||||||||||||||||||||||||||||
| 729 | 0 | ▶ | unless ($para_last_line) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 730 | 0 | $num_words--; | |||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||
| 733 | 0 | $string_width = $font_size * $page->string_width( | |||||||||||||||||||||||||||
| 734 | $font, _get_text(\@words, $num_words)); | ||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||
| 736 | 0 | $space_width = ($line_width - $string_width) / $num_words; | |||||||||||||||||||||||||||
| 737 | 0 | last; | |||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||
| 741 | 0 | my %text_param = ( | |||||||||||||||||||||||||||
| 742 | start => 1, | ||||||||||||||||||||||||||||
| 743 | Tw => $space_width, | ||||||||||||||||||||||||||||
| 744 | F => $font, | ||||||||||||||||||||||||||||
| 745 | Tf => $font_size, | ||||||||||||||||||||||||||||
| 746 | Td => "$x $y", | ||||||||||||||||||||||||||||
| 747 | text => _get_text(\@words, $num_words), | ||||||||||||||||||||||||||||
| 748 | end => 1, | ||||||||||||||||||||||||||||
| 749 | ); | ||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||
| 751 | 0 | ▶ | if ($para_last_line) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 752 | 0 | delete $text_param{Tw}; | |||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||
| 755 | 0 | $page->text(%text_param); | |||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||
| 757 | 0 | ▶ | if ($y <= $end_y) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 758 | 0 | $y = $start_y; | |||||||||||||||||||||||||||
| 759 | 0 | $page = $page->{'Parent'}->new_page(); | |||||||||||||||||||||||||||
| 760 | 0 | $page->setrgbcolor(@$text_color); | |||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||
| 762 | else { | ||||||||||||||||||||||||||||
| 763 | 0 | $y -= int($font_size * 1.5); | |||||||||||||||||||||||||||
| 764 | 0 | ▶ | if ($para_last_line) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 765 | 0 | $y -= int($font_size * 1.5); | |||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | 0 | splice(@words, 0, $num_words); | |||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||
| 774 | =head2 image(%params) | ||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||
| 776 | Inserts an image. Parameters can be: | ||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||
| 778 | +----------------+----------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 779 | | Key | Description | | ||||||||||||||||||||||||||||
| 780 | +----------------+----------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 781 | | | | | ||||||||||||||||||||||||||||
| 782 | | image | Image id returned by PDF::image (required). | | ||||||||||||||||||||||||||||
| 783 | | | | | ||||||||||||||||||||||||||||
| 784 | | xpos, ypos | Position of image (required). | | ||||||||||||||||||||||||||||
| 785 | | | | | ||||||||||||||||||||||||||||
| 786 | | xalign, yalign | Alignment of image.0 is left/bottom, 1 is centered and 2 | | ||||||||||||||||||||||||||||
| 787 | | | is right, top. | | ||||||||||||||||||||||||||||
| 788 | | | | | ||||||||||||||||||||||||||||
| 789 | | xscale, yscale | Scaling of image. 1.0 is original size. | | ||||||||||||||||||||||||||||
| 790 | | | | | ||||||||||||||||||||||||||||
| 791 | | rotate | Rotation of image.0 is no rotation,2*pi is 360° rotation.| | ||||||||||||||||||||||||||||
| 792 | | | | | ||||||||||||||||||||||||||||
| 793 | | xskew, yskew | Skew of image. | | ||||||||||||||||||||||||||||
| 794 | | | | | ||||||||||||||||||||||||||||
| 795 | +----------------+----------------------------------------------------------+ | ||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||
| 797 | Example jpeg image: | ||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | # include a jpeg image with scaling to 20% size | ||||||||||||||||||||||||||||
| 800 | my $jpg = $pdf->image("image.jpg"); | ||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||
| 802 | $page->image( | ||||||||||||||||||||||||||||
| 803 | 'image' => $jpg, | ||||||||||||||||||||||||||||
| 804 | 'xscale' => 0.2, | ||||||||||||||||||||||||||||
| 805 | 'yscale' => 0.2, | ||||||||||||||||||||||||||||
| 806 | 'xpos' => 350, | ||||||||||||||||||||||||||||
| 807 | 'ypos' => 400 | ||||||||||||||||||||||||||||
| 808 | ); | ||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||
| 810 | =cut | ||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||
| 812 | sub image { | ||||||||||||||||||||||||||||
| 813 | 2 | ▶ | my ($self, %params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
image: called CC=22 SCAR=39.9
Pod
documented
| |||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||
| 815 | # Switch to the 'C' locale, we need printf floats with a '.', not a ',' | ||||||||||||||||||||||||||||
| 816 | 2 | my $savedLocale = setlocale(LC_NUMERIC); | |||||||||||||||||||||||||||
| 817 | 2 | setlocale(LC_NUMERIC,'C'); | |||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||
| 819 | 2 | ▶ | my $img = $params{'image'} || "1.2"; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'image'} || '1.2'
MC/DC0%0/1
$params{'image'} || '1.2'
$params{'image'}
Truth table50%1/2
A
A= $params{'image'}
| |||||||||||||||||||||||||||||
| 820 | 2 | my $image = $img->{num}; | |||||||||||||||||||||||||||
| 821 | 2 | ▶ | my $xpos = $params{'xpos'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'xpos'} || 0
MC/DC0%0/1
$params{'xpos'} || 0
$params{'xpos'}
Truth table50%1/2
A
A= $params{'xpos'}
| |||||||||||||||||||||||||||||
| 822 | 2 | ▶ | my $ypos = $params{'ypos'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'ypos'} || 0
MC/DC0%0/1
$params{'ypos'} || 0
$params{'ypos'}
Truth table50%1/2
A
A= $params{'ypos'}
| |||||||||||||||||||||||||||||
| 823 | 2 | ▶ | my $xalign = $params{'xalign'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'xalign'} || 0
MC/DC0%0/1
$params{'xalign'} || 0
$params{'xalign'}
Truth table50%1/2
A
A= $params{'xalign'}
| |||||||||||||||||||||||||||||
| 824 | 2 | ▶ | my $yalign = $params{'yalign'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'yalign'} || 0
MC/DC0%0/1
$params{'yalign'} || 0
$params{'yalign'}
Truth table50%1/2
A
A= $params{'yalign'}
| |||||||||||||||||||||||||||||
| 825 | 2 | ▶ | my $xscale = $params{'xscale'} || 1; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'xscale'} || 1
MC/DC0%0/1
$params{'xscale'} || 1
$params{'xscale'}
Truth table50%1/2
A
A= $params{'xscale'}
| |||||||||||||||||||||||||||||
| 826 | 2 | ▶ | my $yscale = $params{'yscale'} || 1; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'yscale'} || 1
MC/DC0%0/1
$params{'yscale'} || 1
$params{'yscale'}
Truth table50%1/2
A
A= $params{'yscale'}
| |||||||||||||||||||||||||||||
| 827 | 2 | ▶ | my $rotate = $params{'rotate'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'rotate'} || 0
MC/DC0%0/1
$params{'rotate'} || 0
$params{'rotate'}
Truth table50%1/2
A
A= $params{'rotate'}
| |||||||||||||||||||||||||||||
| 828 | 2 | ▶ | my $xskew = $params{'xskew'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'xskew'} || 0
MC/DC0%0/1
$params{'xskew'} || 0
$params{'xskew'}
Truth table50%1/2
A
A= $params{'xskew'}
| |||||||||||||||||||||||||||||
| 829 | 2 | ▶ | my $yskew = $params{'yskew'} || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$params{'yskew'} || 0
MC/DC0%0/1
$params{'yskew'} || 0
$params{'yskew'}
Truth table50%1/2
A
A= $params{'yskew'}
| |||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||
| 831 | 2 | $xscale *= $img->{width}; | |||||||||||||||||||||||||||
| 832 | 2 | $yscale *= $img->{height}; | |||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | 2 | ▶ | if ($xalign == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 835 | 0 | $xpos -= $xscale / 2; | |||||||||||||||||||||||||||
| 836 | } elsif ($xalign == 2) { | ||||||||||||||||||||||||||||
| 837 | 0 | $xpos -= $xscale; | |||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||
| 840 | 2 | ▶ | if ($yalign == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 841 | 0 | $ypos -= $yscale / 2; | |||||||||||||||||||||||||||
| 842 | } elsif ($yalign == 2) { | ||||||||||||||||||||||||||||
| 843 | 0 | $ypos -= $yscale; | |||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||
| 846 | 2 | $self->{'pdf'}->page_stream($self); | |||||||||||||||||||||||||||
| 847 | 2 | $self->{'pdf'}->uses_xobject( $self, $image ); | |||||||||||||||||||||||||||
| 848 | 2 | $self->{'pdf'}->add("q\n"); | |||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||
| 850 | # TODO: image: Merge position with rotate | ||||||||||||||||||||||||||||
| 851 | 2 | ▶ | $self->{'pdf'}->add("1 0 0 1 $xpos $ypos cm\n") | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$xpos or $ypos
MC/DC0%0/2
$xpos or $ypos
$xpos
$ypos
Truth table33%1/3
A or B
A= $xposB= $ypos
| |||||||||||||||||||||||||||||
| 852 | if ($xpos || $ypos); | ||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||
| 854 | 2 | ▶ | if ($rotate) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 855 | 0 | my $sinth = sin($rotate); | |||||||||||||||||||||||||||
| 856 | 0 | my $costh = cos($rotate); | |||||||||||||||||||||||||||
| 857 | 0 | $self->{'pdf'}->add("$costh $sinth -$sinth $costh 0 0 cm\n"); | |||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||
| 859 | 2 | ▶ | if ($xscale || $yscale) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$xscale or $yscale
MC/DC0%0/2
$xscale or $yscale
$xscale
$yscale
Truth table33%1/3
A or B
A= $xscaleB= $yscale
| |||||||||||||||||||||||||||||
| 860 | 2 | $self->{'pdf'}->add("$xscale 0 0 $yscale 0 0 cm\n"); | |||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||
| 862 | 2 | ▶ | if ($xskew || $yskew) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$xskew or $yskew
MC/DC0%0/2
$xskew or $yskew
$xskew
$yskew
Truth table33%1/3
A or B
A= $xskewB= $yskew
| |||||||||||||||||||||||||||||
| 863 | 0 | my $tana = sin($xskew) / cos($xskew); | |||||||||||||||||||||||||||
| 864 | 0 | my $tanb = sin($yskew) / cos($xskew); | |||||||||||||||||||||||||||
| 865 | 0 | $self->{'pdf'}->add("1 $tana $tanb 1 0 0 cm\n"); | |||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||
| 867 | 2 | $self->{'pdf'}->add("/Image$image Do\n"); | |||||||||||||||||||||||||||
| 868 | 2 | $self->{'pdf'}->add("Q\n"); | |||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||
| 870 | # Switch to the 'C' locale, we need printf floats with a '.', not a ',' | ||||||||||||||||||||||||||||
| 871 | 2 | setlocale(LC_NUMERIC,$savedLocale); | |||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||
| 874 | # Table with font widths for the supported fonts. | ||||||||||||||||||||||||||||
| 875 | sub init_widths | ||||||||||||||||||||||||||||
| 876 | { | ||||||||||||||||||||||||||||
| 877 | 18 | ▶ | { 'Courier' => [ 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||
|
Subroutine
init_widths: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 878 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 879 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 880 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 881 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 882 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 883 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 884 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 885 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 886 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 887 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 888 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 889 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599 ], | ||||||||||||||||||||||||||||
| 890 | 'Courier-Bold' => [ 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 891 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 892 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 893 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 894 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 895 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 896 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 897 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 898 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 899 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 900 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 901 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 902 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599 ], | ||||||||||||||||||||||||||||
| 903 | 'Courier-BoldOblique' => [ 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 904 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 905 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 906 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 907 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 908 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 909 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 910 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 911 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 912 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 913 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 914 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 915 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 916 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 917 | 599, 599, 599, 599 ], | ||||||||||||||||||||||||||||
| 918 | 'Courier-Oblique' => [ 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 919 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 920 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 921 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 922 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 923 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 924 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 925 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 926 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 927 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 928 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 929 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, | ||||||||||||||||||||||||||||
| 930 | 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599 ], | ||||||||||||||||||||||||||||
| 931 | 'Helvetica' => [ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 932 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 354, 555, | ||||||||||||||||||||||||||||
| 933 | 555, 888, 666, 220, 332, 332, 388, 583, 277, 332, 277, 277, 555, 555, 555, 555, 555, 555, | ||||||||||||||||||||||||||||
| 934 | 555, 555, 555, 555, 277, 277, 583, 583, 583, 555, 1014, 666, 666, 721, 721, 666, 610, 777, | ||||||||||||||||||||||||||||
| 935 | 721, 277, 499, 666, 555, 832, 721, 777, 666, 777, 721, 666, 610, 721, 666, 943, 666, 666, | ||||||||||||||||||||||||||||
| 936 | 610, 277, 277, 277, 468, 555, 221, 555, 555, 499, 555, 555, 277, 555, 555, 221, 221, 499, | ||||||||||||||||||||||||||||
| 937 | 221, 832, 555, 555, 555, 555, 332, 499, 277, 555, 499, 721, 499, 499, 499, 333, 259, 333, | ||||||||||||||||||||||||||||
| 938 | 583, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 939 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 332, | ||||||||||||||||||||||||||||
| 940 | 555, 555, 166, 555, 555, 555, 555, 190, 332, 555, 332, 332, 499, 499, 277, 555, 555, 555, | ||||||||||||||||||||||||||||
| 941 | 277, 277, 536, 349, 221, 332, 332, 555, 999, 999, 277, 610, 277, 332, 332, 332, 666, 332, | ||||||||||||||||||||||||||||
| 942 | 332, 332, 332, 277, 332, 332, 277, 332, 332, 332, 999, 277, 277, 277, 277, 277, 777, 277, | ||||||||||||||||||||||||||||
| 943 | 277, 277, 277, 277, 721, 277, 277, 610, 277, 999, 277, 369, 555, 277, 277, 277, 555, 777, | ||||||||||||||||||||||||||||
| 944 | 999, 364, 277, 277, 277, 277, 277, 888, 277, 277, 277, 277, 555, 277, 221, 610, 943, 610, | ||||||||||||||||||||||||||||
| 945 | 555, 277, 277, 277 ], | ||||||||||||||||||||||||||||
| 946 | 'Helvetica-Bold' => [ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 947 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 332, 473, 555, 555, 888, 721, 277, | ||||||||||||||||||||||||||||
| 948 | 332, 332, 388, 583, 277, 332, 277, 277, 555, 555, 555, 555, 555, 555, 555, 555, 555, 555, 332, 332, | ||||||||||||||||||||||||||||
| 949 | 583, 583, 583, 610, 974, 721, 721, 721, 721, 666, 610, 777, 721, 277, 555, 721, 610, 832, 721, 777, | ||||||||||||||||||||||||||||
| 950 | 666, 777, 721, 666, 610, 721, 666, 943, 666, 666, 610, 332, 277, 332, 583, 555, 277, 555, 610, 555, | ||||||||||||||||||||||||||||
| 951 | 610, 555, 332, 610, 610, 277, 277, 555, 277, 888, 610, 610, 610, 610, 388, 555, 332, 610, 555, 777, | ||||||||||||||||||||||||||||
| 952 | 555, 555, 499, 388, 279, 388, 583, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 953 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 954 | 277, 332, 555, 555, 166, 555, 555, 555, 555, 237, 499, 555, 332, 332, 610, 610, 277, 555, 555, 555, | ||||||||||||||||||||||||||||
| 955 | 277, 277, 555, 349, 277, 499, 499, 555, 999, 999, 277, 610, 277, 332, 332, 332, 721, 332, 332, 332, | ||||||||||||||||||||||||||||
| 956 | 332, 277, 332, 332, 277, 332, 332, 332, 999, 277, 277, 277, 277, 277, 777, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 957 | 721, 277, 277, 610, 277, 999, 277, 369, 555, 277, 277, 277, 610, 777, 999, 364, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 958 | 277, 888, 277, 277, 277, 277, 610, 277, 277, 610, 943, 610, 610, 277, 277, 277 ], | ||||||||||||||||||||||||||||
| 959 | 'Helvetica-BoldOblique' => [ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 960 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 332, 473, 555, | ||||||||||||||||||||||||||||
| 961 | 555, 888, 721, 277, 332, 332, 388, 583, 277, 332, 277, 277, 555, 555, 555, 555, 555, 555, | ||||||||||||||||||||||||||||
| 962 | 555, 555, 555, 555, 332, 332, 583, 583, 583, 610, 974, 721, 721, 721, 721, 666, 610, 777, | ||||||||||||||||||||||||||||
| 963 | 721, 277, 555, 721, 610, 832, 721, 777, 666, 777, 721, 666, 610, 721, 666, 943, 666, 666, | ||||||||||||||||||||||||||||
| 964 | 610, 332, 277, 332, 583, 555, 277, 555, 610, 555, 610, 555, 332, 610, 610, 277, 277, 555, | ||||||||||||||||||||||||||||
| 965 | 277, 888, 610, 610, 610, 610, 388, 555, 332, 610, 555, 777, 555, 555, 499, 388, 279, 388, | ||||||||||||||||||||||||||||
| 966 | 583, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 967 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 332, | ||||||||||||||||||||||||||||
| 968 | 555, 555, 166, 555, 555, 555, 555, 237, 499, 555, 332, 332, 610, 610, 277, 555, 555, 555, | ||||||||||||||||||||||||||||
| 969 | 277, 277, 555, 349, 277, 499, 499, 555, 999, 999, 277, 610, 277, 332, 332, 332, 721, 332, | ||||||||||||||||||||||||||||
| 970 | 332, 332, 332, 277, 332, 332, 277, 332, 332, 332, 999, 277, 277, 277, 277, 277, 777, 277, | ||||||||||||||||||||||||||||
| 971 | 277, 277, 277, 277, 721, 277, 277, 610, 277, 999, 277, 369, 555, 277, 277, 277, 610, 777, | ||||||||||||||||||||||||||||
| 972 | 999, 364, 277, 277, 277, 277, 277, 888, 277, 277, 277, 277, 610, 277, 277, 610, 943, 610, | ||||||||||||||||||||||||||||
| 973 | 610, 277, 277, 277 ], | ||||||||||||||||||||||||||||
| 974 | 'Helvetica-Oblique' => [ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 975 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 976 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 977 | 277, 354, 555, 555, 888, 666, 221, 332, 332, 388, 583, | ||||||||||||||||||||||||||||
| 978 | 277, 332, 277, 277, 555, 555, 555, 555, 555, 555, 555, | ||||||||||||||||||||||||||||
| 979 | 555, 555, 555, 277, 277, 583, 583, 583, 555, 1014, 666, | ||||||||||||||||||||||||||||
| 980 | 666, 721, 721, 666, 610, 777, 721, 277, 499, 666, 555, | ||||||||||||||||||||||||||||
| 981 | 832, 721, 777, 666, 777, 721, 666, 610, 721, 666, 943, | ||||||||||||||||||||||||||||
| 982 | 666, 666, 610, 277, 277, 277, 468, 555, 221, 555, 555, | ||||||||||||||||||||||||||||
| 983 | 499, 555, 555, 277, 555, 555, 221, 221, 499, 221, 832, | ||||||||||||||||||||||||||||
| 984 | 555, 555, 555, 555, 332, 499, 277, 555, 499, 721, 499, | ||||||||||||||||||||||||||||
| 985 | 499, 499, 333, 259, 333, 583, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 986 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 987 | 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 988 | 277, 277, 277, 277, 277, 277, 277, 332, 555, 555, 166, | ||||||||||||||||||||||||||||
| 989 | 555, 555, 555, 555, 190, 332, 555, 332, 332, 499, 499, | ||||||||||||||||||||||||||||
| 990 | 277, 555, 555, 555, 277, 277, 536, 349, 221, 332, 332, | ||||||||||||||||||||||||||||
| 991 | 555, 999, 999, 277, 610, 277, 332, 332, 332, 666, 332, | ||||||||||||||||||||||||||||
| 992 | 332, 332, 332, 277, 332, 332, 277, 332, 332, 332, 999, | ||||||||||||||||||||||||||||
| 993 | 277, 277, 277, 277, 277, 777, 277, 277, 277, 277, 277, | ||||||||||||||||||||||||||||
| 994 | 721, 277, 277, 610, 277, 999, 277, 369, 555, 277, 277, | ||||||||||||||||||||||||||||
| 995 | 277, 555, 777, 999, 364, 277, 277, 277, 277, 277, 888, | ||||||||||||||||||||||||||||
| 996 | 277, 277, 277, 277, 555, 277, 221, 610, 943, 610, 555, | ||||||||||||||||||||||||||||
| 997 | 277, 277, 277 ], | ||||||||||||||||||||||||||||
| 998 | 'Times-Bold' => [ 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 999 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 332, 554, 499, 499, 999, 832, 332, | ||||||||||||||||||||||||||||
| 1000 | 332, 332, 499, 569, 249, 332, 249, 277, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 332, 332, | ||||||||||||||||||||||||||||
| 1001 | 569, 569, 569, 499, 929, 721, 666, 721, 721, 666, 610, 777, 777, 388, 499, 777, 666, 943, 721, 777, | ||||||||||||||||||||||||||||
| 1002 | 610, 777, 721, 555, 666, 721, 721, 999, 721, 721, 666, 332, 277, 332, 580, 499, 332, 499, 555, 443, | ||||||||||||||||||||||||||||
| 1003 | 555, 443, 332, 499, 555, 277, 332, 555, 277, 832, 555, 499, 555, 555, 443, 388, 332, 555, 499, 721, | ||||||||||||||||||||||||||||
| 1004 | 499, 499, 443, 393, 219, 393, 519, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1005 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1006 | 249, 332, 499, 499, 166, 499, 499, 499, 499, 277, 499, 499, 332, 332, 555, 555, 249, 499, 499, 499, | ||||||||||||||||||||||||||||
| 1007 | 249, 249, 539, 349, 332, 499, 499, 499, 999, 999, 249, 499, 249, 332, 332, 332, 721, 332, 332, 332, | ||||||||||||||||||||||||||||
| 1008 | 332, 249, 332, 332, 249, 332, 332, 332, 999, 249, 249, 249, 249, 249, 777, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1009 | 721, 249, 249, 555, 249, 999, 249, 299, 499, 249, 249, 249, 666, 777, 999, 329, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1010 | 249, 721, 249, 249, 249, 277, 499, 249, 277, 499, 721, 555, 555, 249, 249, 249 ], | ||||||||||||||||||||||||||||
| 1011 | 'Times-BoldItalic' => [ 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1012 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 388, 554, 499, 499, 832, 777, 332, | ||||||||||||||||||||||||||||
| 1013 | 332, 332, 499, 569, 249, 332, 249, 277, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 332, 332, | ||||||||||||||||||||||||||||
| 1014 | 569, 569, 569, 499, 831, 666, 666, 666, 721, 666, 666, 721, 777, 388, 499, 666, 610, 888, 721, 721, | ||||||||||||||||||||||||||||
| 1015 | 610, 721, 666, 555, 610, 721, 666, 888, 666, 610, 610, 332, 277, 332, 569, 499, 332, 499, 499, 443, | ||||||||||||||||||||||||||||
| 1016 | 499, 443, 332, 499, 555, 277, 277, 499, 277, 777, 555, 499, 499, 499, 388, 388, 277, 555, 443, 666, | ||||||||||||||||||||||||||||
| 1017 | 499, 443, 388, 347, 219, 347, 569, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1018 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1019 | 249, 388, 499, 499, 166, 499, 499, 499, 499, 277, 499, 499, 332, 332, 555, 555, 249, 499, 499, 499, | ||||||||||||||||||||||||||||
| 1020 | 249, 249, 499, 349, 332, 499, 499, 499, 999, 999, 249, 499, 249, 332, 332, 332, 666, 332, 332, 332, | ||||||||||||||||||||||||||||
| 1021 | 332, 249, 332, 332, 249, 332, 332, 332, 999, 249, 249, 249, 249, 249, 721, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1022 | 721, 249, 249, 499, 249, 943, 249, 265, 499, 249, 249, 249, 610, 721, 943, 299, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1023 | 249, 721, 249, 249, 249, 277, 499, 249, 277, 499, 721, 499, 555, 249, 249, 249 ], | ||||||||||||||||||||||||||||
| 1024 | 'Times-Italic' => [ 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1025 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 332, 419, 499, 499, 832, 777, 332, | ||||||||||||||||||||||||||||
| 1026 | 332, 332, 499, 674, 249, 332, 249, 277, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 332, 332, | ||||||||||||||||||||||||||||
| 1027 | 674, 674, 674, 499, 919, 610, 610, 666, 721, 610, 610, 721, 721, 332, 443, 666, 555, 832, 666, 721, | ||||||||||||||||||||||||||||
| 1028 | 610, 721, 610, 499, 555, 721, 610, 832, 610, 555, 555, 388, 277, 388, 421, 499, 332, 499, 499, 443, | ||||||||||||||||||||||||||||
| 1029 | 499, 443, 277, 499, 499, 277, 277, 443, 277, 721, 499, 499, 499, 499, 388, 388, 277, 499, 443, 666, | ||||||||||||||||||||||||||||
| 1030 | 443, 443, 388, 399, 274, 399, 540, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1031 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1032 | 249, 388, 499, 499, 166, 499, 499, 499, 499, 213, 555, 499, 332, 332, 499, 499, 249, 499, 499, 499, | ||||||||||||||||||||||||||||
| 1033 | 249, 249, 522, 349, 332, 555, 555, 499, 888, 999, 249, 499, 249, 332, 332, 332, 610, 332, 332, 332, | ||||||||||||||||||||||||||||
| 1034 | 332, 249, 332, 332, 249, 332, 332, 332, 888, 249, 249, 249, 249, 249, 721, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1035 | 721, 249, 249, 499, 249, 888, 249, 275, 499, 249, 249, 249, 555, 721, 943, 309, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1036 | 249, 666, 249, 249, 249, 277, 499, 249, 277, 499, 666, 499, 499, 249, 249, 249 ], | ||||||||||||||||||||||||||||
| 1037 | 'Times-Roman' => [ 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1038 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 332, 407, 499, 499, 832, 777, 332, | ||||||||||||||||||||||||||||
| 1039 | 332, 332, 499, 563, 249, 332, 249, 277, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 277, 277, | ||||||||||||||||||||||||||||
| 1040 | 563, 563, 563, 443, 920, 721, 666, 666, 721, 610, 555, 721, 721, 332, 388, 721, 610, 888, 721, 721, | ||||||||||||||||||||||||||||
| 1041 | 555, 721, 666, 555, 610, 721, 721, 943, 721, 721, 610, 332, 277, 332, 468, 499, 332, 443, 499, 443, | ||||||||||||||||||||||||||||
| 1042 | 499, 443, 332, 499, 499, 277, 277, 499, 277, 777, 499, 499, 499, 499, 332, 388, 277, 499, 499, 721, | ||||||||||||||||||||||||||||
| 1043 | 499, 499, 443, 479, 199, 479, 540, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1044 | 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1045 | 249, 332, 499, 499, 166, 499, 499, 499, 499, 179, 443, 499, 332, 332, 555, 555, 249, 499, 499, 499, | ||||||||||||||||||||||||||||
| 1046 | 249, 249, 452, 349, 332, 443, 443, 499, 999, 999, 249, 443, 249, 332, 332, 332, 721, 332, 332, 332, | ||||||||||||||||||||||||||||
| 1047 | 332, 249, 332, 332, 249, 332, 332, 332, 999, 249, 249, 249, 249, 249, 721, 249, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1048 | 721, 249, 249, 499, 249, 888, 249, 275, 443, 249, 249, 249, 610, 721, 888, 309, 249, 249, 249, 249, | ||||||||||||||||||||||||||||
| 1049 | 249, 666, 249, 249, 249, 277, 499, 249, 277, 499, 721, 499, 499, 249, 249, 249 ], | ||||||||||||||||||||||||||||
| 1050 | 'Symbol' => [ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, | ||||||||||||||||||||||||||||
| 1051 | 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 333, 713, 500, 549, 833, 778, 439, | ||||||||||||||||||||||||||||
| 1052 | 333, 333, 500, 549, 250, 549, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, | ||||||||||||||||||||||||||||
| 1053 | 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333, 631, 722, 686, 889, 722, 722, | ||||||||||||||||||||||||||||
| 1054 | 768, 741, 556, 592, 611, 690, 439, 768, 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, | ||||||||||||||||||||||||||||
| 1055 | 494, 439, 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603, 439, 576, 713, 686, | ||||||||||||||||||||||||||||
| 1056 | 493, 686, 494, 480, 200, 480, 549, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, | ||||||||||||||||||||||||||||
| 1057 | 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, | ||||||||||||||||||||||||||||
| 1058 | 250, 620, 247, 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, | ||||||||||||||||||||||||||||
| 1059 | 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, | ||||||||||||||||||||||||||||
| 1060 | 768, 713, 713, 713, 713, 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, | ||||||||||||||||||||||||||||
| 1061 | 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384, 384, 384, 384, 494, 494, 494, 494, | ||||||||||||||||||||||||||||
| 1062 | 250, 329, 274, 686, 686, 686, 384, 384, 384, 384, 384, 384, 494, 494, 494, 250 ], | ||||||||||||||||||||||||||||
| 1063 | }; | ||||||||||||||||||||||||||||
| 1064 | } | ||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||
| 1066 | # | ||||||||||||||||||||||||||||
| 1067 | # | ||||||||||||||||||||||||||||
| 1068 | # PRIVATE METHODS | ||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||
| 1070 | sub _get_text ($$) { | ||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | my ($words, $num_words) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_get_text: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||
| 1073 | 0 | ▶ | if (scalar @$words < $num_words) { die @_ }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||
| 1075 | 0 | return join(' ', map { $$words[$_] } (0..($num_words-1))); | |||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||
| 1078 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||
| 1080 | Fabien Tassin | ||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||
| 1082 | GIF and JPEG-support: Michael Gross (info@mdgrosse.net) | ||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||
| 1084 | Maintenance since 2007: Markus Baertschi (markus@markus.org) | ||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||
| 1086 | =head1 REPOSITORY | ||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||
| 1088 | L<https://github.com/manwar/pdf-create> | ||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||
| 1090 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||
| 1092 | Copyright 1999-2001,Fabien Tassin.All rights reserved.It may be used and modified | ||||||||||||||||||||||||||||
| 1093 | freely, but I do request that this copyright notice remain attached to the file. | ||||||||||||||||||||||||||||
| 1094 | You may modify this module as you wish,but if you redistribute a modified version, | ||||||||||||||||||||||||||||
| 1095 | please attach a note listing the modifications you have made. | ||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||
| 1097 | Copyright 2007 Markus Baertschi | ||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||
| 1099 | Copyright 2010 Gary Lieberman | ||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||
| 1101 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||
| 1103 | This is free software; you can redistribute it and / or modify it under the same | ||||||||||||||||||||||||||||
| 1104 | terms as Perl 5.6.0. | ||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||
| 1106 | =cut | ||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||
| 1108 | 18 | 1; | |||||||||||||||||||||||||||