Sign in to follow this  
donjonson

ID3DXFont question

Recommended Posts

donjonson    271
here is an example call of the D3DXCreateFont function: my question is reguarding the 10th arguement. Do I have to have a file for that font int the same directory? how does directX know whare to get the font? do I have to load it as a resource?
D3DXCreateFont( gD3dDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font );

and here is the description of the arguement list.
HRESULT WINAPI D3DXCreateFont(          LPDIRECT3DDEVICE9 pDevice,
    INT Height,
    UINT Width,
    UINT Weight,
    UINT MipLevels,
    BOOL Italic,
    DWORD CharSet,
    DWORD OutputPrecision,
    DWORD Quality,
    DWORD PitchAndFamily,
    LPCTSTR pFacename,
    LPD3DXFONT *ppFont
);


pDevice
[in] Pointer to an IDirect3DDevice9 interface, the device to be associated with the font object. 
Height
[in] The height of the characters in logical units.
Width
[in] The width of the characters in logical units.
Weight
[in] Typeface weight. One example is bold.
MipLevels
[in] The number of mipmap levels.
Italic
[in] True for italic font, false otherwise.
CharSet
[in] The character set of the font.
OutputPrecision
[in] Specifies how Microsoft Windows should attempt to match the desired font sizes and characteristics with actual fonts. Use OUT_TT_ONLY_PRECIS for instance, to ensure that you always get a TrueType® font.
Quality
[in] Specifies how Windows should match the desired font with a real font. It applies to raster fonts only and should not affect TrueType fonts.
PitchAndFamily
[in] Pitch and family index.
pFacename
[in] String containing the typeface name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks. 
ppFont
[out] Returns a pointer to an ID3DXFont interface, representing the created font object. 

Share this post


Link to post
Share on other sites
PumpkinPieman    382
How does directX know whare to get the font?:
I assume you are referring to the 11th argument. Direct X will look for fonts in the default windows font directory (on xp C:\windows\fonts\).

Do I have to have a file for that font int the same directory?:
Not that I'm aware.

Do I have to load it as a resource?
Nope.

Share this post


Link to post
Share on other sites
DrunkenHyena    805
I think the call is something like AddFontResource. A quick search on MSDN will tell you exactly. But basically it lets you take a font that is NOT installed in the system fonts directory and temporarily add it to the list of available fonts. Then you can use it with D3DXFont.

Share this post


Link to post
Share on other sites

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