NO

Author Topic: Font weight in recource file does not work  (Read 2771 times)

Hans211

  • Guest
Font weight in recource file does not work
« on: February 25, 2008, 06:51:25 PM »
I try to get a bold font by specifying font weight 700  (font name MS Shell Dlg, size 8)
It is correctly saved in the main.rc

Code: [Select]
DLG_MAIN DIALOGEX DISCARDABLE 6, 18, 98, 214
STYLE DS_SHELLFONT|WS_POPUP|WS_VISIBLE
EXSTYLE WS_EX_TOPMOST
CLASS "testwinClass"
FONT 8, "MS Shell Dlg 2", 700, 0, 1

The form is also shown on the screen with a bold font, but if you test it or compile the program
the font is not in bold, but normal.
Perhaps I am doing something wrong, since I am new to Pelles c
using 5.00.1 (beta 2)

Hans




Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Font weight in recource file does not work
« Reply #1 on: February 27, 2008, 05:33:48 PM »
I don't normally use bold fonts, so I havn't tested this for a long while. I will have to check what the MS docs says too. Which Windows version are you using, in case this should matter...?
/Pelle

Hans211

  • Guest
Re: Font weight in recource file does not work
« Reply #2 on: February 27, 2008, 05:52:51 PM »
Windows XP.
Normally I don't use bold either, but in this case I have a transparent layered window and with bold text it is better visible.

You can check this in the resource editor.
If you add a checkbox and put the weight on 700, it is shown on the formeditor as bold
If you test it, you get a normal font

I have a workaround, so I am in no hurry...
I now use in my initialisation a WM_SETFONT for every label


Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Font weight in recource file does not work
« Reply #3 on: February 27, 2008, 06:09:18 PM »
OK, thanks for the info.

I assume it was tested when I first implemented it, but this must have been a few years ago. It's not at the top of my head, so I have to do some research before I can say anything clever about this. I will get back...
/Pelle

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Font weight in recource file does not work
« Reply #4 on: February 27, 2008, 07:33:48 PM »
I get the same behaviour on my machine: bold will not work, but italics will (for example).

The 'test dialog' is basically a CreateDialogIndirect() call, so this should be as close as possible to what Windows thinks a dialog should look like (including font mapping and whatever). What you see in the dialog editor is all my code, which blindly uses the choosen dialog properties. Apparently this is not correct, but I can't find any relevant information about how Windows creates the font to use...

If bold is never allowed, I can obviously remove this property - but I like to find some official documentation telling me this. At the moment I can't...
/Pelle