Problem with fonts

Started by Wilko Verweij, January 16, 2010, 11:42:57 AM

Previous topic - Next topic

Wilko Verweij

Hi,
I have a problem with fonts. I imported a project in FF3 that I created in FF2. One of  the forms did not display correct font after import (I used Microsoft Sans Serif, a True Type Font). After import, a different font appeared, I think a system stock font. I could correct that by changing the font for every control. Yesterday I discovered that another form has the same problem, but here it does not help to change the font. This is how it looked before in FF2 (about_0.jpg):
. After import it looks like (about_1.jpg):
In the design environment, everything looks fine.
The strange thing is that if I change the font of the first label to Italics, the other ones look good but the first still is not OK (about_2.jpg).


I can look for a workaround, but before doing that I would like to know if you have any suggestions...

Thanks in advance,
Wilko

John Montenigro

I can't view your screenshots via the forum. Could you try to repost?
Thanks,
-JohnM

Wilko Verweij

Sorry, I should have noticed that myself. Hope it works now. To repeat:

  • this is how it looked before in FF2 (about_0.jpg):
  • this is how it looks after import (about_1.jpg):
  • and this is how it looks when I change the font of the first label to italics (about_2.jpg):

Any help is welcome,
Wilko

Paul Squires

Strange. Are you setting the fonts for the Labels via code?
Paul Squires
PlanetSquires Software

Wilko Verweij

It's always me...
No, I set all the fonts in the design environment. The labels are a control array, from 0 to 10. So a workaround could be to create an additional one and hide the first.
I use GetTextExtentPoint32 to determine the needed width of the labels; as you can see, the GetTextExtentPoint32 does use the correct font-width (so becomes truncated with other font) but it just is not displayed correctly.

Wilko

Wilko Verweij

#5
When I copy the font of label 1 (which is displayed correctly) to label 0 (which is not) everything works fine.
Should be not necessary, but since I do not understand the source of this problem, I prefer to use this as a workaround.
Source code:
  local hFont as dword
  'copy font of label 1 to label 0
  hFont = SendMessage(HWND_MSGBOXFORM_LBL(1), %WM_GetFont, 0, 0)
  SendMessage(HWND_MSGBOXFORM_LBL(0), %WM_SETFONT, hFont, 1) '1 in lParam is needed for immediate redraw

Maybe this solution is useful for other people around here.

Thanks,
Wilko