Font Problem with 5.72

Just starting out? Need help? Post your questions and find answers here.
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: Font Problem with 5.72

Post 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.
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Font Problem with 5.72

Post 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.
Last edited by Little John on Tue Apr 07, 2020 6:23 am, edited 1 time in total.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Font Problem with 5.72

Post 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
Egypt my love
infratec
Always Here
Always Here
Posts: 6874
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Font Problem with 5.72

Post 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)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Font Problem with 5.72

Post 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
Egypt my love
PeDe
Enthusiast
Enthusiast
Posts: 123
Joined: Sun Nov 26, 2017 3:13 pm
Location: Vienna
Contact:

Re: Font Problem with 5.72

Post 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.
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Font Problem with 5.72

Post 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.
Post Reply