Sign in Join

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

Mailing lists / lazarus / 2003-06

is there a font problem?

8 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner
to Stefan Weber: Changes to the font name, size or style are not displayed correctly on screen. Only the…
Show quoted text 10 lines
Changes to the font name, size or style are not displayed correctly on screen. Only the metrics seem to be updated, at least a bold "Hello" is wider than a plain "Hello". Am I missing something or is there a problem with font support in Lazarus/GTK? If so are there any efforts underway to get fonts working? I would like to port my rich text display control to Lazarus LCL.

The font support of the gtk-interface is not complete. And of course it is a lot of work to complete it. Maybe you can tell me the exact fonts and features you need and I can try to improve some things.

Mattias

Reply by email

Andrew Johnson
to Stefan Weber: Changes to the font name, size or style are not displayed correctly on screen. Only the…

well fyi, this is one of the reasons I went ahead and made the TStaticText. Since it is custom drawn on a TCanvas, then it does follow the font and color setting, in most cases where you have this problem it will probably work as a valid substitute.

But Also. It _is_ possible to change the other widget fonts in the backend of the gtk interface, however to do so is atm not a good idea because it is not possible to tell which to use if the font is set by the app and the gtkrc sets one as well, because gtk doesn't bother to tell the app if one has been loaded etc, and it can cause severe problems when switching themes if you don't know for sure which you are using.

Andrew

Mattias Gaertner wrote 54 lines
On Mon, 09 Jun 2003 00:34:26 -0400 Tony Maro wrote: > Mattias Gaertner wrote: > > >The font support of the gtk-interface is not complete. And of course it > >is a lot of work to complete it. Maybe you can tell me the exact fonts > >and features you need and I can try to improve some things. > > > > > What I found is that all fonts by default try to go with the user's GTK > theme, but if you try to programmatically change a font, they don't > change. Unfortunately many people don't have a real working GTK theme Only the user can decide, if he has a working theme. Not the application. > (users of only KDE for instance), making it hard to read. I've had some > users be able to work around this by creating a .gtkrc file by hand. That's the intended way. With a .gtkrc all gtk programs will become usable, not just yours. The gtk-interface also loads automatically rc files of the form '<application>.gtkrc'. So, you can provide a checkbook.gtkrc. I think, if a user has installed a gtk theme, then a gtk application should use it. Only if the default is bad and the user is too lazy or does not know how to install a theme, then there can be an option to override the default. Either a command line option and/or LCL function. > When I designed the checkbook control for CBT I learned that custom > drawing my own fonts onto the control's canvas worked perfect though... yes > Specifically it would be nice if the TLabel component would respond to > custom font definitions instead of only the GTK theme default. That > would make headers and such easier to create, and the labels would be > more predictable in relation to size and spacing, True. > even if not quite gnome compliant. Mattias _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Tony Maro
to Stefan Weber: Changes to the font name, size or style are not displayed correctly on screen. Only the…
Mattias Gaertner wrote 5 lines
The font support of the gtk-interface is not complete. And of course it is a lot of work to complete it. Maybe you can tell me the exact fonts and features you need and I can try to improve some things.

What I found is that all fonts by default try to go with the user's GTK theme, but if you try to programmatically change a font, they don't change. Unfortunately many people don't have a real working GTK theme (users of only KDE for instance), making it hard to read. I've had some users be able to work around this by creating a .gtkrc file by hand.

When I designed the checkbook control for CBT I learned that custom drawing my own fonts onto the control's canvas worked perfect though...

Specifically it would be nice if the TLabel component would respond to custom font definitions instead of only the GTK theme default. That would make headers and such easier to create, and the labels would be more predictable in relation to size and spacing, even if not quite gnome compliant.

-Tony

Reply by email

Stefan Weber
to Tony Maro
Tony Maro wrote
What I found is that all fonts by default try to go with the user's GTK theme, but if you try to programmatically change a font, they don't change.

That's what I experienced and why I thought there was an error.

Unfortunately many people don't have a real working GTK theme (users of only KDE for instance), making it hard to read. I've had some users be able to work around this by creating a .gtkrc file by hand.

Mayme mine is broken ... I'll have to check that.

When I designed the checkbook control for CBT I learned that custom drawing my own fonts onto the control's canvas worked perfect though...

Having read this I tried the same and it worked.

Show quoted text 7 lines
Specifically it would be nice if the TLabel component would respond to custom font definitions instead of only the GTK theme default. That would make headers and such easier to create, and the labels would be more predictable in relation to size and spacing, even if not quite gnome compliant. -Tony

