Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-03

GetTextMetrics in TCanvas proposal

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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

Reply by email

Unknown author
to Unknown author
Show quoted text 29 lines
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

Reply by email

Paul Ishenin
to Unknown author
Thanks all for their reactions :(

Developers sometimes are busy with their projects :(

Is another place where I can discuss? Is another place where LCL core developers response my few questions?

In the irc channel #lazarus-ide

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.

You idea is not bad to add GetTextMetrics. Create a patch and a test. Then add them to the bug tracker.

Best regards,
Paul Ishenin.

Reply by email

Unknown author
to Paul Ishenin
Paul Ishenin wrote
26.03.2010 16:20, wrote: > Thanks all for their reactions :( Developers sometimes are busy with their projects :(

I suppose it :)

Show quoted text 10 lines
> Is another place where I can discuss? Is another place where LCL core developers response > my few questions? In the irc channel #lazarus-ide > 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. You idea is not bad to add GetTextMetrics. Create a patch and a test. Then add them to the bug tracker.

I'l try it.

And what to do with finished cairo canvas package? Send tarball to the list?

Petr

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

Reply by email

Marc Weustink
to Paul Ishenin: Developers sometimes are busy with their projects :( In the irc channel #lazarus-ide You…
Paul Ishenin wrote 16 lines
26.03.2010 16:20, wrote: > Thanks all for their reactions :( Developers sometimes are busy with their projects :( > Is another place where I can discuss? Is another place where LCL core > developers response > my few questions? In the irc channel #lazarus-ide > 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. You idea is not bad to add GetTextMetrics. Create a patch and a test. Then add them to the bug tracker.

The only thing we need to ask ourselves is, do we need the "inner" TTextMetric or can we use some more userfriendly version ?

Marc

Reply by email

Unknown author
to Marc Weustink
Marc Weustink wrote 20 lines
Paul Ishenin wrote: > 26.03.2010 16:20, wrote: >> Thanks all for their reactions :( > > Developers sometimes are busy with their projects :( > >> Is another place where I can discuss? Is another place where LCL core >> developers response >> my few questions? > > In the irc channel #lazarus-ide > >> 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. > > You idea is not bad to add GetTextMetrics. Create a patch and a test. > Then add them to the bug tracker. The only thing we need to ask ourselves is, do we need the "inner" TTextMetric or can we use some more userfriendly version ?

How to imagine myself "userfriendly"?

Petr

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

Reply by email

Jesus Reyes
to Unknown author

--- El vie 26-mar-10, escribi?:

Show quoted text 37 lines
De:: Asunto: Re: [Lazarus] GetTextMetrics in TCanvas proposal A: "Lazarus mailing list" Fecha: viernes, 26 de marzo de 2010, 6:58 On Fri, Mar 26, 2010 at 12:19:07PM +0100, Marc Weustink wrote: > Paul Ishenin wrote: >> 26.03.2010 16:20, wrote: >>> Thanks all for their reactions :( >> >> Developers sometimes are busy with their projects :( >> >>> Is another place where I can discuss? Is another place where LCL core >>> developers response >>> my few questions? >> >> In the irc channel #lazarus-ide >> >>> 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. >> >> You idea is not bad to add GetTextMetrics. Create a patch and a test. >> Then add them to the bug tracker. > > The only thing we need to ask ourselves is, do we need the "inner"? > TTextMetric or can we use some more userfriendly version ? How to imagine myself "userfriendly"? Petr

In r24429, I added a initial version of the function GetTextMetrics to canvas, it works like standard winpi GetTextMetrics but it takes a TLCLTextMetrics record where we can add fields that can be implemented in all targets, currently only Ascender, Descender and Height are implemented in PostscriptCanvas which allows to fix a bug in TurboPower IPro print preview. Still waiting for you Cairo canvas stuff.

Jesus Reyes A.

Encuentra las mejores recetas en Yahoo! Cocina.
http://mx.mujer.yahoo.com/cocina/

Reply by email

Unknown author
to Jesus Reyes
Jesus Reyes wrote 49 lines
--- El vie 26-mar-10, escribi?: > De:: > Asunto: Re: [Lazarus] GetTextMetrics in TCanvas proposal > A: "Lazarus mailing list" > Fecha: viernes, 26 de marzo de 2010, 6:58 > On Fri, Mar 26, 2010 at 12:19:07PM > +0100, Marc Weustink wrote: > > Paul Ishenin wrote: > >> 26.03.2010 16:20, > wrote: > >>> Thanks all for their reactions :( > >> > >> Developers sometimes are busy with their projects > :( > >> > >>> Is another place where I can discuss? Is > another place where LCL core > >>> developers response > >>> my few questions? > >> > >> In the irc channel #lazarus-ide > >> > >>> 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. > >> > >> You idea is not bad to add GetTextMetrics. Create > a patch and a test. > >> Then add them to the bug tracker. > > > > The only thing we need to ask ourselves is, do we need > the "inner"? > > TTextMetric or can we use some more userfriendly > version ? > How to imagine myself "userfriendly"? > > Petr In r24429, I added a initial version of the function GetTextMetrics to canvas, it works like standard winpi GetTextMetrics but it takes a TLCLTextMetrics record where we can add fields that can be implemented in all targets, currently only Ascender, Descender and Height are implemented in PostscriptCanvas which allows to fix a bug in TurboPower IPro print preview. Still waiting for you Cairo canvas stuff.

I merge GetTextMetrics and Cairo will be ready.

Where I should send it? Mantis has 2kB limit.

Petr

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

Reply by email