• Advertisement

Archived

This topic is now archived and is closed to further replies.

Help with ID3DXFont

This topic is 5635 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I create a font then change the orientation (in the createfont command) it gets clipped off has anyone had a similar problem or know how to fix it
HFONT hFont = CreateFont( 
	30,
	14,
	400,
	0,
        NULL,
	FALSE,
	FALSE,
	FALSE,
	ANSI_CHARSET, 
	OUT_DEFAULT_PRECIS, 
	CLIP_DEFAULT_PRECIS,
	ANTIALIASED_QUALITY,
	FF_DONTCARE,
	"Arial" );   


D3DCOLOR fontColor        = D3DCOLOR_ARGB(255,255,0,0);
    RECT rct;
    ZeroMemory( &rct, sizeof(rct) );       

    m_pD3DXFont->Begin();
    rct.left   = 100;
    rct.right  = 500;
    rct.bottom=50;
    rct.top=100;
      
    m_pD3DXFont->DrawText( "This is a test",15, &rct, DT_TOP , fontColor );

    m_pD3DXFont->End();

    
[edited by - willywig on August 14, 2002 9:23:56 PM]

Share this post


Link to post
Share on other sites
Advertisement
I used the CD3DFont. Here is some sample code. I had
some trouble before also, but this worked for me.
The restore device call is pretty important, so do not
forget it.

CD3DFont* m_pFont

-init
m_pFont = new CD3DFont(_T("Arial"), 12, D3DFONT_BOLD);
hResult = m_pFont->InitDeviceObjects( lp3DDevice );

-After Reset device or initializing
m_pFont->RestoreDeviceObjects();

-Rendering
m_pFong->DrawText( x, y, SomeD3DCOLOR_ARGB, YourText );

Share this post


Link to post
Share on other sites
That works but i want to draw the text rotated CCW 90 degrees so it is vert... how can i do this without translating everything... can i just draw it that way?

Share this post


Link to post
Share on other sites

  • Advertisement