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.

Petr

-- 
Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to