Code: Select all
Define TM.TEXTMETRIC
pointsize = 100
; http://msdn.microsoft.com/en-us/library/dd183499%28v=vs.85%29.aspx
fnt = LoadFont(#PB_Any, "arial", -pointsize)
font_obj = FontID(fnt)
HWnd = 0 ; handle of your win here, 0 = desktop
hDC = GetDC_(HWnd)
;Debug "Point size: " + Str(pointsize)
;Debug "logical height requested = " + StrF((pointsize * GetDeviceCaps_(hDC, #LOGPIXELSY)) / 72.0)
old_obj = SelectObject_(hDC, font_obj)
GetTextMetrics_(hDC, @TM)
SelectObject_(hDC, old_obj)
Debug "Height = " + TM\tmHeight
Debug "Internal Leading = " + TM\tmInternalLeading
Debug "External Leading = " + TM\tmExternalLeading
Debug "Ascent = " + TM\tmAscent
Debug "Descent = " + TM\tmDescent
Debug "cell Height = " + Str(TM\tmHeight + TM\tmInternalLeading)