Page 2 of 2

Re: What size fonts does your Windows PC use?

Posted: Sat Jul 19, 2014 2:19 am
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

Re: What size fonts does your Windows PC use?

Posted: Sat Jul 19, 2014 6:59 am
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))