#include <guiconstants.au3>

Dim $file = @ScriptDir & "\FontPixelSize.txt"
Dim $sizeMin = 6, $sizeMax = 28
Dim $font = 'Comic Sans MS'

$gui = GUICreate('', 200, 150, 40, 40)
$label = GUICtrlCreateLabel('', 0, 0, 200, 130, $SS_CENTERIMAGE)

GUISetState()
GUICtrlSetData($label, 'qÄ')
GUICtrlSetColor($label, 0xFF0000)

$fh = FileOpen($file, 1)
FileWriteLine($fh, $font)
FileWriteLine($fh, 'Schriftgrad / Größe in Pixel')
For $i = $sizeMin To $sizeMax Step 0.5
	GUICtrlSetFont($label, $i, 400, -1, $font)
	Select
		Case ($i <= 10) Or (IsInt($i) = 1)
			FileWriteLine($fh, $i & @TAB & @TAB & _scanLetter())
		Case Else
			FileWriteLine($fh, $i & @TAB & _scanLetter())
	EndSelect
Next
FileClose($fh)

Func _scanLetter()	
	Local $arSize[1]
	For $i = 40 To 190
		$pos = PixelSearch(40, $i, 240, $i, 0xFF0000)
		If IsArray($pos) Then
			ReDim $arSize[UBound($arSize)+1]
			$arSize[UBound($arSize)-1] = $pos[1]
		EndIf
	Next
	If UBound($arSize) > 1 Then Return $arSize[UBound($arSize)-1] - $arSize[1] +1
EndFunc