Browse Source

Allow PDF exporter use fonts added through streams

Oleg Latov 1 month ago
parent
commit
7b8e157ded
1 changed files with 7 additions and 1 deletions
  1. 7 1
      packages/fcl-report/src/fpreportpdfexport.pp

+ 7 - 1
packages/fcl-report/src/fpreportpdfexport.pp

@@ -146,7 +146,13 @@ begin
         fnt:=gTTFontCache.FindFont(AFontName);
       if fnt=Nil then
         raise Exception.CreateFmt('fpreport: Could not find the font <%s> in the font cache.', [AFontName]);
-      Result := Document.AddFont(fnt.FileName, AFontName)
+      if fnt.FileName <> EmptyStr then
+        Result := Document.AddFont(fnt.FileName, AFontName)
+      else if Assigned(fnt.Stream) then
+      begin
+        fnt.Stream.Position := 0;
+        Result := Document.AddFont(fnt.Stream, AFontName);
+      end;
     end;
   end;
 end;