Page 1 of 1

Understanding Gui fonts use

Posted: 14 May 2020, 20:25
by PuzzledGreatly
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

Re: Understanding Gui fonts use

Posted: 14 May 2020, 20:51
by poetbox
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.

Re: Understanding Gui fonts use

Posted: 15 May 2020, 09:20
by Albireo
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)"

Re: Understanding Gui fonts use  Topic is solved

Posted: 15 May 2020, 10:13
by swagfag
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

Re: Understanding Gui fonts use

Posted: 17 May 2020, 00:58
by PuzzledGreatly
Thanks, swagfag, that was the kind of clarification I was looking for.