Obtains the current D2Font object.
D2GetFontObj FntObj
FntObj | : object |
This command retrieves the COM object that references the current D2 font.
'
' D2GetFontObj sample (dpi-unaware)
'
$Library "direct2d"
Global Object Win1RT, DefaultFnt
OpenW 1, 0, 0, 320, 300, ~15
Set Win1RT = D2GetRT() ' creates a standard D2Font object
D2GetFontObj DefaultFnt ' save the standard D2Font
Do
Sleep
Until Me Is Nothing
Sub Win_1_Paint
Local sTxt As String = "Hello Direct2D World"
D2BeginDraw Win1RT, D2C_White
' Create a new font Gabriola, height=20, italic=true
D2SetFont " Gabriola , 20,,True"
D2Text 10, 10, sTxt
' Select original default font using D2Font object
D2SetFont DefaultFnt
D2Text 10, 40, "Using DirectWrite"
D2EndDraw
EndSub
Sub Win_1_ReSize
D2ResizeRT Win1RT, _X, _Y
D2Font, D2FontSize, D2FontBold, D2FontItalic, D2FontStretch, D2FontName, D2FontLocaleName, D2RFont, D2SetFont.
{Created by Sjouke Hamstra; Last updated: 27/12/2021 by James Gaite}