What size fonts does your Windows PC use?

Everything else that doesn't fall into one of the other PB categories.

What size fonts does your Windows PC use?

Small fonts (the default), or don't know
64
91%
Large fonts
4
6%
Custom size fonts
2
3%
 
Total votes: 70

PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: What size fonts does your Windows PC use?

Post by PB »

A few years later and I still haven't solved this annoying problem. :(

Here's an image of how a test window looks like default small fonts,
and then with large fonts enabled. What I want to achieve is a way
to auto-scale the large font version to fit all the text neatly into the
gadgets like they do with the small fonts image.

Anyone got any tips? The test code is under the image. Thanks.

Image

Code: Select all

Procedure SmallFonts()
  a=GetDesktopWindow_() : b=GetDC_(a) : c=97-GetDeviceCaps_(b,#LOGPIXELSX) : ReleaseDC_(a,b)
  ProcedureReturn c
EndProcedure

If OpenWindow(1,0,0,355,100,"test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  ButtonGadget(1,10,10,200,20,"The text on this button goes to the edges")
  ButtonGadget(2,210,10,135,20,"Butted against other button")
  ListIconGadget(3,10,40,200,50,"Column1",55) : AddGadgetColumn(3,1,"Column2",140)
  AddGadgetItem(3,-1,"Fits inside"+#LF$+"And this fits inside Column2")
  FrameGadget(4,210,40,135,50,"This all fits in the title area")
  If SmallFonts()<>1 ; System is not using Small Fonts, so need to auto-scale them.
    ; Auto-scale code goes here?
  EndIf
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: What size fonts does your Windows PC use?

Post by Bisonte »

Since PB 5.20 :

- Added: #PB_Gadget_RequiredSize support for GadgetWidth/Height()

so is this a solution for you ?

Code: Select all

ResizeGadget(1, #PB_Ignore, #PB_Ignore, GadgetWidth(1, #PB_Gadget_RequiredSize), GadgetHeight(1, #PB_Gadget_RequiredSize))
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Post Reply