Well I don't know much about GTK and even less about Gnome. As a Delphi programmer I was confused by the fact that changing the TLabel.Font in the Object Inspector doesn't do anything.

I understand that it is sensible to default to the theme font, but it should be possible to override it or some of its properties while keeping the others, e.g. if I need a bold label.

Anyhow I find it misleading that a font selected in the object inspector is stored inside the Name property in the .lfm but has no effect.

Maybe this could be accomplished through a new property similar to the ParentFont property e.g. "DefaultFont". If set to true no properties would get streamed to the .lfm and the properties would be locked to the default values.

Show quoted text 5 lines
Mattias Gaertner wrote: >The font support of the gtk-interface is not complete. And of course >it is a lot of work to complete it. >Maybe you can tell me the exact fonts and >features you need and I can try to improve some things.

For my layout engine I need access to accurate text metric information like Ascent, Descent, Leading and Width in order to line up everything on a base line.

I've looked into the GetTextMetrics stuff and experimented a little with it and it looks promising ...

-Stefan

Reply by email

Stefan Weber

Changes to the font name, size or style are not displayed correctly on screen. Only the metrics seem to be updated, at least a bold "Hello" is wider than a plain "Hello".

Am I missing something or is there a problem with font support in Lazarus/GTK?

If so are there any efforts underway to get fonts working?

I would like to port my rich text display control to Lazarus LCL.

Regards,

Stefan

Reply by email

Mattias Gaertner
to Stefan Weber
Show quoted text 10 lines
Mattias Gaertner wrote: >The font support of the gtk-interface is not complete. And of course it >is a lot of work to complete it. Maybe you can tell me the exact fonts >and features you need and I can try to improve some things. > > What I found is that all fonts by default try to go with the user's GTK theme, but if you try to programmatically change a font, they don't change. Unfortunately many people don't have a real working GTK theme

Only the user can decide, if he has a working theme. Not the application.

(users of only KDE for instance), making it hard to read. I've had some users be able to work around this by creating a .gtkrc file by hand.

That's the intended way. With a .gtkrc all gtk programs will become usable, not just yours.
The gtk-interface also loads automatically rc files of the form '<application>.gtkrc'. So, you can provide a checkbook.gtkrc.

I think, if a user has installed a gtk theme, then a gtk application should use it. Only if the default is bad and the user is too lazy or does not know how to install a theme, then there can be an option to override the default. Either a command line option and/or LCL function.

When I designed the checkbook control for CBT I learned that custom drawing my own fonts onto the control's canvas worked perfect though...

yes

Specifically it would be nice if the TLabel component would respond to custom font definitions instead of only the GTK theme default. That would make headers and such easier to create, and the labels would be more predictable in relation to size and spacing,

True.

even if not quite gnome compliant.

Mattias

Reply by email

Marc Weustink
to Stefan Weber: Changes to the font name, size or style are not displayed correctly on screen. Only the…
Stefan Weber wrote 6 lines
Changes to the font name, size or style are not displayed correctly on screen. Only the metrics seem to be updated, at least a bold "Hello" is wider than a plain "Hello". Am I missing something or is there a problem with font support in Lazarus/GTK?

AFAIK there is no problem. If you look at the IDE editor, plain, bold, italic are displayed correctly.
What functions do you need ?

Marc

Reply by email

Mattias Gaertner
to Tony Maro: What I found is that all fonts by default try to go with the user's GTK theme, but if you…
Show quoted text 24 lines
Tony Maro wrote: > What I found is that all fonts by default try to go with the user's GTK > theme, but if you try to programmatically change a font, they don't > change. That's what I experienced and why I thought there was an error. [...] Well I don't know much about GTK and even less about Gnome. As a Delphi programmer I was confused by the fact that changing the TLabel.Font in the Object Inspector doesn't do anything. I understand that it is sensible to default to the theme font, but it should be possible to override it or some of its properties while keeping the others, e.g. if I need a bold label. Anyhow I find it misleading that a font selected in the object inspector is stored inside the Name property in the .lfm but has no effect. Maybe this could be accomplished through a new property similar to the ParentFont property e.g. "DefaultFont". If set to true no properties would get streamed to the .lfm and the properties would be locked to the default values.

They are visible in the OI, because they can be streamed. This makes porting Delphi code easier.
Of course it is unpleasant, showing values, that are not yet implemented. I think, we need this 'DefaultFont' property and we should add property editors, so that the user does not get confused.

What do the others think, should we add 'DefaultFont' (default set to true)?

BTW, I just tested changing the font of a label with gtk_widgte_modify_style, but always get access violations. Maybe someone can point me to a working example for gtk 1.2?

Mattias

Reply by email