函数参考


_WinAPI_GetOutlineTextMetrics

检索 TrueType 字体文本规格.

#Include <WinAPIEx.au3>
_WinAPI_GetOutlineTextMetrics ( $hDC )

参数

$hDC 设备环境句柄.

返回值

成功: 返回包含文本规格的 $tagOUTLINETEXTMETRIC 结构.
失败: 返回 0,设置 the @error 为非 0 值.

注意/说明

None

相关

详情参考

在MSDN中搜索


示例/演示


#Include <APIConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $tOLTM, $tData, $hDC, $hSv, $hFont

; 选择 "Arial" 字体到设备环境并获取 $tagOUTLINETEXTMETRIC 结构
$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(24, 0, 0, 0, $FW_NORMAL , 0, 0, 0, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $ANTIALIASED_QUALITY, $DEFAULT_PITCH, 'Arial')
$hSv = _WinAPI_SelectObject($hDC, $hFont)
$tOLTM = _WinAPI_GetOutlineTextMetrics($hDC)
_WinAPI_SelectObject($hDC, $hSv)
_WinAPI_ReleaseDC(0, $hDC)

If IsDllStruct($tOLTM) Then
    ConsoleWrite('Family name:   ' & _otm($tOLTM, 'otmFamilyName') & @CR)
    ConsoleWrite('Typeface name: ' & _otm($tOLTM, 'otmFaceName') & @CR)
    ConsoleWrite('Style name     ' & _otm($tOLTM, 'otmStyleName') & @CR)
    ConsoleWrite('Full name:     ' & _otm($tOLTM, 'otmFullName') & @CR)
EndIf

Func _otm(ByRef $tOLTM, $sName)
    Return _WinAPI_GetString(DllStructGetPtr($tOLTM) + DllStructGetData($tOLTM, $sName))
EndFunc   ;==>_otm