From 294f8ba9cab3d5a181b48fa1a75d13d4c9072b3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Thu, 15 Apr 2004 12:54:13 +0000 Subject: [PATCH] skip the third part of a pfb in pdf when possible; improved pfb EOF check in pdf git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@1672 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/canvas.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyx/canvas.py b/pyx/canvas.py index 5b9beff1..36cacf4e 100644 --- a/pyx/canvas.py +++ b/pyx/canvas.py @@ -628,6 +628,14 @@ class canvas(_canvas): if fontdata[12+length1+length2:14+length1+length2] != fullfont._PFB_ASCII: raise RuntimeError("PFB_ASCII mark expected") length3 = fullfont.pfblength(fontdata[14+length1+length2:18+length1+length2]) + if fontdata[18+length1+length2+length3:20+length1+length2+length3] != fullfont._PFB_DONE: + raise RuntimeError("PFB_DONE mark expected") + if len(fontdata) != 20 + length1 + length2 + length3: + raise RuntimeError("end of pfb file expected") + + # we might be allowed to skip the third part ... + if fontdata[18+length1+length2:18+length1+length2+length3].replace("\n", "").replace("\r", "").replace("\t", "").replace(" ", "") == "0"*512 + "cleartomark": + length3 = 0 uncompresseddata = fontdata[6:6+length1] + fontdata[12+length1:12+length1+length2] + fontdata[18+length1+length2:18+length1+length2+length3] compresseddata = zlib.compress(uncompresseddata) -- 2.11.4.GIT