Hello,
I've pushed an update to SVN for fcl-pdf.
The code can now do a partial embedding of a TTF font: just the characters used in the PDF will be embedded. This results in a much smaller PDF file.
Michael.

Mailing lists / lazarus / 2016-12
15 messages · 3 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello,
I've pushed an update to SVN for fcl-pdf.
The code can now do a partial embedding of a TTF font: just the characters used in the PDF will be embedded. This results in a much smaller PDF file.
Michael.
This is great news! But I have a problem. FPC make fails with:
The installer encountered the following error:
Compilation of "BuildUnit_fcl_pdf.pp" failed
make[2]: *** [smart] Error 1
make[2]: Leaving directory `p:/software/FPC/trunk_src/packages' make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `p:/software/FPC/trunk_src' make: *** [build-stamp.i386-win32] Error 2
Ondrej
I forgot (again) to commit a file, fixed. Sorry.
Michael.
Michael Van Canneyt wroteI forgot (again) to commit a file, fixed. Sorry.
No problem. Now it compiles, thanks!
I have a runtime exception, though (the relevant line is in #5):
#0 fpc_raiseexception(0xc9, 0x5ca84a, 0x79cf5c8) at ..\inc\except.inc:158 #1 RUNERRORTOEXCEPT(201, 0x5ca84a, 0x79cf5c8) at
..\objpas\sysutils\sysutils.inc:441
#2 HANDLEERRORADDRFRAME(201, 0x5ca84a, 0x79cf5c8) at ..\inc\system.inc:1144 #3 HANDLEERRORADDRFRAMEIND(201, 0x5ca84a, 0x79cf5c8) at ..\inc\system.inc:1161
#4 fpc_rangeerror at ..\inc\system.inc:755
*#5 BUILDCMAPTABLE(0x6790260) at
..\..\..\..\..\..\software\FPC\trunk_src\packages\fcl-pdf\src\fpttfsubsetter.pp:807* #6 SAVETOSTREAM(0x6790260, 0x7b061c0) at
..\..\..\..\..\..\software\FPC\trunk_src\packages\fcl-pdf\src\fpttfsubsetter.pp:926 #7 GENERATESUBSETFONT(0x682d7a8) at
..\..\..\..\..\..\software\FPC\trunk_src\packages\fcl-pdf\src\fppdf.pp:1400 #8 CREATEFONTENTRIES(0x68351d0) at
..\..\..\..\..\..\software\FPC\trunk_src\packages\fcl-pdf\src\fppdf.pp:5101 #9 SAVETOSTREAM(0x68351d0, 0x7ad5ed8) at
..\..\..\..\..\..\software\FPC\trunk_src\packages\fcl-pdf\src\fppdf.pp:5141
the idDelta array looks like (from GDB): Len=29: (-31, -42, -43, -45, -48, ...)
-> as you see all values are negative and you are passing them to a UInt16 parameter, which results in range error.
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161209/6ef66a71/attachment.html>
Hmh. Graeme Geldenhuys will have to pull his hair again.
We'll have to pass around the hat to pay for a wig...
Can you tell us which font you are using, and maybe also what text you were trying to write to the PDF ? Subset font creation is quite tricky.
Michael.
Michael Van Canneyt wroteHmh. Graeme Geldenhuys will have to pull his hair again. We'll have to pass around the hat to pay for a wig...
:-D Yeah, I already look like Kojak [*] (damn, that's giving away my age too).
Can you tell us which font you are using, and maybe also what text you were trying to write to the PDF?
Yes, that information would be very useful. If you can even supply the TTF font version number, that would be helpful too.
[*] https://en.wikipedia.org/wiki/Kojak
Regards,
Graeme
If it really is needed, I'll create a test project. But for the start to me it looks like you didn't test the package with range checks on and overflow checks on. Maybe you'll find the problems on your own if you switch them on :)
E.g. TFontSubsetter.WriteTableHeader is also written for range checking off (you should at least {$PUSH}{$R-}{$Q-} - {$POP} the code).
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161209/e24633bd/attachment.html>
There are numerous font files out there and the number of possible unicode characters is big.
Michael.
Please see TFontSubsetter.WriteTableHeader - the checksum calculation.
There are numerous font files out there and the number of possible unicode characters is big.
I disabled range checking and the PDF is produced and it is (almost) correct. I could see that the Czech "ř" character is not handled correctly. I'll make you a test case.
Ondrej
If it really is needed, I'll create a test project. But for the start to me it looks like…
Ondrej Pokorny wroteBut for the start to me it looks like you didn't test the package with range checks on and overflow checks on.
Interestingly, I just enabled Range Checking and Overflows on, clearer all *.ppu files and rebuilt the code. The output is below. No errors or warnings were given. I used FPC 2.6.4 for development. Either way, I'll look into it anyway.
============================================
Hint: (11030) Start of reading config file /home/graemeg/.fpc.cfg Hint: (11031) End of reading config file /home/graemeg/.fpc.cfg Free Pascal Compiler version 2.6.4 [2014/03/03] for x86_64 Copyright (c) 1993-2014 by Florian Klaempfl and others (1002) Target OS: Linux for x86-64
(3104) Compiling ttfdump.lpr
(3104) Compiling /home/graemeg/devel/fpcpackages/fppdf/src/fpparsettf.pp (3104) Compiling /home/graemeg/devel/fpcpackages/fppdf/src/fpttfencodings.pp (1010) Writing Resource String Table file: fpparsettf.rst (3104) Compiling
/home/graemeg/devel/fpcpackages/fppdf/src/fpfonttextmapping.pp (3104) Compiling /home/graemeg/devel/fpcpackages/fppdf/src/fpttfsubsetter.pp /home/graemeg/devel/fpcpackages/fppdf/src/fpttfsubsetter.pp(687,5) Hint: ...snip...
(1010) Writing Resource String Table file: fpttfsubsetter.rst (9015) Linking ttfdump
/usr/bin/ld: warning: link.res contains output sections; did you forget -T? (1008) 4524 lines compiled, 0.8 sec
(1022) 16 hint(s) issued
============================================
Regards,
Graeme
Graeme Geldenhuys wroteNo errors or warnings were given.
Same result with FPC 3.0.0 under 64-bit Linux (CentOS 6).
Regards,
Graeme
Graeme Geldenhuys wroteOn 2016-12-09 16:16, Graeme Geldenhuys via Lazarus wrote: > No errors or warnings were given. Same result with FPC 3.0.0 under 64-bit Linux (CentOS 6).
Good, await a test project from me :)
(Anyway, so that I don't look like a pain in the neck - thank you for the work on fpPDF, it's great and the font subsetting feature makes it a complete tool for my needs!)
Ondrej
No problem. Now it compiles, thanks! I have a runtime exception, though (the relevant…
Some quick feedback. Further testing I managed to reproduce the rangecheck error. I've fixed all I could find (I interpreted one of Java's primitive data types incorrectly). I'll verify some more code to make sure. Expect a fix in FPC's svn repo by Monday.
Regards,
Graeme
Great!
It looks like international characters make problems as well: http://mantis.freepascal.org/view.php?id=31092
Unfortunately the test project doesn't reproduce the range check error - I'll wait for the Monday fix and report back.
Ondrej
Ondrej Pokorny wroteIt looks like international characters make problems as well: http://mantis.freepascal.org/view.php?id=31092
Range Check errors, endless loop and broken international character issues have been resolved. I've updated the bug report, and changes should be in FPC Trunk soon.
Thanks for testing and reporting issues.
Regards,
Graeme