Window Resize and FontSize


#1

What is the best way to scale the fontsize when resizing a window?

I have tried this and it does not give me what I am looking for.
SELF.GetCurrentPos(?STRING1, CurrentSize)
SELF.GetOrigPos(?STRING1, OrigSize)

UD.Debug('CurrentSize.Width ' & CurrentSize.Width & '  OrigSize.Width ' & OrigSize.Width)
UD.Debug('CurrentSize.Height ' & CurrentSize.Height & '  OrigSize.Height ' & OrigSize.Height) 
IF (CurrentSize.Width <> OrigSize.Width) OR (CurrentSize.Height <> OrigSize.Height) THEN
  xScale = CurrentSize.Width/OrigSize.Width
  yScale = CurrentSize.Height/OrigSize.Height
  FontScale = CHOOSE(xScale < yScale, xScale, yScale)
  UD.Debug('xScale ' & xScale & '  yScale ' & yScale & '  FontScale ' & FontScale)
  ControlFontScale = FontScale
  !IF ControlFontScale > 1 THEN
  !  ControlFontScale = ControlFontScale * 0.8
  !  IF ControlFontScale < 1 THEN ControlFontScale = 1.
  !ELSIF ControlFontScale < 1 THEN
  !  ControlFontScale = 1
  !END
  
  UD.Debug('ControlFontScale ' & ControlFontScale & '  Orig PROP:FontSize ' & ?STRING1{PROP:FontSize})
  ?STRING1{PROP:FontSize} = ?STRING1{PROP:FontSize} * ControlFontScale
  UD.Debug('New PROP:FontSize ' & ?STRING1{PROP:FontSize})
END

#2

Instead of resizing the fonts when resizing a window, you can use AnyFont from Capesoft to let the user select a font (or just a size if you wish) then AnyFont will resize the windows for you automatically.