[Lazarus] PDF generator: please test

Ondrej Pokorny lazarus at kluug.net
Sat Apr 9 20:36:08 CEST 2016


On 09.04.2016 19:42, Graeme Geldenhuys wrote:
> On 2016-04-09 18:27, Ondrej Pokorny wrote:
>> As is the
>> text width function (for right/center alignment support).
> That is already implemented in fpReport (Standard PDF built-in fonts and
> TTF fonts). What I haven't implemented yet is Font Kerning to make the
> width calculation even more accurate, but the width difference will be
> very minor. I can take a look and see if it makes sense to move that
> code to fpPDF. I'm pretty sure it shouldn't be a problem.

Please take a look at the code in my email from today 10:09. When I use 
TFPFontCacheItem.TextWidth, I get this:


(The red rectangle visualizes the textwidth/textheight calculation). The 
text height is correct, but text width is very different.

>> If there is a possibility to render text with custom TTF font in Lazarus
>> (I found easylazfreetype, but I couldn't make it work with my first
> I'm not sure if we are talking about the same unit, but the freetype
> pascal implementation in Lazarus is based on a very old FreeType v1. It
> also misses tons of features found in the commonly used FreeType v2 library.
>
> I once tried to use the Pascal based FreeType code to reduce
> dependencies for AggPas text rendering. The Pascal FreeType simply
> wasn't up to the task and lacked functionality I needed. The fpTTF (font
> cache) and fpParseTTF (actual TTF data extraction) is much more likely
> to be successful with my AggPas goal.
>
>
>> I think I'll develop a TPDFDocument->TCanvas renderer for
>> previewing created PDF documents.
> Great. I should then be able to plug that into fpReport too. I want to
> implement a PDF & fpReport -> AggPas renderer too.

We should then try to omit unnecessary double work. I see that AggPas 
should be able to render TTF fonts already. Why do you need fpTTF and 
fpParseTTF then? Nevertheless IMO it's good to have as little 
dependencies as possible, so if the TTF functionality from fp-pdf can be 
extended to render TTF characters without AggPas, that would be great.

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160409/46c370e9/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: facadbbf.png
Type: image/png
Size: 6357 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160409/46c370e9/attachment-0003.png>


More information about the Lazarus mailing list