Lines Matching +full:font +full:- +full:size +(+path:plugin +path:dw2pdf) -(+path:plugin +path:dw2pdf +path:lang)

25 		$this->mpdf = $mpdf;
26 $this->writer = $writer;
31 $patternCount = count($this->mpdf->patterns);
35 $x = $this->mpdf->patterns[$i]['x'];
36 $y = $this->mpdf->patterns[$i]['y'];
37 $w = $this->mpdf->patterns[$i]['w'];
38 $h = $this->mpdf->patterns[$i]['h'];
39 $pgh = $this->mpdf->patterns[$i]['pgh'];
40 $orig_w = $this->mpdf->patterns[$i]['orig_w'];
41 $orig_h = $this->mpdf->patterns[$i]['orig_h'];
42 $image_id = $this->mpdf->patterns[$i]['image_id'];
43 $itype = $this->mpdf->patterns[$i]['itype'];
45 if (isset($this->mpdf->patterns[$i]['bpa'])) {
46 $bpa = $this->mpdf->patterns[$i]['bpa'];
51 if ($this->mpdf->patterns[$i]['x_repeat']) {
57 if ($this->mpdf->patterns[$i]['y_repeat']) {
63 $x_pos = $this->mpdf->patterns[$i]['x_pos'];
70 $x_pos = ($bpa['w'] * $x_pos) - ($orig_w / Mpdf::SCALE * $x_pos);
72 $x_pos = ($w * $x_pos) - ($orig_w / Mpdf::SCALE * $x_pos);
76 $y_pos = $this->mpdf->patterns[$i]['y_pos'];
83 $y_pos = ($bpa['h'] * $y_pos) - ($orig_h / Mpdf::SCALE * $y_pos);
85 $y_pos = ($h * $y_pos) - ($orig_h / Mpdf::SCALE * $y_pos);
96 $adj_y = (($pgh - $y_pos - $bpa['y']) * Mpdf::SCALE) - $orig_h;
98 $adj_y = (($pgh - $y_pos - $y) * Mpdf::SCALE) - $orig_h;
104 foreach ($this->mpdf->formobjects as $fo) {
108 $fo_h = -$fo['h'];
115 foreach ($this->mpdf->images as $img) {
127 $this->writer->object();
128 $this->writer->write('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
131 $this->writer->write('/XObject <</FO' . $image_id . ' ' . $img_obj . ' 0 R >>');
136 // This adds any resources associated with any FormObject to every Formobject - overkill but works!
137 if (count($this->mpdf->extgstates)) {
138 $this->writer->write('/ExtGState <<');
139 foreach ($this->mpdf->extgstates as $k => $extgstate) {
142 $this->writer->write('/' . $extgstate['trans'] . ' ' . $extgstate['n'] . ' 0 R');
144 $this->writer->write('/GS' . $k . ' ' . $extgstate['n'] . ' 0 R');
148 $this->writer->write('>>');
151 /* -- BACKGROUNDS -- */
152 if (isset($this->mpdf->gradients) && ( count($this->mpdf->gradients) > 0)) {
153 $this->writer->write('/Shading <<');
154 foreach ($this->mpdf->gradients as $id => $grad) {
156 $this->writer->write('/Sh' . $id . ' ' . $grad['id'] . ' 0 R');
159 $this->writer->write('>>');
162 /* -- END BACKGROUNDS -- */
163 $this->writer->write('/Font <<');
165 foreach ($this->mpdf->fonts as $font) {
166 if (!$font['used'] && $font['type'] === 'TTF') {
169 if (isset($font['fo']) && $font['fo']) {
170 if ($font['type'] === 'TTF' && ($font['sip'] || $font['smp'])) {
171 foreach ($font['n'] as $k => $fid) {
172 $this->writer->write('/F' . $font['subsetfontids'][$k] . ' ' . $font['n'][$k] . ' 0 R');
175 $this->writer->write('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
179 $this->writer->write('>>');
181 $this->writer->write('/XObject <</I' . $image_id . ' ' . $img_obj . ' 0 R >>');
184 $this->writer->write('>>');
185 $this->writer->write('endobj');
187 $this->writer->object();
188 $this->mpdf->patterns[$i]['n'] = $this->mpdf->n;
189 $this->writer->write('<< /Type /Pattern /PatternType 1 /PaintType 1 /TilingType 2');
190 $this->writer->write('/Resources ' . ($this->mpdf->n - 1) . ' 0 R');
192 $this->writer->write(sprintf('/BBox [0 0 %.3F %.3F]', $orig_w, $orig_h));
195 $this->writer->write(sprintf('/XStep %.3F', $orig_w));
197 $this->writer->write(sprintf('/XStep %d', 99999));
201 $this->writer->write(sprintf('/YStep %.3F', $orig_h));
203 $this->writer->write(sprintf('/YStep %d', 99999));
207 $this->writer->write(sprintf('/Matrix [1 0 0 -1 %.3F %.3F]', $adj_x, $adj_y + $orig_h));
208 $s = sprintf('q %.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $orig_w / $fo_w, -$orig_h / $fo_h, -($orig_w / $fo_w) * $wmf_x, ($orig_w / $fo_w) * $wmf_y, $image_id);
210 $this->writer->write(sprintf('/Matrix [1 0 0 1 %.3F %.3F]', $adj_x, $adj_y));
214 if ($this->mpdf->compress) {
215 $this->writer->write('/Filter /FlateDecode');
218 $this->writer->write('/Length ' . strlen($s) . '>>');
219 $this->writer->stream($s);
220 $this->writer->write('endobj');
226 $maxid = count($this->mpdf->gradients); // index for transparency gradients
228 foreach ($this->mpdf->gradients as $id => $grad) {
232 $this->writer->object();
233 $this->writer->write('<<');
234 $this->writer->write('/FunctionType 3');
235 $this->writer->write('/Domain [0 1]');
241 for ($i = 0; $i < (count($grad['stops']) - 1); $i++) {
242 $fn[] = ($this->mpdf->n + 1 + $i) . ' 0 R';
249 $this->writer->write('/Functions [' . implode(' ', $fn) . ']');
250 $this->writer->write('/Bounds [' . implode(' ', $bd) . ']');
251 $this->writer->write('/Encode [' . implode(' ', $en) . ']');
252 $this->writer->write('>>');
253 $this->writer->write('endobj');
255 $f1 = $this->mpdf->n;
257 for ($i = 0; $i < (count($grad['stops']) - 1); $i++) {
258 $this->writer->object();
259 $this->writer->write('<<');
260 $this->writer->write('/FunctionType 2');
261 $this->writer->write('/Domain [0 1]');
262 $this->writer->write('/C0 [' . $grad['stops'][$i]['col'] . ']');
263 $this->writer->write('/C1 [' . $grad['stops'][$i + 1]['col'] . ']');
264 $this->writer->write('/N 1');
265 $this->writer->write('>>');
266 $this->writer->write('endobj');
274 $this->writer->object();
275 $this->writer->write('<<');
276 $this->writer->write('/FunctionType 3');
277 $this->writer->write('/Domain [0 1]');
283 for ($i = 0; $i < (count($grad['stops']) - 1); $i++) {
284 $fn[] = ($this->mpdf->n + 1 + $i) . ' 0 R';
291 $this->writer->write('/Functions [' . implode(' ', $fn) . ']');
292 $this->writer->write('/Bounds [' . implode(' ', $bd) . ']');
293 $this->writer->write('/Encode [' . implode(' ', $en) . ']');
294 $this->writer->write('>>');
295 $this->writer->write('endobj');
297 $f2 = $this->mpdf->n;
299 for ($i = 0; $i < (count($grad['stops']) - 1); $i++) {
300 $this->writer->object();
301 $this->writer->write('<<');
302 $this->writer->write('/FunctionType 2');
303 $this->writer->write('/Domain [0 1]');
304 $this->writer->write(sprintf('/C0 [%.3F]', $grad['stops'][$i]['opacity']));
305 $this->writer->write(sprintf('/C1 [%.3F]', $grad['stops'][$i + 1]['opacity']));
306 $this->writer->write('/N 1');
307 $this->writer->write('>>');
308 $this->writer->write('endobj');
315 $this->writer->object();
316 $this->writer->write('<<');
317 $this->writer->write('/ShadingType ' . $grad['type']);
320 $this->writer->write('/ColorSpace /Device' . $grad['colorspace']); // Can use CMYK if all C0 and C1 above have 4 values
322 $this->writer->write('/ColorSpace /DeviceRGB');
326 $this->writer->write(sprintf('/Coords [%.3F %.3F %.3F %.3F]', $grad['coords'][0], $grad['coords'][1], $grad['coords'][2], $grad['coords'][3]));
327 $this->writer->write('/Function ' . $f1 . ' 0 R');
328 $this->writer->write('/Extend [' . $grad['extend'][0] . ' ' . $grad['extend'][1] . '] ');
329 $this->writer->write('>>');
337 $this->writer->write(sprintf('/Coords [%.3F %.3F %.3F %.3F %.3F %.3F]', $grad['coords'][0], $grad['coords'][1], $ir, $grad['coords'][2], $grad['coords'][3], $grad['coords'][4]));
338 $this->writer->write('/Function ' . $f1 . ' 0 R');
339 $this->writer->write('/Extend [' . $grad['extend'][0] . ' ' . $grad['extend'][1] . '] ');
340 $this->writer->write('>>');
342 $this->writer->write('/BitsPerCoordinate 16');
343 $this->writer->write('/BitsPerComponent 8');
345 $this->writer->write('/Decode[0 1 0 1 0 1 0 1 0 1 0 1]');
347 $this->writer->write('/Decode[0 1 0 1 0 1]');
349 $this->writer->write('/Decode[0 1 0 1 0 1 0 1 0 1]');
351 $this->writer->write('/BitsPerFlag 8');
352 $this->writer->write('/Length ' . strlen($grad['stream']));
353 $this->writer->write('>>');
354 $this->writer->stream($grad['stream']);
357 $this->writer->write('endobj');
360 $this->mpdf->gradients[$id]['id'] = $this->mpdf->n;
363 $this->writer->object();
365 $out .= ' /Shading ' . $this->mpdf->gradients[$id]['id'] . ' 0 R';
368 $this->writer->write($out);
371 $this->mpdf->gradients[$id]['pattern'] = $this->mpdf->n;
378 $this->writer->object();
379 $this->writer->write('<<');
380 $this->writer->write('/ShadingType ' . $grad['type']);
381 $this->writer->write('/ColorSpace /DeviceGray');
384 $this->writer->write(sprintf('/Coords [%.3F %.3F %.3F %.3F]', $grad['coords'][0], $grad['coords'][1], $grad['coords'][2], $grad['coords'][3]));
385 $this->writer->write('/Function ' . $f2 . ' 0 R');
386 $this->writer->write('/Extend [' . $grad['extend'][0] . ' ' . $grad['extend'][1] . '] ');
387 $this->writer->write('>>');
395 $this->writer->write(sprintf('/Coords [%.3F %.3F %.3F %.3F %.3F %.3F]', $grad['coords'][0], $grad['coords'][1], $ir, $grad['coords'][2], $grad['coords'][3], $grad['coords'][4]));
396 $this->writer->write('/Function ' . $f2 . ' 0 R');
397 $this->writer->write('/Extend [' . $grad['extend'][0] . ' ' . $grad['extend'][1] . '] ');
398 $this->writer->write('>>');
400 $this->writer->write('/BitsPerCoordinate 16');
401 $this->writer->write('/BitsPerComponent 8');
402 $this->writer->write('/Decode[0 1 0 1 0 1]');
403 $this->writer->write('/BitsPerFlag 8');
404 $this->writer->write('/Length ' . strlen($grad['stream_trans']));
405 $this->writer->write('>>');
406 $this->writer->stream($grad['stream_trans']);
408 $this->writer->write('endobj');
410 $this->mpdf->gradients[$transid]['id'] = $this->mpdf->n;
412 $this->writer->object();
413 $this->writer->write('<< /Type /Pattern /PatternType 2');
414 $this->writer->write('/Shading ' . $this->mpdf->gradients[$transid]['id'] . ' 0 R');
415 $this->writer->write('>>');
416 $this->writer->write('endobj');
418 $this->mpdf->gradients[$transid]['pattern'] = $this->mpdf->n;
419 $this->writer->object();
421 // Need to extend size of viewing box in case of transformations
422 $str = 'q /a0 gs /Pattern cs /p' . $transid . ' scn -' . ($this->mpdf->wPt / 2) . ' -' . ($this->mpdf->hPt / 2) . ' ' . (2 * $this->mpdf->wPt) . ' ' . (2 * $this->mpdf->hPt) . ' re f Q';
423 $filter = ($this->mpdf->compress) ? '/Filter /FlateDecode ' : '';
424 $p = ($this->mpdf->compress) ? gzcompress($str) : $str;
426 $this->writer->write('<< /Type /XObject /Subtype /Form /FormType 1 ' . $filter);
427 $this->writer->write('/Length ' . strlen($p));
428 $this->writer->write('/BBox [-' . ($this->mpdf->wPt / 2) . ' -' . ($this->mpdf->hPt / 2) . ' ' . (2 * $this->mpdf->wPt) . ' ' . (2 * $this->mpdf->hPt) . ']');
429 $this->writer->write('/Group << /Type /Group /S /Transparency /CS /DeviceGray >>');
430 $this->writer->write('/Resources <<');
431 $this->writer->write('/ExtGState << /a0 << /ca 1 /CA 1 >> >>');
432 $this->writer->write('/Pattern << /p' . $transid . ' ' . $this->mpdf->gradients[$transid]['pattern'] . ' 0 R >>');
433 $this->writer->write('>>');
434 $this->writer->write('>>');
435 $this->writer->stream($p);
436 $this->writer->write('endobj');
437 $this->writer->object();
438 $this->writer->write('<< /Type /Mask /S /Luminosity /G ' . ($this->mpdf->n - 1) . ' 0 R >>' . "\n" . 'endobj');
439 $this->writer->object();
440 $this->writer->write('<< /Type /ExtGState /SMask ' . ($this->mpdf->n - 1) . ' 0 R /AIS false >>' . "\n" . 'endobj');
443 $this->mpdf->extgstates[] = ['n' => $this->mpdf->n, 'trans' => 'TGS' . $id, 'fo' => true];
445 $this->mpdf->extgstates[] = ['n' => $this->mpdf->n, 'trans' => 'TGS' . $id];