AHK 1.1.23.05 Font size seems broken

Get help with using AutoHotkey and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 865
Joined: 29 Sep 2013, 22:18

AHK 1.1.23.05 Font size seems broken

02 May 2016, 20:32

I must be doing something wrong but I am not seeing expected changes in font sizes. For example, take the following code. I would expect a gradual increase in the displayed font size but on my Windows 7 machine I see a sudden massive change in size at size 66.

Code: Select all

W := A_ScreenWidth * 0.8
loop, 50
{
	
	FS := A_index * 2
	Gui, destroy
	Gui, -Caption  -DPIScale
	Gui, margin, 0, 0
	Gui, Color, blue, white
	Gui, font, s%FS%, Courier
	Gui, add, text,  w%W% cwhite, %FS%
	Gui, show, center autosize, Test

	sleep 1000
}

return
I'm looking for a way to calculate font size dependent upon the length of the total text vs a specific area, eg 80% of Screen width and 70% of screen height. But font size seems unreliable. Has anyone else noticed problems with font sizes? Can anyone suggest an approach to calculate font size vs physical area. Thanks.
User avatar
boiler
Posts: 5295
Joined: 21 Dec 2014, 02:44

Re: AHK 1.1.23.05 Font size seems broken

02 May 2016, 21:24

Try Courier New (a True Type font) instead of Courier.
User avatar
PuzzledGreatly
Posts: 865
Joined: 29 Sep 2013, 22:18

Re: AHK 1.1.23.05 Font size seems broken

03 May 2016, 01:08

Thanks, that does work much better, but both are recommended in the help file. I'm still looking for a good method to maximise font size depending upon text length.
User avatar
jballi
Posts: 614
Joined: 29 Sep 2013, 17:34

Re: AHK 1.1.23.05 Font size seems broken

30 May 2016, 08:15

Old post. Sorry, I did not see it until now.

Not sure what you need to do exactly but the Fnt library has a couple of functions that may help. The Fnt_FontSizeToFit and the Fnt_FontSizeToFitHeight functions might be useful to you. Good luck!

Return to “Ask For Help”

Who is online

Users browsing this forum: Robbl, SpikeVanHellsing, Xtra and 59 guests