﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
918	GUICtrlSetFont() and related	trancexx	Jpm	"Would it be possible to get another parameter to functions GUICtrlSetFont() and GUISetFont() to be used to select font quality. Or maybe to add more values to attribute parameter?
This appears to be most useful for XP.
Here's the script that shows the difference (is seen on most of the XPs that I could test with - that's a lot actually):
{{{
;#NoTrayIcon
#include <WinApi.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global Const $DEFAULT_QUALITY = 0
Global Const $DRAFT_QUALITY = 1
Global Const $PROOF_QUALITY = 2
Global Const $NONANTIALIASED_QUALITY = 3 ; WINVER >= 0x0400
Global Const $ANTIALIASED_QUALITY = 4 ; WINVER >= 0x0400
Global Const $CLEARTYPE_QUALITY = 5 ; _WIN32_WINNT >= _WIN32_WINNT_WINXP
Global Const $CLEARTYPE_COMPAT_QUALITY = 6 ; _WIN32_WINNT >= _WIN32_WINNT_WINXP

Global $iToggled
Global $sFontName = ""Arial"";""Trebuchet MS""


Global $sText = ""Environment = 3.3.0.0 under  WIN_XP/Service Pack 3 X86"" & @CRLF & @CRLF _
		 & ""Pointer to a null-terminated string that specifies the typeface name of the font."" & @CRLF _
		 & ""The length of this string must not exceed 32 characters, including the terminating null character."" & @CRLF _
		 & ""...blah, blah, blah...""


Global $hGui = GUICreate(""My GUI"")
GUISetBkColor(0xFFFFFF)

Global $hFont = _CreateFontWithDifferentQualityValue()

Global $hButton = GUICtrlCreateButton(""Change label font quality"", 115, 300, 170, 25)
Global $hLabelInfo = GUICtrlCreateLabel(""- AutoIt font"", 170, 350, 100, 25)
GUICtrlSetColor($hLabelInfo, 0xFF0000)

Global $hLabel = GUICtrlCreateLabel($sText, 110, 30, 180, 180)
GUICtrlSetFont($hLabel, 8.5, 400, 2, $sFontName)

GUISetState()


While 1

	Switch GUIGetMsg()
		Case - 3
			ExitLoop
		Case $hButton
			_ToggleFont($hLabel, $hFont)
	EndSwitch

WEnd

;cleaning
If $hFont Then
	ConsoleWrite(""! On exit delete custom font: "" & _WinAPI_DeleteObject($hFont) & @CRLF)
EndIf

; The end




Func _ToggleFont($hControl, $hFont)

	If $iToggled Then
		GUICtrlSetFont($hControl, 8.5, 400, 2, $sFontName)
		GUICtrlSetData($hLabelInfo, ""- AutoIt font"")
		$iToggled = 0
	Else
		GUICtrlSendMsg($hControl, $WM_SETFONT, $hFont, 1)
		GUICtrlSetData($hLabelInfo, ""- custom font"")
		$iToggled = 1
	EndIf

EndFunc   ;==>_ToggleFont


Func _CreateFontWithDifferentQualityValue()

	Local $tLOGFONT = DllStructCreate(""int Height;"" & _
			""int Width;"" & _
			""int Escapement;"" & _
			""int Orientation;"" & _
			""int Weight;"" & _
			""ubyte Italic;"" & _
			""ubyte Underline;"" & _
			""ubyte Strikeout;"" & _
			""ubyte CharSet;"" & _
			""ubyte OutPrecision;"" & _
			""ubyte ClipPrecision;"" & _
			""ubyte Quality;"" & _
			""ubyte PitchAndFamily;"" & _
			""char FaceName[32]"")

	Local $hDC = _WinAPI_GetDC($hGui)
	Local $LOGPIXELSY = 90
	Local $iDCaps = _WinAPI_GetDeviceCaps($hDC, $LOGPIXELSY)
	_WinAPI_ReleaseDC($hGui, $hDC)

	DllStructSetData($tLOGFONT, ""Height"", -8.5 * $iDCaps / 72)
	DllStructSetData($tLOGFONT, ""Weight"", 400)
	DllStructSetData($tLOGFONT, ""Italic"", 1)
	DllStructSetData($tLOGFONT, ""Quality"", $CLEARTYPE_QUALITY) ; CLEARTYPE_QUALITY for example
	DllStructSetData($tLOGFONT, ""FaceName"", $sFontName)

	Local $hFont = _WinAPI_CreateFontIndirect($tLOGFONT)

	Return SetError(@error, 0, $hFont)

EndFunc   ;==>_CreateFontWithDifferentQualityValue
}}}
 "	Feature Request	closed	3.3.1.0	AutoIt		None	Completed		
