Page 2 of 2

Re: Font Problem with 5.72

Posted: Mon Apr 06, 2020 11:57 pm
by kenmo
No, not conflicting...

Fred has clearly stated how to get the 5.71 behavior back, which seems to be what you want.

Sure it uses GetStockObject(), that's probably how PB has done it for 15+ years. GetStockObject() is still there, still available to you, even if Microsoft advises a newer method.

Re: Font Problem with 5.72

Posted: Tue Apr 07, 2020 5:38 am
by Little John
infratec wrote:Such a change can be done from 5.xx to 6.xx but not from 5.71 to 5.72 and with no 'official' information about this. (my opinion)
Of course such a change that affects most of our GUI programs on Windows has to be documented in the Help, in the "History" section as well as in the "Migrating from an old version of PureBasic" section.

Re: Font Problem with 5.72

Posted: Tue Apr 07, 2020 6:22 am
by RASHAD
Hi Bernd
Run the next snippet using PB 5.71 to get the default font name and size then use it with PB 5.72 as you did

Code: Select all

fID = GetGadgetFont(#PB_Default)
fnt.LOGFONT    
GetObject_(fID,SizeOf(fnt),@fnt)
fname$ =  PeekS(@fnt\lfFaceName)
fsize = Int(Round((-fnt\lfHeight * 72 / GetDeviceCaps_(GetDC_(0),#LOGPIXELSY)),1))
Debug fname$
Debug fsize

Re: Font Problem with 5.72

Posted: Tue Apr 07, 2020 7:04 am
by infratec
@Rashad

I didn't know that "MS Shell Dlg" is a font.

Strange is that

Code: Select all

LoadFont(#PB_Any, "MS Shell Dlg", 9)
Results in the same result as

Code: Select all

LoadFont(#PB_Any, "Microsoft Sans Serif", 8)

Re: Font Problem with 5.72

Posted: Tue Apr 07, 2020 7:15 am
by RASHAD
I am glad it helps
At least you do not have to do trial and test to get the proper font size
Beside you do not have to mess with Windows NONCLIENTMETRICS
Be safe

Re: Font Problem with 5.72

Posted: Tue Apr 07, 2020 10:08 am
by PeDe
infratec wrote:I didn't know that "MS Shell Dlg" is a font.
from Windows SDK 7:

Font Mapping on Windows 2000, Windows XP, Windows Server 2003, Windows Vista and Windows 7

Both logical fonts map to Unicode-based TrueType fonts. MS Shell Dlg uses Microsoft Sans Serif (distinct from MS Sans Serif) if the install language is not Japanese. MS Shell Dlg maps to MS UI Gothic if the install language is Japanese.

On Windows XP MUI systems, MS Shell Dlg maps to MS UI Gothic only when the system locale and UI language are set to Japanese. Otherwise, MS Shell Dlg maps to Microsoft Sans Serif.

On Windows Vista and Windows 7, MS Shell Dlg maps to MS UI Gothic if the machine default UI language is set to Japanese (regardless of the install language). MS Shell Dlg maps to Microsoft Sans Serif if the machine default UI language is set to a language other than Japanese.

MS Shell Dlg 2 simply uses the Tahoma font regardless of language. The main advantage of Tahoma over Microsoft Sans Serif is that Tahoma has a native bold font face. Its main disadvantage is that older operating systems might not have it installed, and might substitute a less attractive font.

Characters that are not implemented in Tahoma or Microsoft Sans Serif are available through font linking.

Applications can use either Microsoft Sans Serif or Tahoma explicitly, and save the level of indirection involved in using MS Shell Dlg or MS Shell Dlg 2. Because of font linking, specifying Microsoft Sans Serif or Tahoma provides appropriate glyphs for all languages.

Re: Font Problem with 5.72

Posted: Tue Apr 07, 2020 11:25 am
by Fred
Yes, PB was using GetStockObject() to get the default font which wasn't compatiable with DPI and deprecated by MS. That was it was changed, I agree should be officially documented as it slightly modify the requiered gadget size.