[Lazarus] GetTextMetrics in TCanvas proposal
petr.kristan at epos.cz
petr.kristan at epos.cz
Fri Mar 26 10:20:38 CET 2010
On Wed, Mar 24, 2010 at 10:32:31AM +0100, petr.kristan at epos.cz wrote:
> Hallo.
>
> I suggest to add function function GetTextMetrics(var TM: TTextMetric): boolean; into TCanvas class.
>
> If user wants to work with text on Canvas and mix different fonts on one
> line, he needs minimally to know Ascent and Descent metrics of the font.
> But TCanvas has only TextExtent function. If user renders text on the
> screen (or printer in Win), then uses lclintf.GetTextMetrics.
> But if renders on TPoscriptCanvas or upcoming TCairoCanvas he must use
> some TCairoCanvas.GetTextMetrics or still non existing
> TPoscriptCanvas.GetTextMetrics.
>
> It cause ugly non oop construction like:
>
> {$IFDEF USE_CAIRO}
> if Canvas is TCairoCanvas then
> (Canvas as TCairoCanvas).GetTextMetrics(tm)
> else
> GetTextMetrics(tm);
> {$ELSE}
> GetTextMetrics(tm);
> {$ENDIF}
>
> For that reason I propose to add virtual function GetTextMetrics into
> TCanvas.
>
> Is this proposal acceptable?
>
> If it is, how to move ahead to reach this goal.
Thanks all for their reactions :(
Is another place where I can discuss? Is another place where LCL core developers response
my few questions?
I have done my work on cairo canvas. It can be used as separate package.
Where should I put it? Certainly if comunity have an interest.
Petr
--
Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223 Czech Republic (Eastern Europe)
fax: +420 466510709
More information about the Lazarus
mailing list