English 中文(简体)
我怎么能够把自己的字句添加到直接X上?
原标题:How can I add my own font to DirectX?
  • 时间:2011-11-14 22:45:38
  •  标签:
  • directx-9

I want to add new font and draw text on the screen.

...... 我用这个字体来起草案文,正文为阿里文。

I don t know the reason.

这里是我的法典。

请见并帮助我。

HANDLE          hFind;
WIN32_FIND_DATA wfd;
WCHAR           szFontPath[MAX_PATH];
int             nNum;

swprintf(szFontPath, L"%s\Fonts\*.*", m_szAppPath);
hFind = FindFirstFile(szFontPath, &wfd);
if(hFind == INVALID_HANDLE_VALUE)
    return;
do 
{
    if(wfd.cFileName[0] == L . )
        continue;
    swprintf(szFontPath, L"%s\Fonts\%s", m_szAppPath, wfd.cFileName);
    nNum = AddFontResource(szFontPath);
} 
while(FindNextFile(hFind, &wfd));
PostMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
FindClose(hFind);

页: 1 其他参考资料

int                     nHeight;
LPDIRECT3DSURFACE9      pSurface;
HDC                     hDC;

m_pDevice = pDevice;
m_pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurface);
pSurface->GetDC(&hDC);
nHeight = -MulDiv( dwSize, GetDeviceCaps(hDC, LOGPIXELSY), 72 );
pSurface->ReleaseDC(hDC);
m_hFont = CreateFont( nHeight, 0, 0, 0, bBold, bItalic, false, false, 
    HANGUL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
    DEFAULT_PITCH/* | FF_DONTCARE*/, L"Helvetica-Condensed-Black-Se");

pSurface->Release();
最佳回答

i 不能确保你能够指明一条通向的道路。 您可能需要通过将其复制到:窗口(或等值)

问题回答

Seems that this font can not support HANGUL_CHARSET. 要求使用DEFAULT-CHARSET。





相关问题
applying texture another problem directx c++

ok i got everything working. the texture only applys for two sides only of the cube the other sides won t display the correct texture. here is my code // Monopoly.cpp : Defines the entry point for ...

Huge problem when applying texture in directx 9 c++

I don t get any errors when I compile my game. The only problem is that it won t apply the texture, instead it applies a color (I know it is weird). If texture has two colors white and red then white ...

DirectX 9 advanced tutorials C++

I don t need tutorials talking about fvf or how to draw a triangle. I need some free tutorials that are about advanced things like meshes shadering.

directx apply texture

i found some examples how to apply texture on 2d object but nothing on 3d. if you know any tutorial or you can give me an example that would be greate.

directx tutorials c++

im searching for full directx tutorials i found directxtutorial.com but it only gave me the basic. couldn t find others that were full tutorials. have you find any or know any?

directx rotation c++

Okay this is a hard question. I m creating a cube and a pyramid in one vertex array. My problem is to rotate only pyramid vertex not the cube vertex but I don t know any function that can rotate some ...

Triangle rendering issue in directX

I am working with directX 9. I have a problem while rendering triangles using drawprimitive. The problem is - When I am rendering the whole object made of several triangles, the triangle having all ...

热门标签