diff -Nru php-fpdf-1.7.dfsg/changelog.htm php-fpdf-1.8.1.dfsg/changelog.htm --- php-fpdf-1.7.dfsg/changelog.htm 2011-06-18 13:26:45.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/changelog.htm 2015-12-20 09:52:33.000000000 +0000 @@ -11,6 +11,23 @@

Changelog

+
v1.81 (2015-12-20)
+
+- Added GetPageWidth() and GetPageHeight().
+- Fixed a bug in SetXY().
+
+
v1.8 (2015-11-29)
+
+- PHP 5.1.0 or higher is now required.
+- The MakeFont utility now subsets fonts, which can greatly reduce font sizes.
+- Added ToUnicode CMaps to improve text extraction.
+- Added a parameter to AddPage() to rotate the page.
+- Added a parameter to SetY() to indicate whether the x position should be reset or not.
+- Added a parameter to Output() to specify the encoding of the name, and special characters are now properly encoded. Additionally the order of the first two parameters was reversed to be more logical (however the old order is still supported for compatibility).
+- The Error() method now throws an exception.
+- Adding contents before the first AddPage() or after Close() now raises an error.
+- Outputting text with no font selected now raises an error.
+
v1.7 (2011-06-18)
- The MakeFont utility has been completely rewritten and doesn't depend on ttf2pt1 anymore.
@@ -65,7 +82,7 @@
- Type1 font support.
- Added Baltic encoding.
-- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5 :
  * The line thickness was too large when printed under Windows 98 SE and ME.
  * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
+- The class now works internally in points with the origin at the bottom in order to avoid two bugs occurring with Acrobat 5:
  * The line thickness was too large when printed under Windows 98 SE and ME.
  * TrueType fonts didn't appear immediately inside the plug-in (a substitution font was used), one had to cause a window refresh to make them show up.
