# ID3DXFont question

## Recommended Posts

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 on other sites
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 on other sites
what if I want to use a font that is uncommon, will I have to place that font file into the users font directory during installation?

##### Share on other sites
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.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627684
• Total Posts
2978627

• 9
• 14
• 12
• 10
• 12