Browse Source

* Fix bug #34062, invalid length1 for compressed fonts, using provided patch

git-svn-id: trunk@39529 -
michael 7 years ago
parent
commit
67adab1155
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/fcl-pdf/src/fppdf.pp

+ 6 - 1
packages/fcl-pdf/src/fppdf.pp

@@ -4690,11 +4690,16 @@ end;
 procedure TPDFDocument.CreateFontFileEntry(const AFontNum: integer);
 var
   FDict: TPDFDictionary;
+  Len: Integer;
 begin
   FDict:=CreateGlobalXRef.Dict;
   if poCompressFonts in Options then
     FDict.AddName('Filter','FlateDecode');
-  FDict.AddInteger('Length1 '+IntToStr(AFontNum), Fonts[AFontNum].FTrueTypeFile.OriginalSize);
+  if poSubsetFont in Options then
+    Len := Fonts[AFontNum].SubsetFont.Size
+  else
+    Len := Fonts[AFontNum].FTrueTypeFile.OriginalSize;
+  FDict.AddInteger('Length1 '+IntToStr(AFontNum), Len);
 end;
 
 procedure TPDFDocument.CreateCIDSet(const AFontNum: integer);