[Lazarus] TFont.Name best practices

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Fri May 1 22:45:10 CEST 2009

Bart wrote:
> On 5/1/09, Martin Friebe <lazarus at mfriebe.de> wrote:
>>  I have attached a patch with a few debugln in it. I don't know if they will
>> show anything useful, since I have no idea what is going on.
>>  If you apply it, you need to start lazarus with a logfile, to capture the
>> output. (There is a command line switch, but I have to find it myself / I
>> usually compile as none "window app", which means my Lazarus runs with a
>> console-window showing all the output)
>>  Also if you do this, test it with only one Synedit open. (You can compile a
>> standalone app, with one SynEdit, and set the font from inside the app)
> I applied the changes in sysnedit.pp and syneditextdrawer.pp
> then did a make clean all
> This happens when I build and start my test app.
Does that test app use a syntax highlighter? From the output I would 
guess that it does not. (because the font is only recalculated in plain, 
but not in bold or italic / You "compare app with memo" in your 2nd mail 
shows  plain style only.)
Anyway, as long as it doesn't, the output looks good.

One thing I noted in the pictures of your first mail (highlighted pascal 
before/after): In the after text the output of the bold text seems to 
use a different font than plain text. Compare the "u". The plain "u" 
(and any u in the before pic) has serif/serif-like extensions. the bold 
"u" in the after pic, has not.

Regards the output below: the "default" and "courier" are normal, 
SynEdit creates them during it's own creation, before you even have a 
chance to set the font.
> In OI the font is set to Verdanana, size -12 (height 16), pitch fpFixed
> F:\LazarusProjecten>test
> SetStyle created font for idx=0 name=default handle=596
> SetBasefont name=default  basefont.name=default Handle=596
> SetBasefont name=default  NO pinfo
> SetStyle created font for idx=1 name=default handle=3364
> RecalcCharExtend for font name=courier / courier mono=False Handle=2360
> SetStyle created font for idx=0 name=courier handle=2360
> SetBasefont name=courier  basefont.name=courier Handle=2360
> SetStyle created font for idx=1 name=courier handle=2492
> RecalcCharExtend for font name=courier / courier mono=False Handle=2360
> SetBasefont name=courier  NO pinfo
> RecalcCharExtend for font name=courier / courier mono=False Handle=1760
> SetStyle created font for idx=0 name=courier handle=1760
> SetBasefont name=courier  basefont.name=courier Handle=1760
Here you would have set Verdana
> RecalcCharExtend for font name=Verdana / Verdana mono=False Handle=1720
> SetStyle created font for idx=0 name=Verdana handle=1720
idx=0 => plain, no-bold, no-italic
> SetBasefont name=Verdana  basefont.name=Verdana Handle=1720
> When I set the font (in my app) to Courier New, Normal, 10 pt, this is
> the output:
> RecalcCharExtend for font name=Courier New / Courier New mono=False Handle=2308
> SetStyle created font for idx=0 name=Courier New handle=2308
> SetBasefont name=Courier New  basefont.name=Courier New Handle=2308
> If I change the font in Lazarus IDE, I see no output on console, or on logfile
> (startlazarus --debug --pcp=bla)
>>  If you use the same font, (and in normal, bold, italic) for Labels and/or
>> StaticText, does it look correct there?
> TLabel and TStaticText seems to work normally
The best is probably to try and find the revision which broke it.
Everything else is just blind search for a needle in a hay stack.....

But in case, what happens with labels/statictext, if you  set pitch to 


More information about the Lazarus mailing list