- It's no longer necessary to set the decimal separator as dot to produce valid documents.
- The clickable area in a cell was always on the left independently from the text alignment.
- JPEG images in CMYK mode appeared in inverted colors.
diff -Nru php-fpdf-1.7.dfsg/debian/changelog php-fpdf-1.8.1.dfsg/debian/changelog --- php-fpdf-1.7.dfsg/debian/changelog 2016-03-28 22:00:43.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/changelog 2016-05-27 10:14:40.000000000 +0000 @@ -1,8 +1,15 @@ -php-fpdf (3:1.7.dfsg-1.1ubuntu1) xenial; urgency=medium +php-fpdf (3:1.8.1.dfsg-2) unstable; urgency=medium - * Update to PHP7.0 dependencies (LP: #1563061). + * PHP 7.0 Transition Fix (Closes: #821574) - -- Nishanth Aravamudan Mon, 28 Mar 2016 14:30:59 -0700 + -- Alessandro De Zorzi Fri, 27 May 2016 12:13:56 +0200 + +php-fpdf (3:1.8.1.dfsg-1) unstable; urgency=medium + + * New upstream release (Closes: #811486) + * Bump standard version to 3.9.6 + + -- Alessandro De Zorzi Tue, 19 Jan 2016 14:00:07 +0100 php-fpdf (3:1.7.dfsg-1.1) unstable; urgency=medium diff -Nru php-fpdf-1.7.dfsg/debian/ChangeLog php-fpdf-1.8.1.dfsg/debian/ChangeLog --- php-fpdf-1.7.dfsg/debian/ChangeLog 2010-08-16 09:45:33.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/ChangeLog 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -2010-08-16 09:22 adezorzi - - * changelog: update after upload - -2010-08-12 09:22 adezorzi - - * control: fixed php-fpdf override disparity - -2010-08-09 09:12 adezorzi - - * changelog, control: read it - -2010-08-09 08:58 adezorzi - - * changelog, rules: migliorie - -2010-08-09 08:41 adezorzi - - * rules: dh_compress al punto giusto in sequenza - -2010-08-08 15:18 adezorzi - - * rules: aggiunta histo.htm - -2010-08-08 14:56 adezorzi - - * docs, rules: migliorie - -2010-08-08 09:23 adezorzi - - * patches/series: remove files - -2010-08-08 08:10 adezorzi - - * source/format: ini - -2010-08-08 08:09 adezorzi - - * source: ini empty dir - -2010-08-08 08:07 adezorzi - - * watch: initial - -2010-08-08 08:04 adezorzi - - * changelog: read it - -2010-08-04 12:29 adezorzi - - * README.Debian, README.source, compat, copyright, doc-base, docs, - index.htm, patches, patches/series, patches/tutorial.patch, - postinst, rules: file iniziali - -2010-08-04 12:23 adezorzi - - * control: control upgrade to standard version 3.9.0 - e aggiustamenti depends - -2010-08-04 12:23 adezorzi - - * changelog: last version of changelog after upgrade - http://ftp.de.debian.org/debian/pool/main/p/php-fpdf/php-fpdf_1.53.dfsg-6.1.dsc - -2010-08-04 12:18 adezorzi - - * .: new dir - diff -Nru php-fpdf-1.7.dfsg/debian/control php-fpdf-1.8.1.dfsg/debian/control --- php-fpdf-1.7.dfsg/debian/control 2016-03-28 22:00:43.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/control 2016-05-27 10:16:07.000000000 +0000 @@ -1,10 +1,9 @@ Source: php-fpdf Section: php Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Alessandro De Zorzi +Maintainer: Alessandro De Zorzi Build-Depends: debhelper (>= 7), libldap2-dev, libgdbm-dev, po-debconf, quilt -Standards-Version: 3.9.2 +Standards-Version: 3.9.6 Homepage: http://www.fpdf.org/ Package: php-fpdf diff -Nru php-fpdf-1.7.dfsg/debian/copyright php-fpdf-1.8.1.dfsg/debian/copyright --- php-fpdf-1.7.dfsg/debian/copyright 2010-08-04 12:27:37.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/copyright 2016-03-05 15:53:16.000000000 +0000 @@ -1,21 +1,36 @@ -This package was debianized by Alessandro De Zorzi on -4 Aug 2010. - -It was downloaded from . - -Previous maintainers: - - * Peter Eisentraut from 2004 to 2008. - -Copyright: - - 2001-2008 Olivier Plathey - -License: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software to use, copy, modify, distribute, sublicense, and/or sell -copies of the software, and to permit persons to whom the software is furnished -to do so. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: FPDF +Source: http://www.fpdf.org/ + +Files: * +Copyright: Copyright 2016 Olivier Plathey <8973aca5d7fe7c864043ba17456b9d5a-op392@contact.gandi.net> +License: permissive + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software to use, copy, modify, distribute, sublicense, and/or sell + copies of the software, and to permit persons to whom the software is furnished + to do so. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. + +Files: debian/* +Copyright: Copyright 2016 Alessandro De Zorzi +License: GPL-2+ + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + You should have received a copy of the GNU General Public + License along with this package; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + . + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file + `/usr/share/common-licenses/GPL-2'. diff -Nru php-fpdf-1.7.dfsg/debian/patches/series php-fpdf-1.8.1.dfsg/debian/patches/series --- php-fpdf-1.7.dfsg/debian/patches/series 2011-07-31 14:29:00.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -tutorial.patch diff -Nru php-fpdf-1.7.dfsg/debian/patches/tutorial.patch php-fpdf-1.8.1.dfsg/debian/patches/tutorial.patch --- php-fpdf-1.7.dfsg/debian/patches/tutorial.patch 2011-07-31 14:27:14.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/patches/tutorial.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -diff -u php-fpdf-1.7.dfsg/tutorial//tuto1.htm tutorial.new//tuto1.htm ---- php-fpdf-1.7.dfsg/tutorial//tuto1.htm 2011-06-18 15:41:49.000000000 +0200 -+++ tutorial.new//tuto1.htm 2011-07-31 16:05:20.000000000 +0200 -@@ -10,7 +10,7 @@ - Let's start with the classic example: -
-
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- $pdf = new FPDF();
- $pdf->AddPage();
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto1.php tutorial.new//tuto1.php
---- php-fpdf-1.7.dfsg/tutorial//tuto1.php	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto1.php	2011-07-31 16:03:53.000000000 +0200
-@@ -1,5 +1,5 @@
- AddPage();
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto2.htm tutorial.new//tuto2.htm
---- php-fpdf-1.7.dfsg/tutorial//tuto2.htm	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto2.htm	2011-07-31 16:05:15.000000000 +0200
-@@ -10,7 +10,7 @@
- Here's a two page example with header, footer and logo:
- 
-
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- class PDF extends FPDF
- {
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto2.php tutorial.new//tuto2.php
---- php-fpdf-1.7.dfsg/tutorial//tuto2.php	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto2.php	2011-07-31 16:03:58.000000000 +0200
-@@ -1,5 +1,5 @@
- 
- 
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- class PDF extends FPDF
- {
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto3.php tutorial.new//tuto3.php
---- php-fpdf-1.7.dfsg/tutorial//tuto3.php	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto3.php	2011-07-31 16:04:04.000000000 +0200
-@@ -1,5 +1,5 @@
- 
- 
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- class PDF extends FPDF
- {
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto4.php tutorial.new//tuto4.php
---- php-fpdf-1.7.dfsg/tutorial//tuto4.php	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto4.php	2011-07-31 16:04:09.000000000 +0200
-@@ -1,5 +1,5 @@
- 
- 
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- class PDF extends FPDF
- {
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto5.php tutorial.new//tuto5.php
---- php-fpdf-1.7.dfsg/tutorial//tuto5.php	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto5.php	2011-07-31 16:04:15.000000000 +0200
-@@ -1,5 +1,5 @@
- 
- 
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- class PDF extends FPDF
- {
-diff -u php-fpdf-1.7.dfsg/tutorial//tuto6.php tutorial.new//tuto6.php
---- php-fpdf-1.7.dfsg/tutorial//tuto6.php	2011-06-18 15:41:49.000000000 +0200
-+++ tutorial.new//tuto6.php	2011-07-31 16:04:20.000000000 +0200
-@@ -1,5 +1,5 @@
- 
- 
<?php
--require('fpdf.php');
-+require('fpdf/fpdf.php');
- 
- $pdf = new FPDF();
- $pdf->AddFont('Calligrapher','','calligra.php');
-@@ -184,7 +184,6 @@
- $pdf->Output();
- ?>
-
--

[Demo]

- -

About the euro symbol

- The euro character is not present in all encodings, and is not always placed at the same position: diff -Nru php-fpdf-1.7.dfsg/debian/postinst php-fpdf-1.8.1.dfsg/debian/postinst --- php-fpdf-1.7.dfsg/debian/postinst 2008-08-18 07:32:06.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/postinst 2016-03-05 14:42:07.000000000 +0000 @@ -1,4 +1,5 @@ -#!/bin/sh -e +#!/bin/sh +set -e if [ "$1" = configure ] && [ ! -L /usr/share/fpdf ] && dpkg --compare-versions "$2" lt-nl 1.53.dfsg-3; then rm -rf /usr/share/fpdf diff -Nru php-fpdf-1.7.dfsg/debian/rules php-fpdf-1.8.1.dfsg/debian/rules --- php-fpdf-1.7.dfsg/debian/rules 2015-12-20 13:46:45.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/rules 2016-03-05 16:40:08.000000000 +0000 @@ -2,6 +2,10 @@ include /usr/share/quilt/quilt.make +PKD = $(abspath $(dir $(MAKEFILE_LIST))) +PKG = 'php-fpdf' +VER = '1.8' + configure: configure-stamp configure-stamp: @@ -55,4 +59,7 @@ build-indep: build -.PHONY: build clean binary-indep binary install configure +get-orig-source: $(info I: $(PKG)_$(VER)) + uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD) + +.PHONY: build clean binary-indep binary install configure get-orig-source diff -Nru php-fpdf-1.7.dfsg/debian/source.lintian-overrides php-fpdf-1.8.1.dfsg/debian/source.lintian-overrides --- php-fpdf-1.7.dfsg/debian/source.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/debian/source.lintian-overrides 2016-03-05 16:35:45.000000000 +0000 @@ -0,0 +1 @@ +php-fpdf source: dfsg-version-with-period diff -Nru php-fpdf-1.7.dfsg/doc/acceptpagebreak.htm php-fpdf-1.8.1.dfsg/doc/acceptpagebreak.htm --- php-fpdf-1.7.dfsg/doc/acceptpagebreak.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/acceptpagebreak.htm 2015-12-20 09:39:19.000000000 +0000 @@ -52,11 +52,11 @@ $pdf->AddPage(); $pdf->SetFont('Arial','',12); for($i=1;$i<=300;$i++) - $pdf->Cell(0,5,"Line $i",0,1); + $pdf->Cell(0,5,"Line $i",0,1); $pdf->Output();

See also

-SetAutoPageBreak(). +SetAutoPageBreak
diff -Nru php-fpdf-1.7.dfsg/doc/addfont.htm php-fpdf-1.8.1.dfsg/doc/addfont.htm --- php-fpdf-1.7.dfsg/doc/addfont.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/addfont.htm 2015-12-20 09:39:19.000000000 +0000 @@ -48,7 +48,7 @@
$pdf->AddFont('Comic','I','comici.php');

See also

-SetFont(). +SetFont
diff -Nru php-fpdf-1.7.dfsg/doc/addlink.htm php-fpdf-1.8.1.dfsg/doc/addlink.htm --- php-fpdf-1.7.dfsg/doc/addlink.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/addlink.htm 2015-12-20 09:39:19.000000000 +0000 @@ -15,11 +15,11 @@ The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().

See also

-Cell(), -Write(), -Image(), -Link(), -SetLink(). +Cell, +Write, +Image, +Link, +SetLink
diff -Nru php-fpdf-1.7.dfsg/doc/addpage.htm php-fpdf-1.8.1.dfsg/doc/addpage.htm --- php-fpdf-1.7.dfsg/doc/addpage.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/addpage.htm 2015-12-20 09:39:19.000000000 +0000 @@ -7,7 +7,7 @@

AddPage

-AddPage([string orientation [, mixed size]]) +AddPage([string orientation [, mixed size [, int rotation]]])

Description

Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left @@ -44,12 +44,17 @@
The default value is the one passed to the constructor.
+
rotation
+
+Angle by which to rotate the page. It must be a multiple of 90; positive values +mean clockwise rotation. The default value is 0. +

See also

-FPDF(), -Header(), -Footer(), -SetMargins(). +__construct, +Header, +Footer, +SetMargins
Index
diff -Nru php-fpdf-1.7.dfsg/doc/aliasnbpages.htm php-fpdf-1.8.1.dfsg/doc/aliasnbpages.htm --- php-fpdf-1.7.dfsg/doc/aliasnbpages.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/aliasnbpages.htm 2015-12-20 09:39:19.000000000 +0000 @@ -37,8 +37,8 @@ $pdf->AliasNbPages();

See also

-PageNo(), -Footer(). +PageNo, +Footer
Index
diff -Nru php-fpdf-1.7.dfsg/doc/cell.htm php-fpdf-1.8.1.dfsg/doc/cell.htm --- php-fpdf-1.7.dfsg/doc/cell.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/cell.htm 2015-12-20 09:39:19.000000000 +0000 @@ -88,16 +88,16 @@ $pdf->Cell(20,10,'Title',1,1,'C');

See also

-SetFont(), -SetDrawColor(), -SetFillColor(), -SetTextColor(), -SetLineWidth(), -AddLink(), -Ln(), -MultiCell(), -Write(), -SetAutoPageBreak(). +SetFont, +SetDrawColor, +SetFillColor, +SetTextColor, +SetLineWidth, +AddLink, +Ln, +MultiCell, +Write, +SetAutoPageBreak
Index
diff -Nru php-fpdf-1.7.dfsg/doc/close.htm php-fpdf-1.8.1.dfsg/doc/close.htm --- php-fpdf-1.7.dfsg/doc/close.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/close.htm 2015-12-20 09:39:19.000000000 +0000 @@ -14,7 +14,7 @@
If the document contains no page, AddPage() is called to prevent from getting an invalid document.

See also

-Output(). +Output
Index
diff -Nru php-fpdf-1.7.dfsg/doc/__construct.htm php-fpdf-1.8.1.dfsg/doc/__construct.htm --- php-fpdf-1.7.dfsg/doc/__construct.htm 1970-01-01 00:00:00.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/__construct.htm 2015-12-20 09:39:19.000000000 +0000 @@ -0,0 +1,63 @@ + + + + +__construct + + + +

__construct

+__construct([string orientation [, string unit [, mixed size]]]) +

Description

+This is the class constructor. It allows to set up the page size, the orientation and the +unit of measure used in all methods (except for font sizes). +

Parameters

+
+
orientation
+
+Default page orientation. Possible values are (case insensitive): + +Default value is P. +
+
unit
+
+User unit. Possible values are: + +A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This +is a very common unit in typography; font sizes are expressed in that unit. +
+
+Default value is mm. +
+
size
+
+The size used for pages. It can be either one of the following values (case insensitive): + +or an array containing the width and the height (expressed in the unit given by unit).
+
+Default value is A4. +
+
+

Example

+Example with a custom 100x150 mm page size: +
+
$pdf = new FPDF('P','mm',array(100,150));
+
+
+
Index
+ + diff -Nru php-fpdf-1.7.dfsg/doc/error.htm php-fpdf-1.8.1.dfsg/doc/error.htm --- php-fpdf-1.7.dfsg/doc/error.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/error.htm 2015-12-20 09:39:19.000000000 +0000 @@ -9,9 +9,10 @@

Error

Error(string msg)

Description

-This method is automatically called in case of fatal error; it simply outputs the message -and halts the execution. An inherited class may override it to customize the error handling -but should always halt the script, or the resulting document would probably be invalid. +This method is automatically called in case of a fatal error; it simply throws an exception +with the provided message.
+An inherited class may override it to customize the error handling but the method should +never return, otherwise the resulting document would probably be invalid.

Parameters

msg
diff -Nru php-fpdf-1.7.dfsg/doc/footer.htm php-fpdf-1.8.1.dfsg/doc/footer.htm --- php-fpdf-1.7.dfsg/doc/footer.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/footer.htm 2015-12-20 09:39:19.000000000 +0000 @@ -28,7 +28,7 @@ }

See also

-Header(). +Header
Index
diff -Nru php-fpdf-1.7.dfsg/doc/fpdf.htm php-fpdf-1.8.1.dfsg/doc/fpdf.htm --- php-fpdf-1.7.dfsg/doc/fpdf.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/fpdf.htm 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ - - - - -FPDF - - - -

FPDF

-FPDF([string orientation [, string unit [, mixed size]]]) -

Description

-This is the class constructor. It allows to set up the page size, the orientation and the -unit of measure used in all methods (except for font sizes). -

Parameters

-
-
orientation
-
-Default page orientation. Possible values are (case insensitive): -
    -
  • P or Portrait
  • -
  • L or Landscape
  • -
-Default value is P. -
-
unit
-
-User unit. Possible values are: -
    -
  • pt: point
  • -
  • mm: millimeter
  • -
  • cm: centimeter
  • -
  • in: inch
  • -
-A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This -is a very common unit in typography; font sizes are expressed in that unit. -
-
-Default value is mm. -
-
size
-
-The size used for pages. It can be either one of the following values (case insensitive): -
    -
  • A3
  • -
  • A4
  • -
  • A5
  • -
  • Letter
  • -
  • Legal
  • -
-or an array containing the width and the height (expressed in the unit given by unit).
-
-Default value is A4. -
-
-

Example

-Example with a custom 100x150 mm page size: -
-
$pdf = new FPDF('P','mm',array(100,150));
-
-
-
Index
- - diff -Nru php-fpdf-1.7.dfsg/doc/getpageheight.htm php-fpdf-1.8.1.dfsg/doc/getpageheight.htm --- php-fpdf-1.7.dfsg/doc/getpageheight.htm 1970-01-01 00:00:00.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/getpageheight.htm 2015-12-20 09:39:19.000000000 +0000 @@ -0,0 +1,18 @@ + + + + +GetPageHeight + + + +

GetPageHeight

+float GetPageHeight() +

Description

+Returns the current page height. +

See also

+GetPageWidth +
+
Index
+ + diff -Nru php-fpdf-1.7.dfsg/doc/getpagewidth.htm php-fpdf-1.8.1.dfsg/doc/getpagewidth.htm --- php-fpdf-1.7.dfsg/doc/getpagewidth.htm 1970-01-01 00:00:00.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/getpagewidth.htm 2015-12-20 09:39:19.000000000 +0000 @@ -0,0 +1,18 @@ + + + + +GetPageWidth + + + +

GetPageWidth

+float GetPageWidth() +

Description

+Returns the current page width. +

See also

+GetPageHeight +
+
Index
+ + diff -Nru php-fpdf-1.7.dfsg/doc/getx.htm php-fpdf-1.8.1.dfsg/doc/getx.htm --- php-fpdf-1.7.dfsg/doc/getx.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/getx.htm 2015-12-20 09:39:19.000000000 +0000 @@ -11,9 +11,9 @@

Description

Returns the abscissa of the current position.

See also

-SetX(), -GetY(), -SetY(). +SetX, +GetY, +SetY
Index
diff -Nru php-fpdf-1.7.dfsg/doc/gety.htm php-fpdf-1.8.1.dfsg/doc/gety.htm --- php-fpdf-1.7.dfsg/doc/gety.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/gety.htm 2015-12-20 09:39:19.000000000 +0000 @@ -11,9 +11,9 @@

Description

Returns the ordinate of the current position.

See also

-SetY(), -GetX(), -SetX(). +SetY, +GetX, +SetX
Index
diff -Nru php-fpdf-1.7.dfsg/doc/header.htm php-fpdf-1.8.1.dfsg/doc/header.htm --- php-fpdf-1.7.dfsg/doc/header.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/header.htm 2015-12-20 09:39:19.000000000 +0000 @@ -30,7 +30,7 @@ }

See also

-Footer(). +Footer
Index
diff -Nru php-fpdf-1.7.dfsg/doc/image.htm php-fpdf-1.8.1.dfsg/doc/image.htm --- php-fpdf-1.7.dfsg/doc/image.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/image.htm 2015-12-20 09:39:19.000000000 +0000 @@ -92,7 +92,7 @@ $pdf->Image('http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World',60,30,90,0,'PNG');

See also

-AddLink(). +AddLink
Index
diff -Nru php-fpdf-1.7.dfsg/doc/index.htm php-fpdf-1.8.1.dfsg/doc/index.htm --- php-fpdf-1.7.dfsg/doc/index.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/index.htm 2015-12-20 09:39:19.000000000 +0000 @@ -2,11 +2,12 @@ -FPDF 1.7 Reference Manual +FPDF 1.81 Reference Manual -

FPDF 1.7 Reference Manual

+

FPDF 1.81 Reference Manual

+__construct - constructor
AcceptPageBreak - accept or not automatic page break
AddFont - add a new font
AddLink - create an internal link
@@ -16,7 +17,8 @@ Close - terminate the document
Error - fatal error
Footer - page footer
-FPDF - constructor
+GetPageHeight - get current page height
+GetPageWidth - get current page width
GetStringWidth - compute string length
GetX - get current x position
GetY - get current y position
@@ -50,7 +52,7 @@ SetTopMargin - set top margin
SetX - set current x position
SetXY - set current x and y positions
-SetY - set current y position
+SetY - set current y position and optionally reset x
Text - print a string
Write - print flowing text
diff -Nru php-fpdf-1.7.dfsg/doc/line.htm php-fpdf-1.8.1.dfsg/doc/line.htm --- php-fpdf-1.7.dfsg/doc/line.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/line.htm 2015-12-20 09:39:19.000000000 +0000 @@ -30,8 +30,8 @@

See also

-SetLineWidth(), -SetDrawColor(). +SetLineWidth, +SetDrawColor
Index
diff -Nru php-fpdf-1.7.dfsg/doc/link.htm php-fpdf-1.8.1.dfsg/doc/link.htm --- php-fpdf-1.7.dfsg/doc/link.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/link.htm 2015-12-20 09:39:19.000000000 +0000 @@ -36,10 +36,10 @@

See also

-AddLink(), -Cell(), -Write(), -Image(). +AddLink, +Cell, +Write, +Image
Index
diff -Nru php-fpdf-1.7.dfsg/doc/ln.htm php-fpdf-1.8.1.dfsg/doc/ln.htm --- php-fpdf-1.7.dfsg/doc/ln.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/ln.htm 2015-12-20 09:39:19.000000000 +0000 @@ -21,7 +21,7 @@

See also

-Cell(). +Cell
Index
diff -Nru php-fpdf-1.7.dfsg/doc/multicell.htm php-fpdf-1.8.1.dfsg/doc/multicell.htm --- php-fpdf-1.7.dfsg/doc/multicell.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/multicell.htm 2015-12-20 09:39:19.000000000 +0000 @@ -62,14 +62,14 @@

See also

-SetFont(), -SetDrawColor(), -SetFillColor(), -SetTextColor(), -SetLineWidth(), -Cell(), -Write(), -SetAutoPageBreak(). +SetFont, +SetDrawColor, +SetFillColor, +SetTextColor, +SetLineWidth, +Cell, +Write, +SetAutoPageBreak
Index
diff -Nru php-fpdf-1.7.dfsg/doc/output.htm php-fpdf-1.8.1.dfsg/doc/output.htm --- php-fpdf-1.7.dfsg/doc/output.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/output.htm 2015-12-20 09:39:19.000000000 +0000 @@ -7,35 +7,39 @@

Output

-string Output([string name, string dest]) +string Output([string dest [, string name [, boolean isUTF8]]])

Description

-Send the document to a given destination: browser, file or string. In the case of browser, the -plug-in may be used (if present) or a download ("Save as" dialog box) may be forced. +Send the document to a given destination: browser, file or string. In the case of a browser, the +PDF viewer may be used or a download may be forced.
The method first calls Close() if necessary to terminate the document.

Parameters

-
name
-
-The name of the file. If not specified, the document will be sent to the browser -(destination I) with the name doc.pdf. -
dest
-Destination where to send the document. It can take one of the following values: +Destination where to send the document. It can be one of the following: +The default value is I. +
+
name
+
+The name of the file. It is ignored in case of destination S.
+The default value is doc.pdf. +
+
isUTF8
+
+Indicates if name is encoded in ISO-8859-1 (false) or UTF-8 (true). +Only used for destinations I and D.
+The default value is false.

See also

-Close(). +Close
Index
diff -Nru php-fpdf-1.7.dfsg/doc/pageno.htm php-fpdf-1.8.1.dfsg/doc/pageno.htm --- php-fpdf-1.7.dfsg/doc/pageno.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/pageno.htm 2015-12-20 09:39:19.000000000 +0000 @@ -11,7 +11,7 @@

Description

Returns the current page number.

See also

-AliasNbPages(). +AliasNbPages
Index
diff -Nru php-fpdf-1.7.dfsg/doc/rect.htm php-fpdf-1.8.1.dfsg/doc/rect.htm --- php-fpdf-1.7.dfsg/doc/rect.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/rect.htm 2015-12-20 09:39:19.000000000 +0000 @@ -39,9 +39,9 @@

See also

-SetLineWidth(), -SetDrawColor(), -SetFillColor(). +SetLineWidth, +SetDrawColor, +SetFillColor
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setauthor.htm php-fpdf-1.8.1.dfsg/doc/setauthor.htm --- php-fpdf-1.7.dfsg/doc/setauthor.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setauthor.htm 2015-12-20 09:39:19.000000000 +0000 @@ -23,10 +23,10 @@

See also

-SetCreator(), -SetKeywords(), -SetSubject(), -SetTitle(). +SetCreator, +SetKeywords, +SetSubject, +SetTitle
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setautopagebreak.htm php-fpdf-1.8.1.dfsg/doc/setautopagebreak.htm --- php-fpdf-1.7.dfsg/doc/setautopagebreak.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setautopagebreak.htm 2015-12-20 09:39:19.000000000 +0000 @@ -24,9 +24,9 @@

See also

-Cell(), -MultiCell(), -AcceptPageBreak(). +Cell, +MultiCell, +AcceptPageBreak
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setcreator.htm php-fpdf-1.8.1.dfsg/doc/setcreator.htm --- php-fpdf-1.7.dfsg/doc/setcreator.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setcreator.htm 2015-12-20 09:39:19.000000000 +0000 @@ -24,10 +24,10 @@

See also

-SetAuthor(), -SetKeywords(), -SetSubject(), -SetTitle(). +SetAuthor, +SetKeywords, +SetSubject, +SetTitle
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setdrawcolor.htm php-fpdf-1.8.1.dfsg/doc/setdrawcolor.htm --- php-fpdf-1.7.dfsg/doc/setdrawcolor.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setdrawcolor.htm 2015-12-20 09:39:19.000000000 +0000 @@ -29,12 +29,12 @@

See also

-SetFillColor(), -SetTextColor(), -Line(), -Rect(), -Cell(), -MultiCell(). +SetFillColor, +SetTextColor, +Line, +Rect, +Cell, +MultiCell
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setfillcolor.htm php-fpdf-1.8.1.dfsg/doc/setfillcolor.htm --- php-fpdf-1.7.dfsg/doc/setfillcolor.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setfillcolor.htm 2015-12-20 09:39:19.000000000 +0000 @@ -29,11 +29,11 @@

See also

-SetDrawColor(), -SetTextColor(), -Rect(), -Cell(), -MultiCell(). +SetDrawColor, +SetTextColor, +Rect, +Cell, +MultiCell
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setfont.htm php-fpdf-1.8.1.dfsg/doc/setfont.htm --- php-fpdf-1.7.dfsg/doc/setfont.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setfont.htm 2015-12-20 09:39:19.000000000 +0000 @@ -81,11 +81,11 @@ $pdf->SetFont('Times','BIU');

See also

-AddFont(), -SetFontSize(), -Cell(), -MultiCell(), -Write(). +AddFont, +SetFontSize, +Cell, +MultiCell, +Write
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setfontsize.htm php-fpdf-1.8.1.dfsg/doc/setfontsize.htm --- php-fpdf-1.7.dfsg/doc/setfontsize.htm 2011-06-18 12:43:31.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setfontsize.htm 2015-12-20 09:39:19.000000000 +0000 @@ -18,7 +18,7 @@

See also

-SetFont(). +SetFont
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setkeywords.htm php-fpdf-1.8.1.dfsg/doc/setkeywords.htm --- php-fpdf-1.7.dfsg/doc/setkeywords.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setkeywords.htm 2015-12-20 09:39:19.000000000 +0000 @@ -23,10 +23,10 @@

See also

-SetAuthor(), -SetCreator(), -SetSubject(), -SetTitle(). +SetAuthor, +SetCreator, +SetSubject, +SetTitle
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setleftmargin.htm php-fpdf-1.8.1.dfsg/doc/setleftmargin.htm --- php-fpdf-1.7.dfsg/doc/setleftmargin.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setleftmargin.htm 2015-12-20 09:39:19.000000000 +0000 @@ -20,10 +20,10 @@

See also

-SetTopMargin(), -SetRightMargin(), -SetAutoPageBreak(), -SetMargins(). +SetTopMargin, +SetRightMargin, +SetAutoPageBreak, +SetMargins
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setlinewidth.htm php-fpdf-1.8.1.dfsg/doc/setlinewidth.htm --- php-fpdf-1.7.dfsg/doc/setlinewidth.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setlinewidth.htm 2015-12-20 09:39:19.000000000 +0000 @@ -19,10 +19,10 @@

See also

-Line(), -Rect(), -Cell(), -MultiCell(). +Line, +Rect, +Cell, +MultiCell
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setlink.htm php-fpdf-1.8.1.dfsg/doc/setlink.htm --- php-fpdf-1.7.dfsg/doc/setlink.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setlink.htm 2015-12-20 09:39:19.000000000 +0000 @@ -27,7 +27,7 @@

See also

-AddLink(). +AddLink
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setmargins.htm php-fpdf-1.8.1.dfsg/doc/setmargins.htm --- php-fpdf-1.7.dfsg/doc/setmargins.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setmargins.htm 2015-12-20 09:39:19.000000000 +0000 @@ -27,10 +27,10 @@

See also

-SetLeftMargin(), -SetTopMargin(), -SetRightMargin(), -SetAutoPageBreak(). +SetLeftMargin, +SetTopMargin, +SetRightMargin, +SetAutoPageBreak
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setrightmargin.htm php-fpdf-1.8.1.dfsg/doc/setrightmargin.htm --- php-fpdf-1.7.dfsg/doc/setrightmargin.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setrightmargin.htm 2015-12-20 09:39:19.000000000 +0000 @@ -18,10 +18,10 @@

See also

-SetLeftMargin(), -SetTopMargin(), -SetAutoPageBreak(), -SetMargins(). +SetLeftMargin, +SetTopMargin, +SetAutoPageBreak, +SetMargins
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setsubject.htm php-fpdf-1.8.1.dfsg/doc/setsubject.htm --- php-fpdf-1.7.dfsg/doc/setsubject.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setsubject.htm 2015-12-20 09:39:19.000000000 +0000 @@ -23,10 +23,10 @@

See also

-SetAuthor(), -SetCreator(), -SetKeywords(), -SetTitle(). +SetAuthor, +SetCreator, +SetKeywords, +SetTitle
Index
diff -Nru php-fpdf-1.7.dfsg/doc/settextcolor.htm php-fpdf-1.8.1.dfsg/doc/settextcolor.htm --- php-fpdf-1.7.dfsg/doc/settextcolor.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/settextcolor.htm 2015-12-20 09:39:19.000000000 +0000 @@ -29,11 +29,11 @@

See also

-SetDrawColor(), -SetFillColor(), -Text(), -Cell(), -MultiCell(). +SetDrawColor, +SetFillColor, +Text, +Cell, +MultiCell
Index
diff -Nru php-fpdf-1.7.dfsg/doc/settitle.htm php-fpdf-1.8.1.dfsg/doc/settitle.htm --- php-fpdf-1.7.dfsg/doc/settitle.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/settitle.htm 2015-12-20 09:39:19.000000000 +0000 @@ -23,10 +23,10 @@

See also

-SetAuthor(), -SetCreator(), -SetKeywords(), -SetSubject(). +SetAuthor, +SetCreator, +SetKeywords, +SetSubject
Index
diff -Nru php-fpdf-1.7.dfsg/doc/settopmargin.htm php-fpdf-1.8.1.dfsg/doc/settopmargin.htm --- php-fpdf-1.7.dfsg/doc/settopmargin.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/settopmargin.htm 2015-12-20 09:39:19.000000000 +0000 @@ -18,10 +18,10 @@

See also

-SetLeftMargin(), -SetRightMargin(), -SetAutoPageBreak(), -SetMargins(). +SetLeftMargin, +SetRightMargin, +SetAutoPageBreak, +SetMargins
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setx.htm php-fpdf-1.8.1.dfsg/doc/setx.htm --- php-fpdf-1.7.dfsg/doc/setx.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setx.htm 2015-12-20 09:39:19.000000000 +0000 @@ -19,10 +19,10 @@

See also

-GetX(), -GetY(), -SetY(), -SetXY(). +GetX, +GetY, +SetY, +SetXY
Index
diff -Nru php-fpdf-1.7.dfsg/doc/setxy.htm php-fpdf-1.8.1.dfsg/doc/setxy.htm --- php-fpdf-1.7.dfsg/doc/setxy.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/setxy.htm 2015-12-20 09:39:19.000000000 +0000 @@ -23,8 +23,8 @@

See also

-SetX(), -SetY(). +SetX, +SetY
Index
diff -Nru php-fpdf-1.7.dfsg/doc/sety.htm php-fpdf-1.8.1.dfsg/doc/sety.htm --- php-fpdf-1.7.dfsg/doc/sety.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/sety.htm 2015-12-20 09:39:19.000000000 +0000 @@ -7,9 +7,9 @@

SetY

-SetY(float y) +SetY(float y [, boolean resetX])

Description

-Moves the current abscissa back to the left margin and sets the ordinate. If the passed value +Sets the ordinate and optionally moves the current abscissa back to the left margin. If the value is negative, it is relative to the bottom of the page.

Parameters

@@ -17,12 +17,16 @@
The value of the ordinate.
+
resetX
+
+Whether to reset the abscissa. Default value: true. +

See also

-GetX(), -GetY(), -SetX(), -SetXY(). +GetX, +GetY, +SetX, +SetXY
Index
diff -Nru php-fpdf-1.7.dfsg/doc/text.htm php-fpdf-1.8.1.dfsg/doc/text.htm --- php-fpdf-1.7.dfsg/doc/text.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/text.htm 2015-12-20 09:39:19.000000000 +0000 @@ -28,11 +28,11 @@

See also

-SetFont(), -SetTextColor(), -Cell(), -MultiCell(), -Write(). +SetFont, +SetTextColor, +Cell, +MultiCell, +Write
Index
diff -Nru php-fpdf-1.7.dfsg/doc/write.htm php-fpdf-1.8.1.dfsg/doc/write.htm --- php-fpdf-1.7.dfsg/doc/write.htm 2011-06-18 12:43:32.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/doc/write.htm 2015-12-20 09:39:19.000000000 +0000 @@ -40,11 +40,11 @@ $pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');

See also

-SetFont(), -SetTextColor(), -AddLink(), -MultiCell(), -SetAutoPageBreak(). +SetFont, +SetTextColor, +AddLink, +MultiCell, +SetAutoPageBreak
Index
diff -Nru php-fpdf-1.7.dfsg/FAQ.htm php-fpdf-1.8.1.dfsg/FAQ.htm --- php-fpdf-1.7.dfsg/FAQ.htm 2008-12-28 13:09:25.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/FAQ.htm 2015-11-29 11:22:56.000000000 +0000 @@ -14,19 +14,19 @@

FAQ

diff -Nru php-fpdf-1.7.dfsg/font/courierbi.php php-fpdf-1.8.1.dfsg/font/courierbi.php --- php-fpdf-1.7.dfsg/font/courierbi.php 2011-06-18 11:18:19.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/courierbi.php 2015-09-19 10:15:01.000000000 +0000 @@ -5,4 +5,6 @@ $ut = 50; for($i=0;$i<=255;$i++) $cw[chr($i)] = 600; +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/courierb.php php-fpdf-1.8.1.dfsg/font/courierb.php --- php-fpdf-1.7.dfsg/font/courierb.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/courierb.php 2015-09-19 10:15:01.000000000 +0000 @@ -5,4 +5,6 @@ $ut = 50; for($i=0;$i<=255;$i++) $cw[chr($i)] = 600; +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/courieri.php php-fpdf-1.8.1.dfsg/font/courieri.php --- php-fpdf-1.7.dfsg/font/courieri.php 2011-06-18 11:18:19.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/courieri.php 2015-09-19 10:15:01.000000000 +0000 @@ -5,4 +5,6 @@ $ut = 50; for($i=0;$i<=255;$i++) $cw[chr($i)] = 600; +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/courier.php php-fpdf-1.8.1.dfsg/font/courier.php --- php-fpdf-1.7.dfsg/font/courier.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/courier.php 2015-09-19 10:15:01.000000000 +0000 @@ -5,4 +5,6 @@ $ut = 50; for($i=0;$i<=255;$i++) $cw[chr($i)] = 600; +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/helveticabi.php php-fpdf-1.8.1.dfsg/font/helveticabi.php --- php-fpdf-1.7.dfsg/font/helveticabi.php 2011-06-18 11:18:19.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/helveticabi.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/helveticab.php php-fpdf-1.8.1.dfsg/font/helveticab.php --- php-fpdf-1.7.dfsg/font/helveticab.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/helveticab.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/helveticai.php php-fpdf-1.8.1.dfsg/font/helveticai.php --- php-fpdf-1.7.dfsg/font/helveticai.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/helveticai.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/helvetica.php php-fpdf-1.8.1.dfsg/font/helvetica.php --- php-fpdf-1.7.dfsg/font/helvetica.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/helvetica.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/symbol.php php-fpdf-1.8.1.dfsg/font/symbol.php --- php-fpdf-1.7.dfsg/font/symbol.php 2011-06-18 11:18:19.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/symbol.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,5 @@ chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); +$uv = array(32=>160,33=>33,34=>8704,35=>35,36=>8707,37=>array(37,2),39=>8715,40=>array(40,2),42=>8727,43=>array(43,2),45=>8722,46=>array(46,18),64=>8773,65=>array(913,2),67=>935,68=>array(916,2),70=>934,71=>915,72=>919,73=>921,74=>977,75=>array(922,4),79=>array(927,2),81=>920,82=>929,83=>array(931,3),86=>962,87=>937,88=>926,89=>936,90=>918,91=>91,92=>8756,93=>93,94=>8869,95=>95,96=>63717,97=>array(945,2),99=>967,100=>array(948,2),102=>966,103=>947,104=>951,105=>953,106=>981,107=>array(954,4),111=>array(959,2),113=>952,114=>961,115=>array(963,3),118=>982,119=>969,120=>958,121=>968,122=>950,123=>array(123,3),126=>8764,160=>8364,161=>978,162=>8242,163=>8804,164=>8725,165=>8734,166=>402,167=>9827,168=>9830,169=>9829,170=>9824,171=>8596,172=>array(8592,4),176=>array(176,2),178=>8243,179=>8805,180=>215,181=>8733,182=>8706,183=>8226,184=>247,185=>array(8800,2),187=>8776,188=>8230,189=>array(63718,2),191=>8629,192=>8501,193=>8465,194=>8476,195=>8472,196=>8855,197=>8853,198=>8709,199=>array(8745,2),201=>8835,202=>8839,203=>8836,204=>8834,205=>8838,206=>array(8712,2),208=>8736,209=>8711,210=>63194,211=>63193,212=>63195,213=>8719,214=>8730,215=>8901,216=>172,217=>array(8743,2),219=>8660,220=>array(8656,4),224=>9674,225=>9001,226=>array(63720,3),229=>8721,230=>array(63723,10),241=>9002,242=>8747,243=>8992,244=>63733,245=>8993,246=>array(63734,9)); ?> diff -Nru php-fpdf-1.7.dfsg/font/timesbi.php php-fpdf-1.8.1.dfsg/font/timesbi.php --- php-fpdf-1.7.dfsg/font/timesbi.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/timesbi.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/timesb.php php-fpdf-1.8.1.dfsg/font/timesb.php --- php-fpdf-1.7.dfsg/font/timesb.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/timesb.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/timesi.php php-fpdf-1.8.1.dfsg/font/timesi.php --- php-fpdf-1.7.dfsg/font/timesi.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/timesi.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/times.php php-fpdf-1.8.1.dfsg/font/times.php --- php-fpdf-1.7.dfsg/font/times.php 2011-06-18 11:18:19.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/times.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,6 @@ chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); +$enc = 'cp1252'; +$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); ?> diff -Nru php-fpdf-1.7.dfsg/font/zapfdingbats.php php-fpdf-1.8.1.dfsg/font/zapfdingbats.php --- php-fpdf-1.7.dfsg/font/zapfdingbats.php 2011-06-18 11:18:46.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/font/zapfdingbats.php 2015-09-19 10:15:01.000000000 +0000 @@ -16,4 +16,5 @@ chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); +$uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14)); ?> diff -Nru php-fpdf-1.7.dfsg/fpdf.css php-fpdf-1.8.1.dfsg/fpdf.css --- php-fpdf-1.7.dfsg/fpdf.css 2008-06-08 18:45:41.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/fpdf.css 2008-07-19 13:04:48.000000000 +0000 @@ -1,6 +1,6 @@ body {font-family:"Times New Roman",serif} h1 {font:bold 135% Arial,sans-serif; color:#4000A0; margin-bottom:0.9em} -h2 {font:bold 100% Arial,sans-serif; color:#900000; margin-top:1.5em} +h2 {font:bold 95% Arial,sans-serif; color:#900000; margin-top:1.5em; margin-bottom:1em} dl.param dt {text-decoration:underline} dl.param dd {margin-top:1em; margin-bottom:1em} dl.param ul {margin-top:1em; margin-bottom:1em} diff -Nru php-fpdf-1.7.dfsg/fpdf.php php-fpdf-1.8.1.dfsg/fpdf.php --- php-fpdf-1.7.dfsg/fpdf.php 2011-06-18 11:07:33.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/fpdf.php 2015-12-20 09:23:19.000000000 +0000 @@ -2,91 +2,90 @@ /******************************************************************************* * FPDF * * * -* Version: 1.7 * -* Date: 2011-06-18 * +* Version: 1.81 * +* Date: 2015-12-20 * * Author: Olivier PLATHEY * *******************************************************************************/ -define('FPDF_VERSION','1.7'); +define('FPDF_VERSION','1.81'); class FPDF { -var $page; // current page number -var $n; // current object number -var $offsets; // array of object offsets -var $buffer; // buffer holding in-memory PDF -var $pages; // array containing pages -var $state; // current document state -var $compress; // compression flag -var $k; // scale factor (number of points in user unit) -var $DefOrientation; // default orientation -var $CurOrientation; // current orientation -var $StdPageSizes; // standard page sizes -var $DefPageSize; // default page size -var $CurPageSize; // current page size -var $PageSizes; // used for pages with non default sizes or orientations -var $wPt, $hPt; // dimensions of current page in points -var $w, $h; // dimensions of current page in user unit -var $lMargin; // left margin -var $tMargin; // top margin -var $rMargin; // right margin -var $bMargin; // page break margin -var $cMargin; // cell margin -var $x, $y; // current position in user unit -var $lasth; // height of last printed cell -var $LineWidth; // line width in user unit -var $fontpath; // path containing fonts -var $CoreFonts; // array of core font names -var $fonts; // array of used fonts -var $FontFiles; // array of font files -var $diffs; // array of encoding differences -var $FontFamily; // current font family -var $FontStyle; // current font style -var $underline; // underlining flag -var $CurrentFont; // current font info -var $FontSizePt; // current font size in points -var $FontSize; // current font size in user unit -var $DrawColor; // commands for drawing color -var $FillColor; // commands for filling color -var $TextColor; // commands for text color -var $ColorFlag; // indicates whether fill and text colors are different -var $ws; // word spacing -var $images; // array of used images -var $PageLinks; // array of links in pages -var $links; // array of internal links -var $AutoPageBreak; // automatic page breaking -var $PageBreakTrigger; // threshold used to trigger page breaks -var $InHeader; // flag set when processing header -var $InFooter; // flag set when processing footer -var $ZoomMode; // zoom display mode -var $LayoutMode; // layout display mode -var $title; // title -var $subject; // subject -var $author; // author -var $keywords; // keywords -var $creator; // creator -var $AliasNbPages; // alias for total number of pages -var $PDFVersion; // PDF version number +protected $page; // current page number +protected $n; // current object number +protected $offsets; // array of object offsets +protected $buffer; // buffer holding in-memory PDF +protected $pages; // array containing pages +protected $state; // current document state +protected $compress; // compression flag +protected $k; // scale factor (number of points in user unit) +protected $DefOrientation; // default orientation +protected $CurOrientation; // current orientation +protected $StdPageSizes; // standard page sizes +protected $DefPageSize; // default page size +protected $CurPageSize; // current page size +protected $CurRotation; // current page rotation +protected $PageInfo; // page-related data +protected $wPt, $hPt; // dimensions of current page in points +protected $w, $h; // dimensions of current page in user unit +protected $lMargin; // left margin +protected $tMargin; // top margin +protected $rMargin; // right margin +protected $bMargin; // page break margin +protected $cMargin; // cell margin +protected $x, $y; // current position in user unit +protected $lasth; // height of last printed cell +protected $LineWidth; // line width in user unit +protected $fontpath; // path containing fonts +protected $CoreFonts; // array of core font names +protected $fonts; // array of used fonts +protected $FontFiles; // array of font files +protected $encodings; // array of encodings +protected $cmaps; // array of ToUnicode CMaps +protected $FontFamily; // current font family +protected $FontStyle; // current font style +protected $underline; // underlining flag +protected $CurrentFont; // current font info +protected $FontSizePt; // current font size in points +protected $FontSize; // current font size in user unit +protected $DrawColor; // commands for drawing color +protected $FillColor; // commands for filling color +protected $TextColor; // commands for text color +protected $ColorFlag; // indicates whether fill and text colors are different +protected $WithAlpha; // indicates whether alpha channel is used +protected $ws; // word spacing +protected $images; // array of used images +protected $PageLinks; // array of links in pages +protected $links; // array of internal links +protected $AutoPageBreak; // automatic page breaking +protected $PageBreakTrigger; // threshold used to trigger page breaks +protected $InHeader; // flag set when processing header +protected $InFooter; // flag set when processing footer +protected $AliasNbPages; // alias for total number of pages +protected $ZoomMode; // zoom display mode +protected $LayoutMode; // layout display mode +protected $metadata; // document properties +protected $PDFVersion; // PDF version number /******************************************************************************* -* * * Public methods * -* * *******************************************************************************/ -function FPDF($orientation='P', $unit='mm', $size='A4') + +function __construct($orientation='P', $unit='mm', $size='A4') { // Some checks $this->_dochecks(); // Initialization of properties + $this->state = 0; $this->page = 0; $this->n = 2; $this->buffer = ''; $this->pages = array(); - $this->PageSizes = array(); - $this->state = 0; + $this->PageInfo = array(); $this->fonts = array(); $this->FontFiles = array(); - $this->diffs = array(); + $this->encodings = array(); + $this->cmaps = array(); $this->images = array(); $this->links = array(); $this->InHeader = false; @@ -100,6 +99,7 @@ $this->FillColor = '0 g'; $this->TextColor = '0 g'; $this->ColorFlag = false; + $this->WithAlpha = false; $this->ws = 0; // Font path if(defined('FPDF_FONTPATH')) @@ -150,6 +150,8 @@ $this->CurOrientation = $this->DefOrientation; $this->wPt = $this->w*$this->k; $this->hPt = $this->h*$this->k; + // Page rotation + $this->CurRotation = 0; // Page margins (1 cm) $margin = 28.35/$this->k; $this->SetMargins($margin,$margin); @@ -230,41 +232,31 @@ function SetTitle($title, $isUTF8=false) { // Title of document - if($isUTF8) - $title = $this->_UTF8toUTF16($title); - $this->title = $title; + $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title); } -function SetSubject($subject, $isUTF8=false) +function SetAuthor($author, $isUTF8=false) { - // Subject of document - if($isUTF8) - $subject = $this->_UTF8toUTF16($subject); - $this->subject = $subject; + // Author of document + $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author); } -function SetAuthor($author, $isUTF8=false) +function SetSubject($subject, $isUTF8=false) { - // Author of document - if($isUTF8) - $author = $this->_UTF8toUTF16($author); - $this->author = $author; + // Subject of document + $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject); } function SetKeywords($keywords, $isUTF8=false) { // Keywords of document - if($isUTF8) - $keywords = $this->_UTF8toUTF16($keywords); - $this->keywords = $keywords; + $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords); } function SetCreator($creator, $isUTF8=false) { // Creator of document - if($isUTF8) - $creator = $this->_UTF8toUTF16($creator); - $this->creator = $creator; + $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator); } function AliasNbPages($alias='{nb}') @@ -276,13 +268,7 @@ function Error($msg) { // Fatal error - die('FPDF error: '.$msg); -} - -function Open() -{ - // Begin document - $this->state = 1; + throw new Exception('FPDF error: '.$msg); } function Close() @@ -302,11 +288,11 @@ $this->_enddoc(); } -function AddPage($orientation='', $size='') +function AddPage($orientation='', $size='', $rotation=0) { // Start a new page - if($this->state==0) - $this->Open(); + if($this->state==3) + $this->Error('The document is closed'); $family = $this->FontFamily; $style = $this->FontStyle.($this->underline ? 'U' : ''); $fontsize = $this->FontSizePt; @@ -325,7 +311,7 @@ $this->_endpage(); } // Start new page - $this->_beginpage($orientation,$size); + $this->_beginpage($orientation,$size,$rotation); // Set line cap style to square $this->_out('2 J'); // Set line width @@ -472,17 +458,6 @@ return; $info = $this->_loadfont($file); $info['i'] = count($this->fonts)+1; - if(!empty($info['diff'])) - { - // Search existing encodings - $n = array_search($info['diff'],$this->diffs); - if(!$n) - { - $n = count($this->diffs)+1; - $this->diffs[$n] = $info['diff']; - } - $info['diffn'] = $n; - } if(!empty($info['file'])) { // Embedded font @@ -582,6 +557,8 @@ function Text($x, $y, $txt) { // Output a string + if(!isset($this->CurrentFont)) + $this->Error('No font has been set'); $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); if($this->underline && $txt!='') $s .= ' '.$this->_dounderline($x,$y,$txt); @@ -610,7 +587,7 @@ $this->ws = 0; $this->_out('0 Tw'); } - $this->AddPage($this->CurOrientation,$this->CurPageSize); + $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); $this->x = $x; if($ws>0) { @@ -644,6 +621,8 @@ } if($txt!=='') { + if(!isset($this->CurrentFont)) + $this->Error('No font has been set'); if($align=='R') $dx = $w-$this->cMargin-$this->GetStringWidth($txt); elseif($align=='C') @@ -652,8 +631,7 @@ $dx = $this->cMargin; if($this->ColorFlag) $s .= 'q '.$this->TextColor.' '; - $txt2 = str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); - $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt)); if($this->underline) $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); if($this->ColorFlag) @@ -678,6 +656,8 @@ function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) { // Output text with automatic or explicit line breaks + if(!isset($this->CurrentFont)) + $this->Error('No font has been set'); $cw = &$this->CurrentFont['cw']; if($w==0) $w = $this->w-$this->rMargin-$this->x; @@ -791,6 +771,8 @@ function Write($h, $txt, $link='') { // Output text in flowing mode + if(!isset($this->CurrentFont)) + $this->Error('No font has been set'); $cw = &$this->CurrentFont['cw']; $w = $this->w-$this->rMargin-$this->x; $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; @@ -808,7 +790,7 @@ if($c=="\n") { // Explicit line break - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); $i++; $sep = -1; $j = $i; @@ -843,11 +825,11 @@ } if($i==$j) $i++; - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); } else { - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link); $i = $sep+1; } $sep = -1; @@ -866,12 +848,12 @@ } // Last chunk if($i!=$j) - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link); } function Ln($h=null) { - // Line feed; default value is last cell height + // Line feed; default value is the last cell height $this->x = $this->lMargin; if($h===null) $this->y += $this->lasth; @@ -882,6 +864,8 @@ function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') { // Put an image on the page + if($file=='') + $this->Error('Image file name is empty'); if(!isset($this->images[$file])) { // First use of this image, get info @@ -928,7 +912,7 @@ { // Automatic page break $x2 = $this->x; - $this->AddPage($this->CurOrientation,$this->CurPageSize); + $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); $this->x = $x2; } $y = $this->y; @@ -942,6 +926,18 @@ $this->Link($x,$y,$w,$h,$link); } +function GetPageWidth() +{ + // Get current page width + return $this->w; +} + +function GetPageHeight() +{ + // Get current page height + return $this->h; +} + function GetX() { // Get x position @@ -963,40 +959,40 @@ return $this->y; } -function SetY($y) +function SetY($y, $resetX=true) { - // Set y position and reset x - $this->x = $this->lMargin; + // Set y position and optionally reset x if($y>=0) $this->y = $y; else $this->y = $this->h+$y; + if($resetX) + $this->x = $this->lMargin; } function SetXY($x, $y) { // Set x and y positions - $this->SetY($y); $this->SetX($x); + $this->SetY($y,false); } -function Output($name='', $dest='') +function Output($dest='', $name='', $isUTF8=false) { // Output PDF to some destination - if($this->state<3) - $this->Close(); - $dest = strtoupper($dest); - if($dest=='') + $this->Close(); + if(strlen($name)==1 && strlen($dest)!=1) { - if($name=='') - { - $name = 'doc.pdf'; - $dest = 'I'; - } - else - $dest = 'F'; + // Fix parameter order + $tmp = $dest; + $dest = $name; + $name = $tmp; } - switch($dest) + if($dest=='') + $dest = 'I'; + if($name=='') + $name = 'doc.pdf'; + switch(strtoupper($dest)) { case 'I': // Send to standard output @@ -1005,7 +1001,7 @@ { // We send to a browser header('Content-Type: application/pdf'); - header('Content-Disposition: inline; filename="'.$name.'"'); + header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8)); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); } @@ -1015,18 +1011,15 @@ // Download file $this->_checkoutput(); header('Content-Type: application/x-download'); - header('Content-Disposition: attachment; filename="'.$name.'"'); + header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8)); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); echo $this->buffer; break; case 'F': // Save to local file - $f = fopen($name,'wb'); - if(!$f) + if(!file_put_contents($name,$this->buffer)) $this->Error('Unable to create output file: '.$name); - fwrite($f,$this->buffer,strlen($this->buffer)); - fclose($f); break; case 'S': // Return as a string @@ -1038,15 +1031,11 @@ } /******************************************************************************* -* * * Protected methods * -* * *******************************************************************************/ -function _dochecks() + +protected function _dochecks() { - // Check availability of %F - if(sprintf('%.1F',1.0)!='1.0') - $this->Error('This version of PHP is not supported'); // Check mbstring overloading if(ini_get('mbstring.func_overload') & 2) $this->Error('mbstring overloading must be disabled'); @@ -1055,7 +1044,7 @@ @set_magic_quotes_runtime(0); } -function _checkoutput() +protected function _checkoutput() { if(PHP_SAPI!='cli') { @@ -1075,7 +1064,7 @@ } } -function _getpagesize($size) +protected function _getpagesize($size) { if(is_string($size)) { @@ -1094,7 +1083,7 @@ } } -function _beginpage($orientation, $size) +protected function _beginpage($orientation, $size, $rotation) { $this->page++; $this->pages[$this->page] = ''; @@ -1131,41 +1120,62 @@ $this->CurPageSize = $size; } if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) - $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); + $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); + if($rotation!=0) + { + if($rotation%90!=0) + $this->Error('Incorrect rotation value: '.$rotation); + $this->CurRotation = $rotation; + $this->PageInfo[$this->page]['rotation'] = $rotation; + } } -function _endpage() +protected function _endpage() { $this->state = 1; } -function _loadfont($font) +protected function _loadfont($font) { // Load a font definition file from the font directory + if(strpos($font,'/')!==false || strpos($font,"\\")!==false) + $this->Error('Incorrect font definition file name: '.$font); include($this->fontpath.$font); - $a = get_defined_vars(); - if(!isset($a['name'])) + if(!isset($name)) $this->Error('Could not include font definition file'); - return $a; + if(isset($enc)) + $enc = strtolower($enc); + if(!isset($subsetted)) + $subsetted = false; + return get_defined_vars(); } -function _escape($s) +protected function _isascii($s) { - // Escape special characters in strings - $s = str_replace('\\','\\\\',$s); - $s = str_replace('(','\\(',$s); - $s = str_replace(')','\\)',$s); - $s = str_replace("\r",'\\r',$s); - return $s; + // Test if string is ASCII + $nb = strlen($s); + for($i=0;$i<$nb;$i++) + { + if(ord($s[$i])>127) + return false; + } + return true; } -function _textstring($s) +protected function _httpencode($param, $value, $isUTF8) { - // Format a text string - return '('.$this->_escape($s).')'; + // Encode HTTP header field parameter + if($this->_isascii($value)) + return $param.'="'.$value.'"'; + if(!$isUTF8) + $value = utf8_encode($value); + if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) + return $param.'="'.rawurlencode($value).'"'; + else + return $param."*=UTF-8''".rawurlencode($value); } -function _UTF8toUTF16($s) +protected function _UTF8toUTF16($s) { // Convert UTF-8 to UTF-16BE with BOM $res = "\xFE\xFF"; @@ -1198,7 +1208,24 @@ return $res; } -function _dounderline($x, $y, $txt) +protected function _escape($s) +{ + // Escape special characters + if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false) + return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s); + else + return $s; +} + +protected function _textstring($s) +{ + // Format a text string + if(!$this->_isascii($s)) + $s = $this->_UTF8toUTF16($s); + return '('.$this->_escape($s).')'; +} + +protected function _dounderline($x, $y, $txt) { // Underline text $up = $this->CurrentFont['up']; @@ -1207,7 +1234,7 @@ return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); } -function _parsejpg($file) +protected function _parsejpg($file) { // Extract info from a JPEG file $a = getimagesize($file); @@ -1226,7 +1253,7 @@ return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); } -function _parsepng($file) +protected function _parsepng($file) { // Extract info from a PNG file $f = fopen($file,'rb'); @@ -1237,7 +1264,7 @@ return $info; } -function _parsepngstream($f, $file) +protected function _parsepngstream($f, $file) { // Check signature if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) @@ -1355,6 +1382,7 @@ unset($data); $data = gzcompress($color); $info['smask'] = gzcompress($alpha); + $this->WithAlpha = true; if($this->PDFVersion<'1.4') $this->PDFVersion = '1.4'; } @@ -1362,7 +1390,7 @@ return $info; } -function _readstream($f, $n) +protected function _readstream($f, $n) { // Read n bytes from stream $res = ''; @@ -1379,14 +1407,14 @@ return $res; } -function _readint($f) +protected function _readint($f) { // Read a 4-byte integer from stream $a = unpack('Ni',$this->_readstream($f,4)); return $a['i']; } -function _parsegif($file) +protected function _parsegif($file) { // Extract info from a GIF file (via PNG conversion) if(!function_exists('imagepng')) @@ -1397,141 +1425,149 @@ if(!$im) $this->Error('Missing or incorrect image file: '.$file); imageinterlace($im,0); - $f = @fopen('php://temp','rb+'); - if($f) - { - // Perform conversion in memory - ob_start(); - imagepng($im); - $data = ob_get_clean(); - imagedestroy($im); - fwrite($f,$data); - rewind($f); - $info = $this->_parsepngstream($f,$file); - fclose($f); - } - else - { - // Use temporary file - $tmp = tempnam('.','gif'); - if(!$tmp) - $this->Error('Unable to create a temporary file'); - if(!imagepng($im,$tmp)) - $this->Error('Error while saving to temporary file'); - imagedestroy($im); - $info = $this->_parsepng($tmp); - unlink($tmp); - } + ob_start(); + imagepng($im); + $data = ob_get_clean(); + imagedestroy($im); + $f = fopen('php://temp','rb+'); + if(!$f) + $this->Error('Unable to create memory stream'); + fwrite($f,$data); + rewind($f); + $info = $this->_parsepngstream($f,$file); + fclose($f); return $info; } -function _newobj() +protected function _out($s) { - // Begin a new object - $this->n++; - $this->offsets[$this->n] = strlen($this->buffer); - $this->_out($this->n.' 0 obj'); + // Add a line to the document + if($this->state==2) + $this->pages[$this->page] .= $s."\n"; + elseif($this->state==1) + $this->_put($s); + elseif($this->state==0) + $this->Error('No page has been added yet'); + elseif($this->state==3) + $this->Error('The document is closed'); } -function _putstream($s) +protected function _put($s) { - $this->_out('stream'); - $this->_out($s); - $this->_out('endstream'); + $this->buffer .= $s."\n"; } -function _out($s) +protected function _getoffset() { - // Add a line to the document - if($this->state==2) - $this->pages[$this->page] .= $s."\n"; - else - $this->buffer .= $s."\n"; + return strlen($this->buffer); } -function _putpages() +protected function _newobj($n=null) { - $nb = $this->page; - if(!empty($this->AliasNbPages)) - { - // Replace number of pages - for($n=1;$n<=$nb;$n++) - $this->pages[$n] = str_replace($this->AliasNbPages,$nb,$this->pages[$n]); - } - if($this->DefOrientation=='P') + // Begin a new object + if($n===null) + $n = ++$this->n; + $this->offsets[$n] = $this->_getoffset(); + $this->_put($n.' 0 obj'); +} + +protected function _putstream($data) +{ + $this->_put('stream'); + $this->_put($data); + $this->_put('endstream'); +} + +protected function _putstreamobject($data) +{ + if($this->compress) { - $wPt = $this->DefPageSize[0]*$this->k; - $hPt = $this->DefPageSize[1]*$this->k; + $entries = '/Filter /FlateDecode '; + $data = gzcompress($data); } else - { - $wPt = $this->DefPageSize[1]*$this->k; - $hPt = $this->DefPageSize[0]*$this->k; - } - $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; - for($n=1;$n<=$nb;$n++) - { - // Page - $this->_newobj(); - $this->_out('<_out('/Parent 1 0 R'); - if(isset($this->PageSizes[$n])) - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); - $this->_out('/Resources 2 0 R'); - if(isset($this->PageLinks[$n])) - { - // Links - $annots = '/Annots ['; - foreach($this->PageLinks[$n] as $pl) + $entries = ''; + $entries .= '/Length '.strlen($data); + $this->_newobj(); + $this->_put('<<'.$entries.'>>'); + $this->_putstream($data); + $this->_put('endobj'); +} + +protected function _putpage($n) +{ + $this->_newobj(); + $this->_put('<_put('/Parent 1 0 R'); + if(isset($this->PageInfo[$n]['size'])) + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1])); + if(isset($this->PageInfo[$n]['rotation'])) + $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']); + $this->_put('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + // Links + $annots = '/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots .= '<_textstring($pl[4]).'>>>>'; + else { - $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); - $annots .= '<_textstring($pl[4]).'>>>>'; + $l = $this->links[$pl[4]]; + if(isset($this->PageInfo[$l[0]]['size'])) + $h = $this->PageInfo[$l[0]]['size'][1]; else - { - $l = $this->links[$pl[4]]; - $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; - $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); - } + $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k); } - $this->_out($annots.']'); } - if($this->PDFVersion>'1.3') - $this->_out('/Group <>'); - $this->_out('/Contents '.($this->n+1).' 0 R>>'); - $this->_out('endobj'); - // Page content - $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; - $this->_newobj(); - $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); - $this->_putstream($p); - $this->_out('endobj'); + $this->_put($annots.']'); } - // Pages root - $this->offsets[1] = strlen($this->buffer); - $this->_out('1 0 obj'); - $this->_out('<_out($kids.']'); - $this->_out('/Count '.$nb); - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); - $this->_out('>>'); - $this->_out('endobj'); + if($this->WithAlpha) + $this->_put('/Group <>'); + $this->_put('/Contents '.($this->n+1).' 0 R>>'); + $this->_put('endobj'); + // Page content + if(!empty($this->AliasNbPages)) + $this->pages[$n] = str_replace($this->AliasNbPages,$this->page,$this->pages[$n]); + $this->_putstreamobject($this->pages[$n]); } -function _putfonts() +protected function _putpages() { - $nf = $this->n; - foreach($this->diffs as $diff) + $nb = $this->page; + for($n=1;$n<=$nb;$n++) + $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1); + for($n=1;$n<=$nb;$n++) + $this->_putpage($n); + // Pages root + $this->_newobj(1); + $this->_put('<PageInfo[$n]['n'].' 0 R '; + $this->_put($kids.']'); + $this->_put('/Count '.$nb); + if($this->DefOrientation=='P') { - // Encodings - $this->_newobj(); - $this->_out('<>'); - $this->_out('endobj'); + $w = $this->DefPageSize[0]; + $h = $this->DefPageSize[1]; } + else + { + $w = $this->DefPageSize[1]; + $h = $this->DefPageSize[0]; + } + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$w*$this->k,$h*$this->k)); + $this->_put('>>'); + $this->_put('endobj'); +} + +protected function _putfonts() +{ foreach($this->FontFiles as $file=>$info) { // Font file embedding @@ -1543,58 +1579,89 @@ $compressed = (substr($file,-2)=='.z'); if(!$compressed && isset($info['length2'])) $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); - $this->_out('<_put('<_out('/Filter /FlateDecode'); - $this->_out('/Length1 '.$info['length1']); + $this->_put('/Filter /FlateDecode'); + $this->_put('/Length1 '.$info['length1']); if(isset($info['length2'])) - $this->_out('/Length2 '.$info['length2'].' /Length3 0'); - $this->_out('>>'); + $this->_put('/Length2 '.$info['length2'].' /Length3 0'); + $this->_put('>>'); $this->_putstream($font); - $this->_out('endobj'); + $this->_put('endobj'); } foreach($this->fonts as $k=>$font) { - // Font objects + // Encoding + if(isset($font['diff'])) + { + if(!isset($this->encodings[$font['enc']])) + { + $this->_newobj(); + $this->_put('<>'); + $this->_put('endobj'); + $this->encodings[$font['enc']] = $this->n; + } + } + // ToUnicode CMap + if(isset($font['uv'])) + { + if(isset($font['enc'])) + $cmapkey = $font['enc']; + else + $cmapkey = $font['name']; + if(!isset($this->cmaps[$cmapkey])) + { + $cmap = $this->_tounicodecmap($font['uv']); + $this->_putstreamobject($cmap); + $this->cmaps[$cmapkey] = $this->n; + } + } + // Font object $this->fonts[$k]['n'] = $this->n+1; $type = $font['type']; $name = $font['name']; + if($font['subsetted']) + $name = 'AAAAAA+'.$name; if($type=='Core') { // Core font $this->_newobj(); - $this->_out('<_out('/BaseFont /'.$name); - $this->_out('/Subtype /Type1'); + $this->_put('<_put('/BaseFont /'.$name); + $this->_put('/Subtype /Type1'); if($name!='Symbol' && $name!='ZapfDingbats') - $this->_out('/Encoding /WinAnsiEncoding'); - $this->_out('>>'); - $this->_out('endobj'); + $this->_put('/Encoding /WinAnsiEncoding'); + if(isset($font['uv'])) + $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R'); + $this->_put('>>'); + $this->_put('endobj'); } elseif($type=='Type1' || $type=='TrueType') { // Additional Type1 or TrueType/OpenType font $this->_newobj(); - $this->_out('<_out('/BaseFont /'.$name); - $this->_out('/Subtype /'.$type); - $this->_out('/FirstChar 32 /LastChar 255'); - $this->_out('/Widths '.($this->n+1).' 0 R'); - $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); - if(isset($font['diffn'])) - $this->_out('/Encoding '.($nf+$font['diffn']).' 0 R'); + $this->_put('<_put('/BaseFont /'.$name); + $this->_put('/Subtype /'.$type); + $this->_put('/FirstChar 32 /LastChar 255'); + $this->_put('/Widths '.($this->n+1).' 0 R'); + $this->_put('/FontDescriptor '.($this->n+2).' 0 R'); + if(isset($font['diff'])) + $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R'); else - $this->_out('/Encoding /WinAnsiEncoding'); - $this->_out('>>'); - $this->_out('endobj'); + $this->_put('/Encoding /WinAnsiEncoding'); + if(isset($font['uv'])) + $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R'); + $this->_put('>>'); + $this->_put('endobj'); // Widths $this->_newobj(); $cw = &$font['cw']; $s = '['; for($i=32;$i<=255;$i++) $s .= $cw[chr($i)].' '; - $this->_out($s.']'); - $this->_out('endobj'); + $this->_put($s.']'); + $this->_put('endobj'); // Descriptor $this->_newobj(); $s = '<FontFiles[$font['file']]['n'].' 0 R'; - $this->_out($s.'>>'); - $this->_out('endobj'); + $this->_put($s.'>>'); + $this->_put('endobj'); } else { @@ -1616,7 +1683,58 @@ } } -function _putimages() +protected function _tounicodecmap($uv) +{ + $ranges = ''; + $nbr = 0; + $chars = ''; + $nbc = 0; + foreach($uv as $c=>$v) + { + if(is_array($v)) + { + $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]); + $nbr++; + } + else + { + $chars .= sprintf("<%02X> <%04X>\n",$c,$v); + $nbc++; + } + } + $s = "/CIDInit /ProcSet findresource begin\n"; + $s .= "12 dict begin\n"; + $s .= "begincmap\n"; + $s .= "/CIDSystemInfo\n"; + $s .= "<0) + { + $s .= "$nbr beginbfrange\n"; + $s .= $ranges; + $s .= "endbfrange\n"; + } + if($nbc>0) + { + $s .= "$nbc beginbfchar\n"; + $s .= $chars; + $s .= "endbfchar\n"; + } + $s .= "endcmap\n"; + $s .= "CMapName currentdict /CMap defineresource pop\n"; + $s .= "end\n"; + $s .= "end"; + return $s; +} + +protected function _putimages() { foreach(array_keys($this->images) as $file) { @@ -1626,39 +1744,39 @@ } } -function _putimage(&$info) +protected function _putimage(&$info) { $this->_newobj(); $info['n'] = $this->n; - $this->_out('<_out('/Subtype /Image'); - $this->_out('/Width '.$info['w']); - $this->_out('/Height '.$info['h']); + $this->_put('<_put('/Subtype /Image'); + $this->_put('/Width '.$info['w']); + $this->_put('/Height '.$info['h']); if($info['cs']=='Indexed') - $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); else { - $this->_out('/ColorSpace /'.$info['cs']); + $this->_put('/ColorSpace /'.$info['cs']); if($info['cs']=='DeviceCMYK') - $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + $this->_put('/Decode [1 0 1 0 1 0 1 0]'); } - $this->_out('/BitsPerComponent '.$info['bpc']); + $this->_put('/BitsPerComponent '.$info['bpc']); if(isset($info['f'])) - $this->_out('/Filter /'.$info['f']); + $this->_put('/Filter /'.$info['f']); if(isset($info['dp'])) - $this->_out('/DecodeParms <<'.$info['dp'].'>>'); + $this->_put('/DecodeParms <<'.$info['dp'].'>>'); if(isset($info['trns']) && is_array($info['trns'])) { $trns = ''; for($i=0;$i_out('/Mask ['.$trns.']'); + $this->_put('/Mask ['.$trns.']'); } if(isset($info['smask'])) - $this->_out('/SMask '.($this->n+1).' 0 R'); - $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_put('/SMask '.($this->n+1).' 0 R'); + $this->_put('/Length '.strlen($info['data']).'>>'); $this->_putstream($info['data']); - $this->_out('endobj'); + $this->_put('endobj'); // Soft mask if(isset($info['smask'])) { @@ -1668,137 +1786,113 @@ } // Palette if($info['cs']=='Indexed') - { - $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; - $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal']; - $this->_newobj(); - $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); - $this->_putstream($pal); - $this->_out('endobj'); - } + $this->_putstreamobject($info['pal']); } -function _putxobjectdict() +protected function _putxobjectdict() { foreach($this->images as $image) - $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R'); } -function _putresourcedict() +protected function _putresourcedict() { - $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); - $this->_out('/Font <<'); + $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_put('/Font <<'); foreach($this->fonts as $font) - $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); - $this->_out('>>'); - $this->_out('/XObject <<'); + $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_put('>>'); + $this->_put('/XObject <<'); $this->_putxobjectdict(); - $this->_out('>>'); + $this->_put('>>'); } -function _putresources() +protected function _putresources() { $this->_putfonts(); $this->_putimages(); // Resource dictionary - $this->offsets[2] = strlen($this->buffer); - $this->_out('2 0 obj'); - $this->_out('<<'); + $this->_newobj(2); + $this->_put('<<'); $this->_putresourcedict(); - $this->_out('>>'); - $this->_out('endobj'); + $this->_put('>>'); + $this->_put('endobj'); } -function _putinfo() +protected function _putinfo() { - $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); - if(!empty($this->title)) - $this->_out('/Title '.$this->_textstring($this->title)); - if(!empty($this->subject)) - $this->_out('/Subject '.$this->_textstring($this->subject)); - if(!empty($this->author)) - $this->_out('/Author '.$this->_textstring($this->author)); - if(!empty($this->keywords)) - $this->_out('/Keywords '.$this->_textstring($this->keywords)); - if(!empty($this->creator)) - $this->_out('/Creator '.$this->_textstring($this->creator)); - $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); + $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION; + $this->metadata['CreationDate'] = 'D:'.@date('YmdHis'); + foreach($this->metadata as $key=>$value) + $this->_put('/'.$key.' '.$this->_textstring($value)); } -function _putcatalog() +protected function _putcatalog() { - $this->_out('/Type /Catalog'); - $this->_out('/Pages 1 0 R'); + $n = $this->PageInfo[1]['n']; + $this->_put('/Type /Catalog'); + $this->_put('/Pages 1 0 R'); if($this->ZoomMode=='fullpage') - $this->_out('/OpenAction [3 0 R /Fit]'); + $this->_put('/OpenAction ['.$n.' 0 R /Fit]'); elseif($this->ZoomMode=='fullwidth') - $this->_out('/OpenAction [3 0 R /FitH null]'); + $this->_put('/OpenAction ['.$n.' 0 R /FitH null]'); elseif($this->ZoomMode=='real') - $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]'); elseif(!is_string($this->ZoomMode)) - $this->_out('/OpenAction [3 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']'); + $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']'); if($this->LayoutMode=='single') - $this->_out('/PageLayout /SinglePage'); + $this->_put('/PageLayout /SinglePage'); elseif($this->LayoutMode=='continuous') - $this->_out('/PageLayout /OneColumn'); + $this->_put('/PageLayout /OneColumn'); elseif($this->LayoutMode=='two') - $this->_out('/PageLayout /TwoColumnLeft'); + $this->_put('/PageLayout /TwoColumnLeft'); } -function _putheader() +protected function _putheader() { - $this->_out('%PDF-'.$this->PDFVersion); + $this->_put('%PDF-'.$this->PDFVersion); } -function _puttrailer() +protected function _puttrailer() { - $this->_out('/Size '.($this->n+1)); - $this->_out('/Root '.$this->n.' 0 R'); - $this->_out('/Info '.($this->n-1).' 0 R'); + $this->_put('/Size '.($this->n+1)); + $this->_put('/Root '.$this->n.' 0 R'); + $this->_put('/Info '.($this->n-1).' 0 R'); } -function _enddoc() +protected function _enddoc() { $this->_putheader(); $this->_putpages(); $this->_putresources(); // Info $this->_newobj(); - $this->_out('<<'); + $this->_put('<<'); $this->_putinfo(); - $this->_out('>>'); - $this->_out('endobj'); + $this->_put('>>'); + $this->_put('endobj'); // Catalog $this->_newobj(); - $this->_out('<<'); + $this->_put('<<'); $this->_putcatalog(); - $this->_out('>>'); - $this->_out('endobj'); + $this->_put('>>'); + $this->_put('endobj'); // Cross-ref - $o = strlen($this->buffer); - $this->_out('xref'); - $this->_out('0 '.($this->n+1)); - $this->_out('0000000000 65535 f '); + $offset = $this->_getoffset(); + $this->_put('xref'); + $this->_put('0 '.($this->n+1)); + $this->_put('0000000000 65535 f '); for($i=1;$i<=$this->n;$i++) - $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i])); // Trailer - $this->_out('trailer'); - $this->_out('<<'); + $this->_put('trailer'); + $this->_put('<<'); $this->_puttrailer(); - $this->_out('>>'); - $this->_out('startxref'); - $this->_out($o); - $this->_out('%%EOF'); + $this->_put('>>'); + $this->_put('startxref'); + $this->_put($offset); + $this->_put('%%EOF'); $this->state = 3; } -// End of class } - -// Handle special IE contype request -if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') -{ - header('Content-Type: application/pdf'); - exit; -} - ?> diff -Nru php-fpdf-1.7.dfsg/makefont/makefont.php php-fpdf-1.8.1.dfsg/makefont/makefont.php --- php-fpdf-1.7.dfsg/makefont/makefont.php 2011-06-18 11:24:45.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/makefont/makefont.php 2015-11-29 11:17:56.000000000 +0000 @@ -2,8 +2,8 @@ /******************************************************************************* * Utility to generate font definition files * * * -* Version: 1.2 * -* Date: 2011-06-18 * +* Version: 1.3 * +* Date: 2015-11-29 * * Author: Olivier PLATHEY * *******************************************************************************/ @@ -59,21 +59,40 @@ return $map; } -function GetInfoFromTrueType($file, $embed, $map) +function GetInfoFromTrueType($file, $embed, $subset, $map) { - // Return informations from a TrueType font - $ttf = new TTFParser(); - $ttf->Parse($file); + // Return information from a TrueType font + try + { + $ttf = new TTFParser($file); + $ttf->Parse(); + } + catch(Exception $e) + { + Error($e->getMessage()); + } if($embed) { - if(!$ttf->Embeddable) + if(!$ttf->embeddable) Error('Font license does not allow embedding'); - $info['Data'] = file_get_contents($file); - $info['OriginalSize'] = filesize($file); + if($subset) + { + $chars = array(); + foreach($map as $v) + { + if($v['name']!='.notdef') + $chars[] = $v['uv']; + } + $ttf->Subset($chars); + $info['Data'] = $ttf->Build(); + } + else + $info['Data'] = file_get_contents($file); + $info['OriginalSize'] = strlen($info['Data']); } $k = 1000/$ttf->unitsPerEm; $info['FontName'] = $ttf->postScriptName; - $info['Bold'] = $ttf->Bold; + $info['Bold'] = $ttf->bold; $info['ItalicAngle'] = $ttf->italicAngle; $info['IsFixedPitch'] = $ttf->isFixedPitch; $info['Ascender'] = round($k*$ttf->typoAscender); @@ -82,20 +101,20 @@ $info['UnderlinePosition'] = round($k*$ttf->underlinePosition); $info['FontBBox'] = array(round($k*$ttf->xMin), round($k*$ttf->yMin), round($k*$ttf->xMax), round($k*$ttf->yMax)); $info['CapHeight'] = round($k*$ttf->capHeight); - $info['MissingWidth'] = round($k*$ttf->widths[0]); + $info['MissingWidth'] = round($k*$ttf->glyphs[0]['w']); $widths = array_fill(0, 256, $info['MissingWidth']); - for($c=0;$c<=255;$c++) + foreach($map as $c=>$v) { - if($map[$c]['name']!='.notdef') + if($v['name']!='.notdef') { - $uv = $map[$c]['uv']; - if(isset($ttf->chars[$uv])) + if(isset($ttf->chars[$v['uv']])) { - $w = $ttf->widths[$ttf->chars[$uv]]; + $id = $ttf->chars[$v['uv']]; + $w = $ttf->glyphs[$id]['w']; $widths[$c] = round($k*$w); } else - Warning('Character '.$map[$c]['name'].' is missing'); + Warning('Character '.$v['name'].' is missing'); } } $info['Widths'] = $widths; @@ -104,7 +123,7 @@ function GetInfoFromType1($file, $embed, $map) { - // Return informations from a Type1 font + // Return information from a Type1 font if($embed) { $f = fopen($file, 'rb'); @@ -172,21 +191,24 @@ if(!isset($info['FontName'])) Error('FontName missing in AFM file'); + if(!isset($info['Ascender'])) + $info['Ascender'] = $info['FontBBox'][3]; + if(!isset($info['Descender'])) + $info['Descender'] = $info['FontBBox'][1]; $info['Bold'] = isset($info['Weight']) && preg_match('/bold|black/i', $info['Weight']); if(isset($cw['.notdef'])) $info['MissingWidth'] = $cw['.notdef']; else $info['MissingWidth'] = 0; $widths = array_fill(0, 256, $info['MissingWidth']); - for($c=0;$c<=255;$c++) + foreach($map as $c=>$v) { - $name = $map[$c]['name']; - if($name!='.notdef') + if($v['name']!='.notdef') { - if(isset($cw[$name])) - $widths[$c] = $cw[$name]; + if(isset($cw[$v['name']])) + $widths[$c] = $cw[$v['name']]; else - Warning('Character '.$name.' is missing'); + Warning('Character '.$v['name'].' is missing'); } } $info['Widths'] = $widths; @@ -272,16 +294,61 @@ return rtrim($s); } +function MakeUnicodeArray($map) +{ + // Build mapping to Unicode values + $ranges = array(); + foreach($map as $c=>$v) + { + $uv = $v['uv']; + if($uv!=-1) + { + if(isset($range)) + { + if($c==$range[1]+1 && $uv==$range[3]+1) + { + $range[1]++; + $range[3]++; + } + else + { + $ranges[] = $range; + $range = array($c, $c, $uv, $uv); + } + } + else + $range = array($c, $c, $uv, $uv); + } + } + $ranges[] = $range; + + foreach($ranges as $range) + { + if(isset($s)) + $s .= ','; + else + $s = 'array('; + $s .= $range[0].'=>'; + $nb = $range[1]-$range[0]+1; + if($nb>1) + $s .= 'array('.$range[2].','.$nb.')'; + else + $s .= $range[2]; + } + $s .= ')'; + return $s; +} + function SaveToFile($file, $s, $mode) { $f = fopen($file, 'w'.$mode); if(!$f) Error('Can\'t write to file '.$file); - fwrite($f, $s, strlen($s)); + fwrite($f, $s); fclose($f); } -function MakeDefinitionFile($file, $type, $enc, $embed, $map, $info) +function MakeDefinitionFile($file, $type, $enc, $embed, $subset, $map, $info) { $s = "\n"; SaveToFile($file, $s, 't'); } -function MakeFont($fontfile, $enc='cp1252', $embed=true) +function MakeFont($fontfile, $enc='cp1252', $embed=true, $subset=true) { // Generate a font definition file if(get_magic_quotes_runtime()) - @set_magic_quotes_runtime(0); + @set_magic_quotes_runtime(false); ini_set('auto_detect_line_endings', '1'); if(!file_exists($fontfile)) @@ -329,7 +401,7 @@ $map = LoadMap($enc); if($type=='TrueType') - $info = GetInfoFromTrueType($fontfile, $embed, $map); + $info = GetInfoFromTrueType($fontfile, $embed, $subset, $map); else $info = GetInfoFromType1($fontfile, $embed, $map); @@ -346,19 +418,21 @@ else { $info['File'] = basename($fontfile); + $subset = false; Notice('Font file could not be compressed (zlib extension not available)'); } } - MakeDefinitionFile($basename.'.php', $type, $enc, $embed, $map, $info); + MakeDefinitionFile($basename.'.php', $type, $enc, $embed, $subset, $map, $info); Message('Font definition file generated: '.$basename.'.php'); } if(PHP_SAPI=='cli') { // Command-line interface + ini_set('log_errors', '0'); if($argc==1) - die("Usage: php makefont.php fontfile [enc] [embed]\n"); + die("Usage: php makefont.php fontfile [encoding] [embed] [subset]\n"); $fontfile = $argv[1]; if($argc>=3) $enc = $argv[2]; @@ -368,6 +442,10 @@ $embed = ($argv[3]=='true' || $argv[3]=='1'); else $embed = true; - MakeFont($fontfile, $enc, $embed); + if($argc>=5) + $subset = ($argv[4]=='true' || $argv[4]=='1'); + else + $subset = true; + MakeFont($fontfile, $enc, $embed, $subset); } ?> diff -Nru php-fpdf-1.7.dfsg/makefont/ttfparser.php php-fpdf-1.8.1.dfsg/makefont/ttfparser.php --- php-fpdf-1.7.dfsg/makefont/ttfparser.php 2011-06-18 11:24:35.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/makefont/ttfparser.php 2015-11-29 11:16:22.000000000 +0000 @@ -1,39 +1,67 @@ f = fopen($file, 'rb'); if(!$this->f) $this->Error('Can\'t open file: '.$file); + } + function __destruct() + { + if(is_resource($this->f)) + fclose($this->f); + } + + function Parse() + { + $this->ParseOffsetTable(); + $this->ParseHead(); + $this->ParseHhea(); + $this->ParseMaxp(); + $this->ParseHmtx(); + $this->ParseLoca(); + $this->ParseGlyf(); + $this->ParseCmap(); + $this->ParseName(); + $this->ParseOS2(); + $this->ParsePost(); + } + + function ParseOffsetTable() + { $version = $this->Read(4); if($version=='OTTO') $this->Error('OpenType fonts based on PostScript outlines are not supported'); @@ -45,23 +73,12 @@ for($i=0;$i<$numTables;$i++) { $tag = $this->Read(4); - $this->Skip(4); // checkSum + $checkSum = $this->Read(4); $offset = $this->ReadULong(); - $this->Skip(4); // length - $this->tables[$tag] = $offset; + $length = $this->ReadULong(4); + $this->tables[$tag] = array('offset'=>$offset, 'length'=>$length, 'checkSum'=>$checkSum); } - - $this->ParseHead(); - $this->ParseHhea(); - $this->ParseMaxp(); - $this->ParseHmtx(); - $this->ParseCmap(); - $this->ParseName(); - $this->ParseOS2(); - $this->ParsePost(); - - fclose($this->f); - } + } function ParseHead() { @@ -77,6 +94,8 @@ $this->yMin = $this->ReadShort(); $this->xMax = $this->ReadShort(); $this->yMax = $this->ReadShort(); + $this->Skip(3*2); // macStyle, lowestRecPPEM, fontDirectionHint + $this->indexToLocFormat = $this->ReadShort(); } function ParseHhea() @@ -96,17 +115,79 @@ function ParseHmtx() { $this->Seek('hmtx'); - $this->widths = array(); + $this->glyphs = array(); for($i=0;$i<$this->numberOfHMetrics;$i++) { $advanceWidth = $this->ReadUShort(); - $this->Skip(2); // lsb - $this->widths[$i] = $advanceWidth; + $lsb = $this->ReadShort(); + $this->glyphs[$i] = array('w'=>$advanceWidth, 'lsb'=>$lsb); + } + for($i=$this->numberOfHMetrics;$i<$this->numGlyphs;$i++) + { + $lsb = $this->ReadShort(); + $this->glyphs[$i] = array('w'=>$advanceWidth, 'lsb'=>$lsb); + } + } + + function ParseLoca() + { + $this->Seek('loca'); + $offsets = array(); + if($this->indexToLocFormat==0) + { + // Short format + for($i=0;$i<=$this->numGlyphs;$i++) + $offsets[] = 2*$this->ReadUShort(); + } + else + { + // Long format + for($i=0;$i<=$this->numGlyphs;$i++) + $offsets[] = $this->ReadULong(); + } + for($i=0;$i<$this->numGlyphs;$i++) + { + $this->glyphs[$i]['offset'] = $offsets[$i]; + $this->glyphs[$i]['length'] = $offsets[$i+1] - $offsets[$i]; } - if($this->numberOfHMetrics<$this->numGlyphs) + } + + function ParseGlyf() + { + $tableOffset = $this->tables['glyf']['offset']; + foreach($this->glyphs as &$glyph) { - $lastWidth = $this->widths[$this->numberOfHMetrics-1]; - $this->widths = array_pad($this->widths, $this->numGlyphs, $lastWidth); + if($glyph['length']>0) + { + fseek($this->f, $tableOffset+$glyph['offset'], SEEK_SET); + if($this->ReadShort()<0) + { + // Composite glyph + $this->Skip(4*2); // xMin, yMin, xMax, yMax + $offset = 5*2; + $a = array(); + do + { + $flags = $this->ReadUShort(); + $index = $this->ReadUShort(); + $a[$offset+2] = $index; + if($flags & 1) // ARG_1_AND_2_ARE_WORDS + $skip = 2*2; + else + $skip = 2; + if($flags & 8) // WE_HAVE_A_SCALE + $skip += 2; + elseif($flags & 64) // WE_HAVE_AN_X_AND_Y_SCALE + $skip += 2*2; + elseif($flags & 128) // WE_HAVE_A_TWO_BY_TWO + $skip += 4*2; + $this->Skip($skip); + $offset += 2*2 + $skip; + } + while($flags & 32); // MORE_COMPONENTS + $glyph['components'] = $a; + } + } } } @@ -132,7 +213,7 @@ $idDelta = array(); $idRangeOffset = array(); $this->chars = array(); - fseek($this->f, $this->tables['cmap']+$offset31, SEEK_SET); + fseek($this->f, $this->tables['cmap']['offset']+$offset31, SEEK_SET); $format = $this->ReadUShort(); if($format!=4) $this->Error('Unexpected subtable format: '.$format); @@ -181,7 +262,7 @@ function ParseName() { $this->Seek('name'); - $tableOffset = ftell($this->f); + $tableOffset = $this->tables['name']['offset']; $this->postScriptName = ''; $this->Skip(2); // format $count = $this->ReadUShort(); @@ -213,10 +294,10 @@ $version = $this->ReadUShort(); $this->Skip(3*2); // xAvgCharWidth, usWeightClass, usWidthClass $fsType = $this->ReadUShort(); - $this->Embeddable = ($fsType!=2) && ($fsType & 0x200)==0; + $this->embeddable = ($fsType!=2) && ($fsType & 0x200)==0; $this->Skip(11*2+10+4*4+4); $fsSelection = $this->ReadUShort(); - $this->Bold = ($fsSelection & 32)!=0; + $this->bold = ($fsSelection & 32)!=0; $this->Skip(2*2); // usFirstCharIndex, usLastCharIndex $this->typoAscender = $this->ReadShort(); $this->typoDescender = $this->ReadShort(); @@ -232,27 +313,362 @@ function ParsePost() { $this->Seek('post'); - $this->Skip(4); // version + $version = $this->ReadULong(); $this->italicAngle = $this->ReadShort(); $this->Skip(2); // Skip decimal part $this->underlinePosition = $this->ReadShort(); $this->underlineThickness = $this->ReadShort(); $this->isFixedPitch = ($this->ReadULong()!=0); + if($version==0x20000) + { + // Extract glyph names + $this->Skip(4*4); // min/max usage + $this->Skip(2); // numberOfGlyphs + $glyphNameIndex = array(); + $names = array(); + $numNames = 0; + for($i=0;$i<$this->numGlyphs;$i++) + { + $index = $this->ReadUShort(); + $glyphNameIndex[] = $index; + if($index>=258 && $index-257>$numNames) + $numNames = $index-257; + } + for($i=0;$i<$numNames;$i++) + { + $len = ord($this->Read(1)); + $names[] = $this->Read($len); + } + foreach($glyphNameIndex as $i=>$index) + { + if($index>=258) + $this->glyphs[$i]['name'] = $names[$index-258]; + else + $this->glyphs[$i]['name'] = $index; + } + $this->glyphNames = true; + } + else + $this->glyphNames = false; } - function Error($msg) + function Subset($chars) { - if(PHP_SAPI=='cli') - die("Error: $msg\n"); +/* $chars = array_keys($this->chars); + $this->subsettedChars = $chars; + $this->subsettedGlyphs = array(); + for($i=0;$i<$this->numGlyphs;$i++) + { + $this->subsettedGlyphs[] = $i; + $this->glyphs[$i]['ssid'] = $i; + }*/ + + $this->AddGlyph(0); + $this->subsettedChars = array(); + foreach($chars as $char) + { + if(isset($this->chars[$char])) + { + $this->subsettedChars[] = $char; + $this->AddGlyph($this->chars[$char]); + } + } + } + + function AddGlyph($id) + { + if(!isset($this->glyphs[$id]['ssid'])) + { + $this->glyphs[$id]['ssid'] = count($this->subsettedGlyphs); + $this->subsettedGlyphs[] = $id; + if(isset($this->glyphs[$id]['components'])) + { + foreach($this->glyphs[$id]['components'] as $cid) + $this->AddGlyph($cid); + } + } + } + + function Build() + { + $this->BuildCmap(); + $this->BuildHhea(); + $this->BuildHmtx(); + $this->BuildLoca(); + $this->BuildGlyf(); + $this->BuildMaxp(); + $this->BuildPost(); + return $this->BuildFont(); + } + + function BuildCmap() + { + if(!isset($this->subsettedChars)) + return; + + // Divide charset in contiguous segments + $chars = $this->subsettedChars; + sort($chars); + $segments = array(); + $segment = array($chars[0], $chars[0]); + for($i=1;$i$segment[1]+1) + { + $segments[] = $segment; + $segment = array($chars[$i], $chars[$i]); + } + else + $segment[1]++; + } + $segments[] = $segment; + $segments[] = array(0xFFFF, 0xFFFF); + $segCount = count($segments); + + // Build a Format 4 subtable + $startCount = array(); + $endCount = array(); + $idDelta = array(); + $idRangeOffset = array(); + $glyphIdArray = ''; + for($i=0;$i<$segCount;$i++) + { + list($start, $end) = $segments[$i]; + $startCount[] = $start; + $endCount[] = $end; + if($start!=$end) + { + // Segment with multiple chars + $idDelta[] = 0; + $idRangeOffset[] = strlen($glyphIdArray) + ($segCount-$i)*2; + for($c=$start;$c<=$end;$c++) + { + $ssid = $this->glyphs[$this->chars[$c]]['ssid']; + $glyphIdArray .= pack('n', $ssid); + } + } + else + { + // Segment with a single char + if($start<0xFFFF) + $ssid = $this->glyphs[$this->chars[$start]]['ssid']; + else + $ssid = 0; + $idDelta[] = $ssid - $start; + $idRangeOffset[] = 0; + } + } + $entrySelector = 0; + $n = $segCount; + while($n!=1) + { + $n = $n>>1; + $entrySelector++; + } + $searchRange = (1<<$entrySelector)*2; + $rangeShift = 2*$segCount - $searchRange; + $cmap = pack('nnnn', 2*$segCount, $searchRange, $entrySelector, $rangeShift); + foreach($endCount as $val) + $cmap .= pack('n', $val); + $cmap .= pack('n', 0); // reservedPad + foreach($startCount as $val) + $cmap .= pack('n', $val); + foreach($idDelta as $val) + $cmap .= pack('n', $val); + foreach($idRangeOffset as $val) + $cmap .= pack('n', $val); + $cmap .= $glyphIdArray; + + $data = pack('nn', 0, 1); // version, numTables + $data .= pack('nnN', 3, 1, 12); // platformID, encodingID, offset + $data .= pack('nnn', 4, 6+strlen($cmap), 0); // format, length, language + $data .= $cmap; + $this->SetTable('cmap', $data); + } + + function BuildHhea() + { + $this->LoadTable('hhea'); + $numberOfHMetrics = count($this->subsettedGlyphs); + $data = substr_replace($this->tables['hhea']['data'], pack('n',$numberOfHMetrics), 4+15*2, 2); + $this->SetTable('hhea', $data); + } + + function BuildHmtx() + { + $data = ''; + foreach($this->subsettedGlyphs as $id) + { + $glyph = $this->glyphs[$id]; + $data .= pack('nn', $glyph['w'], $glyph['lsb']); + } + $this->SetTable('hmtx', $data); + } + + function BuildLoca() + { + $data = ''; + $offset = 0; + foreach($this->subsettedGlyphs as $id) + { + if($this->indexToLocFormat==0) + $data .= pack('n', $offset/2); + else + $data .= pack('N', $offset); + $offset += $this->glyphs[$id]['length']; + } + if($this->indexToLocFormat==0) + $data .= pack('n', $offset/2); else - die("Error: $msg"); + $data .= pack('N', $offset); + $this->SetTable('loca', $data); + } + + function BuildGlyf() + { + $tableOffset = $this->tables['glyf']['offset']; + $data = ''; + foreach($this->subsettedGlyphs as $id) + { + $glyph = $this->glyphs[$id]; + fseek($this->f, $tableOffset+$glyph['offset'], SEEK_SET); + $glyph_data = $this->Read($glyph['length']); + if(isset($glyph['components'])) + { + // Composite glyph + foreach($glyph['components'] as $offset=>$cid) + { + $ssid = $this->glyphs[$cid]['ssid']; + $glyph_data = substr_replace($glyph_data, pack('n',$ssid), $offset, 2); + } + } + $data .= $glyph_data; + } + $this->SetTable('glyf', $data); + } + + function BuildMaxp() + { + $this->LoadTable('maxp'); + $numGlyphs = count($this->subsettedGlyphs); + $data = substr_replace($this->tables['maxp']['data'], pack('n',$numGlyphs), 4, 2); + $this->SetTable('maxp', $data); + } + + function BuildPost() + { + $this->Seek('post'); + if($this->glyphNames) + { + // Version 2.0 + $numberOfGlyphs = count($this->subsettedGlyphs); + $numNames = 0; + $names = ''; + $data = $this->Read(2*4+2*2+5*4); + $data .= pack('n', $numberOfGlyphs); + foreach($this->subsettedGlyphs as $id) + { + $name = $this->glyphs[$id]['name']; + if(is_string($name)) + { + $data .= pack('n', 258+$numNames); + $names .= chr(strlen($name)).$name; + $numNames++; + } + else + $data .= pack('n', $name); + } + $data .= $names; + } + else + { + // Version 3.0 + $this->Skip(4); + $data = "\x00\x03\x00\x00"; + $data .= $this->Read(4+2*2+5*4); + } + $this->SetTable('post', $data); + } + + function BuildFont() + { + $tags = array(); + foreach(array('cmap', 'cvt ', 'fpgm', 'glyf', 'head', 'hhea', 'hmtx', 'loca', 'maxp', 'name', 'post', 'prep') as $tag) + { + if(isset($this->tables[$tag])) + $tags[] = $tag; + } + $numTables = count($tags); + $offset = 12 + 16*$numTables; + foreach($tags as $tag) + { + if(!isset($this->tables[$tag]['data'])) + $this->LoadTable($tag); + $this->tables[$tag]['offset'] = $offset; + $offset += strlen($this->tables[$tag]['data']); + } +// $this->tables['head']['data'] = substr_replace($this->tables['head']['data'], "\x00\x00\x00\x00", 8, 4); + + // Build offset table + $entrySelector = 0; + $n = $numTables; + while($n!=1) + { + $n = $n>>1; + $entrySelector++; + } + $searchRange = 16*(1<<$entrySelector); + $rangeShift = 16*$numTables - $searchRange; + $offsetTable = pack('nnnnnn', 1, 0, $numTables, $searchRange, $entrySelector, $rangeShift); + foreach($tags as $tag) + { + $table = $this->tables[$tag]; + $offsetTable .= $tag.$table['checkSum'].pack('NN', $table['offset'], $table['length']); + } + + // Compute checkSumAdjustment (0xB1B0AFBA - font checkSum) + $s = $this->CheckSum($offsetTable); + foreach($tags as $tag) + $s .= $this->tables[$tag]['checkSum']; + $a = unpack('n2', $this->CheckSum($s)); + $high = 0xB1B0 + ($a[1]^0xFFFF); + $low = 0xAFBA + ($a[2]^0xFFFF) + 1; + $checkSumAdjustment = pack('nn', $high+($low>>16), $low); + $this->tables['head']['data'] = substr_replace($this->tables['head']['data'], $checkSumAdjustment, 8, 4); + + $font = $offsetTable; + foreach($tags as $tag) + $font .= $this->tables[$tag]['data']; + + return $font; + } + + function LoadTable($tag) + { + $this->Seek($tag); + $length = $this->tables[$tag]['length']; + $n = $length % 4; + if($n>0) + $length += 4 - $n; + $this->tables[$tag]['data'] = $this->Read($length); + } + + function SetTable($tag, $data) + { + $length = strlen($data); + $n = $length % 4; + if($n>0) + $data = str_pad($data, $length+4-$n, "\x00"); + $this->tables[$tag]['data'] = $data; + $this->tables[$tag]['length'] = $length; + $this->tables[$tag]['checkSum'] = $this->CheckSum($data); } function Seek($tag) { if(!isset($this->tables[$tag])) $this->Error('Table not found: '.$tag); - fseek($this->f, $this->tables[$tag], SEEK_SET); + fseek($this->f, $this->tables[$tag]['offset'], SEEK_SET); } function Skip($n) @@ -262,7 +678,7 @@ function Read($n) { - return fread($this->f, $n); + return $n>0 ? fread($this->f, $n) : ''; } function ReadUShort() @@ -285,5 +701,23 @@ $a = unpack('NN', fread($this->f,4)); return $a['N']; } + + function CheckSum($s) + { + $n = strlen($s); + $high = 0; + $low = 0; + for($i=0;$i<$n;$i+=4) + { + $high += (ord($s[$i])<<8) + ord($s[$i+1]); + $low += (ord($s[$i+2])<<8) + ord($s[$i+3]); + } + return pack('nn', $high+($low>>16), $low); + } + + function Error($msg) + { + throw new Exception($msg); + } } ?> diff -Nru php-fpdf-1.7.dfsg/tutorial/index.htm php-fpdf-1.8.1.dfsg/tutorial/index.htm --- php-fpdf-1.7.dfsg/tutorial/index.htm 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/index.htm 2015-11-29 11:25:22.000000000 +0000 @@ -14,7 +14,7 @@
  • Tutorial 4: Multi-columns
  • Tutorial 5: Tables
  • Tutorial 6: Links and flowing text
  • -
  • Tutorial 7: Adding new fonts and encoding support
  • - +
  • Tutorial 7: Adding new fonts and encodings
  • + diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto1.htm php-fpdf-1.8.1.dfsg/tutorial/tuto1.htm --- php-fpdf-1.7.dfsg/tutorial/tuto1.htm 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto1.htm 2015-11-29 11:25:22.000000000 +0000 @@ -21,7 +21,7 @@

    [Demo]

    After including the library file, we create an FPDF object. -The FPDF() constructor is used here with the default values: pages are in A4 portrait and +The constructor is used here with the default values: pages are in A4 portrait and the unit of measure is millimeter. It could have been specified explicitly with:
    $pdf = new FPDF('P','mm','A4');
    @@ -36,8 +36,8 @@
     borders; the margins can be changed with SetMargins().
     

    -Before we can print text, it's mandatory to select a font with SetFont(), otherwise the -document would be invalid. We choose Arial bold 16: +Before we can print text, it's mandatory to select a font with SetFont(). +We choose Arial bold 16:
    $pdf->SetFont('Arial','B',16);
     
    @@ -65,7 +65,7 @@

    Finally, the document is closed and sent to the browser with Output(). We could have saved -it to a file by passing the desired file name. +it to a file by passing the appropriate parameters.

    Caution: in case when the PDF is sent to the browser, nothing else must be output by the diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto4.htm php-fpdf-1.8.1.dfsg/tutorial/tuto4.htm --- php-fpdf-1.7.dfsg/tutorial/tuto4.htm 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto4.htm 2015-11-29 11:25:22.000000000 +0000 @@ -15,12 +15,10 @@ class PDF extends FPDF { -// Current column -var $col = 0; -// Ordinate of column start -var $y0; +protected $col = 0; // Current column +protected $y0; // Ordinate of column start -function Header() +function Header() { // Page header global $title; diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto4.php php-fpdf-1.8.1.dfsg/tutorial/tuto4.php --- php-fpdf-1.7.dfsg/tutorial/tuto4.php 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto4.php 2015-11-29 11:25:22.000000000 +0000 @@ -3,10 +3,8 @@ class PDF extends FPDF { -// Current column -var $col = 0; -// Ordinate of column start -var $y0; +protected $col = 0; // Current column +protected $y0; // Ordinate of column start function Header() { diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto6.htm php-fpdf-1.8.1.dfsg/tutorial/tuto6.htm --- php-fpdf-1.7.dfsg/tutorial/tuto6.htm 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto6.htm 2015-11-29 11:25:22.000000000 +0000 @@ -15,21 +15,10 @@ class PDF extends FPDF { -var $B; -var $I; -var $U; -var $HREF; - -function PDF($orientation='P', $unit='mm', $size='A4') -{ - // Call parent constructor - $this->FPDF($orientation,$unit,$size); - // Initialization - $this->B = 0; - $this->I = 0; - $this->U = 0; - $this->HREF = ''; -} +protected $B = 0; +protected $I = 0; +protected $U = 0; +protected $HREF = ''; function WriteHTML($html) { diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto6.php php-fpdf-1.8.1.dfsg/tutorial/tuto6.php --- php-fpdf-1.7.dfsg/tutorial/tuto6.php 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto6.php 2015-11-29 11:25:22.000000000 +0000 @@ -3,21 +3,10 @@ class PDF extends FPDF { -var $B; -var $I; -var $U; -var $HREF; - -function PDF($orientation='P', $unit='mm', $size='A4') -{ - // Call parent constructor - $this->FPDF($orientation,$unit,$size); - // Initialization - $this->B = 0; - $this->I = 0; - $this->U = 0; - $this->HREF = ''; -} +protected $B = 0; +protected $I = 0; +protected $U = 0; +protected $HREF = ''; function WriteHTML($html) { diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto7.htm php-fpdf-1.8.1.dfsg/tutorial/tuto7.htm --- php-fpdf-1.7.dfsg/tutorial/tuto7.htm 2011-06-18 13:41:49.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto7.htm 2015-11-29 11:25:22.000000000 +0000 @@ -2,32 +2,18 @@ -Adding new fonts and encoding support +Adding new fonts and encodings - -

    Adding new fonts and encoding support

    -This tutorial explains how to use TrueType, OpenType and Type1 fonts so that you are not limited to -the standard fonts any more. The other benefit is that you can choose the font encoding, which allows -you to use other languages than the Western ones (the standard fonts having too few available characters). +

    Adding new fonts and encodings

    +This tutorial explains how to use TrueType, OpenType and Type1 fonts so that you are not limited to the +standard fonts anymore. The other benefit is that you can choose the text encoding, which allows you to +use other languages than the Western ones (the standard fonts support only cp1252 aka windows-1252).

    -Remark: for OpenType, only the format based on TrueType is supported (not the one based on Type1). -
    -
    -There are two ways to use a new font: embedding it in the PDF or not. When a font is not -embedded, it is searched in the system. The advantage is that the PDF file is lighter; on the other -hand, if it's not available, a substitution font is used. So it's preferable to ensure that the -needed font is installed on the client systems. If the file is to be viewed by a large audience, -it's highly recommended to embed. +For OpenType, only the format based on TrueType is supported (not the one based on Type1).
    +For Type1, you will need the corresponding AFM file (it is usually provided with the font).

    Adding a new font requires two steps: @@ -35,7 +21,6 @@
  • Generation of the font definition file
  • Declaration of the font in the script
  • -For Type1, you need the corresponding AFM file. It's usually provided with the font.

    Generation of the font definition file

    The first step consists in generating a PHP file containing all the information needed by FPDF; @@ -43,7 +28,7 @@ directory of the package: makefont.php. It contains the following function:

    -MakeFont(string fontfile, [, string enc [, boolean embed]]) +MakeFont(string fontfile [, string enc [, boolean embed [, boolean subset]]])
    fontfile
    @@ -57,6 +42,10 @@

    Whether to embed the font or not. Default value: true.

    +
    subset
    +
    +

    Whether to subset the font or not. Default value: true.

    +
    The first parameter is the name of the font file. The extension must be either .ttf, .otf or .pfb and determines the font type. If your Type1 font is in ASCII format (.pfa), you can convert it to binary @@ -91,10 +80,19 @@
  • KOI8-R (Russian)
  • KOI8-U (Ukrainian)
  • -Of course, the font must contain the characters corresponding to the chosen encoding. +Of course, the font must contain the characters corresponding to the selected encoding.

    -Remark: the standard fonts use cp1252. +The third parameter indicates whether the font should be embedded in the PDF or not. When a font is +not embedded, it is searched in the system. The advantage is that the PDF file is smaller; on the +other hand, if it is not available, then a substitution font is used. So you should ensure that the +needed font is installed on the client systems. Embedding is the recommended option to guarantee a +correct rendering. +
    +
    +The last parameter indicates whether subsetting should be used, that is to say, whether only +the characters from the selected encoding should be kept in the embedded font. As a result, +the size of the PDF file can be greatly reduced, especially if the original font was big.

    After you have called the function (create a new file for this and include makefont.php), a .php file @@ -109,7 +107,7 @@
    <?php
     require('makefont/makefont.php');
     
    -MakeFont('c:\\Windows\\Fonts\\comic.ttf','cp1252');
    +MakeFont('C:\\Windows\\Fonts\\comic.ttf','cp1252');
     ?>
    which gives the files comic.php and comic.z. @@ -122,7 +120,7 @@ Another way to call MakeFont() is through the command line:

    -php makefont\makefont.php c:\Windows\Fonts\comic.ttf cp1252 +php makefont\makefont.php C:\Windows\Fonts\comic.ttf cp1252

    Finally, for TrueType and OpenType fonts, you can also generate the files @@ -185,57 +183,5 @@
    ?>

    [Demo]

    - -

    About the euro symbol

    -The euro character is not present in all encodings, and is not always placed at the same position: - - - - - - - - - - - - - - - - - - - - - - -
    EncodingPosition
    cp1250128
    cp1251136
    cp1252128
    cp1253128
    cp1254128
    cp1255128
    cp1257128
    cp1258128
    cp874128
    ISO-8859-1N/A
    ISO-8859-2N/A
    ISO-8859-4N/A
    ISO-8859-5N/A
    ISO-8859-7N/A
    ISO-8859-9N/A
    ISO-8859-11N/A
    ISO-8859-15164
    ISO-8859-16164
    KOI8-RN/A
    KOI8-UN/A
    -ISO-8859-1 is widespread but does not include the euro sign. If you need it, the simplest thing -to do is to use cp1252 or ISO-8859-15 instead, which are nearly identical but contain the precious -symbol. - -

    Reducing the size of TrueType fonts

    -Font files are often quite voluminous; this is due to the fact that they contain the characters -corresponding to many encodings. Zlib compression reduces them but they remain fairly big. A -technique exists to reduce them further. It consists in converting the font to the Type1 format -with ttf2pt1 (the Windows binary is -available here) while specifying the encoding -you are interested in; all other characters will be discarded. -
    -For example, the arial.ttf font that ships with Windows Vista weights 748 KB (it contains 3381 characters). -After compression it drops to 411. Let's convert it to Type1 by keeping only cp1250 characters: -
    -
    -ttf2pt1 -b -L cp1250.map c:\Windows\Fonts\arial.ttf arial -
    -
    -The .map files are located in the makefont directory of the package. The command produces -arial.pfb and arial.afm. The arial.pfb file weights only 57 KB, and 53 after compression. -
    -
    -It's possible to go even further. If you are interested only by a subset of the encoding (you -probably don't need all 217 characters), you can open the .map file and remove the lines you are -not interested in. This will reduce the file size accordingly. diff -Nru php-fpdf-1.7.dfsg/tutorial/tuto7.php php-fpdf-1.8.1.dfsg/tutorial/tuto7.php --- php-fpdf-1.7.dfsg/tutorial/tuto7.php 1970-01-01 00:00:00.000000000 +0000 +++ php-fpdf-1.8.1.dfsg/tutorial/tuto7.php 2015-11-29 11:25:22.000000000 +0000 @@ -0,0 +1,11 @@ +AddFont('Calligrapher','','calligra.php'); +$pdf->AddPage(); +$pdf->SetFont('Calligrapher','',35); +$pdf->Cell(0,10,'Enjoy new fonts with FPDF!'); +$pdf->Output(); +?>