Sign in to follow this  

Can't change size of 3D font

This topic is 4838 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

Hello, I'm experimenting with 3d fonts but I can't seem to change the size of my font. I first create my font with CreateFont, but no matter what I put for height and width, the size always remains the same. Any suggestions?
// Create a font for the 3d text
HFONT hFont = CreateFont(0, 0, 
                         0, 0,
                         FW_NORMAL,
                         FALSE, FALSE, FALSE,
                         DEFAULT_CHARSET,
                         OUT_DEFAULT_PRECIS,
                         CLIP_DEFAULT_PRECIS,
                         DEFAULT_QUALITY,
                         DEFAULT_PITCH | FF_DONTCARE,
                         "Arial");
    
// Get the device context
HDC hdc = CreateCompatibleDC( NULL );

// Use the font I just made and save the old one.
HFONT hFontOld = (HFONT)SelectObject(hdc, hFont); 

// Create the text mesh
if ( FAILED( D3DXCreateText( m_pD3DDevice,
                             hdc,
                             "Test text",
                             0.001f,
                             0.2f,
                             &m_pMesh,
                             NULL,
                             NULL ) ) )             
{
    MessageBox( m_mainWindowHandle, "D3DXCreateText() failed.", "Error", MB_OK | MB_ICONEXCLAMATION );
    return( E_FAIL );
}

// Restore the old font
SelectObject(hdc, hFontOld);

DeleteObject( hFont );
DeleteDC( hdc );

// Clip...

m_pD3DDevice->BeginScene();
m_pMesh->DrawSubset(0); 
m_pD3DDevice->EndScene();

[Edited by - Coder on September 17, 2004 2:35:49 AM]

Share this post


Link to post
Share on other sites

This topic is 4838 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this