Understanding Gui fonts use Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Understanding Gui fonts use

14 May 2020, 20:25

Does anyone know what AHK considers to be a change of font, ie something that add to the font table and moves one step closer to the "out of fonts" error message? For example, consider this function:

Code: Select all

GetLineWidth(fnt, itm, name := "myownfont")
{
	static l
	Gui, New
	Gui, -dpiscale
	Gui, Font, s%fnt% bold, arial
	Gui, Font, s%fnt% bold, Comic Sans MF
	Gui, Font, s%fnt% bold, %name%
	Gui, add, text, vl, %itm%	
	GuiControlget, l, pos
	Gui, destroy
	return lw
}
Does this add to the font table three times total or three times every time the function is called? Thanks
poetbox
Posts: 112
Joined: 18 Apr 2018, 20:47

Re: Understanding Gui fonts use

14 May 2020, 20:51

PuzzledGreatly wrote:
14 May 2020, 20:25

Code: Select all

	Gui, Font, s%fnt% bold, arial
	Gui, Font, s%fnt% bold, Comic Sans MF
	Gui, Font, s%fnt% bold, %name%
Does this add to the font table three times total or three times every time the function is called? Thanks
You changed the font three times."myownfont" should be actually used, that is the third one.
Albireo
Posts: 1756
Joined: 16 Oct 2013, 13:53

Re: Understanding Gui fonts use

15 May 2020, 09:20

Is the font name correct? GUI AHK-font
"FontName may be the name of any font, such as one from the font table. If FontName is omitted or does not exist on the system, the previous font's typeface will be used (or if none, the system's default GUI typeface)"
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Understanding Gui fonts use  Topic is solved

15 May 2020, 10:13

anytime u specify a font whose name, size, weight, italicness, underlinedness, strikeoutness and quality differs from those of the fonts u have already used in ur script, ahk will attempt to create and cache a new font
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Understanding Gui fonts use

17 May 2020, 00:58

Thanks, swagfag, that was the kind of clarification I was looking for.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: SimmoF, uchihito and 206 guests