[Lazarus] fpPDF: set clip rect for text

Ondrej Pokorny lazarus at kluug.net
Wed Apr 13 18:36:16 CEST 2016


On 13.04.2016 11:33, Graeme Geldenhuys wrote:
> No, I haven't done any work on using the clipping operators yet. In
> fpReport, text is rather wrapped than clipped.
>
> Contributions in this regard are obviously very welcome. I would imagine
> if the clipping operators are to be implemented, then graphics state
> (save & restore) would probably go hand-in-hand with the clipping too.

I have no idea about graphics state :)

Clipping and multi-line text are probably the last 2 features I miss.

IMO multi-line text support should be added into TFPFontCacheItem. 
Something like:

TFPFontCacheItem.CalcMultiLineText(const AText: string; const AWidth, 
ALineHeight: single; const AAlignment: TTextAlignment): TMultiLineText;

TTextTag = record
   X, Y: Single;
   Text: string;
end;

TMultiLineText = record
   TextTags: array of TTextTag;
end;

The CalcMultiLineText would then calculate the X/Y-position of 
lines/tags (if justify alignment should be supported.) Then one could 
easily either draw it on PDF page or TCanvas.

Do you have some function like this in fpReport? Could it be extracted 
from fpReport into fpTTF? Or should I create one for myself?

Ondrej




More information about the Lazarus mailing list