D3D中设置字体的下划线

zyfu0000 2009-02-22 12:13:16
在Directx中D3DXCreateFont()与D3DXCreateFontIndirect()函数中都没有设置字体下划线属性,请问要怎么设置?
...全文
147 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyfu0000 2009-02-25
  • 打赏
  • 举报
回复
哦 谢了!!
AliasKavin 2009-02-24
  • 打赏
  • 举报
回复
在DX的早期版本中使用LOGFONT时可以使用下划线, 不过新的版本中D3DXFONT_DESC去掉了这个设置,你可以在画文字时使用DT_BOTTOM, 并在下面画线来实现效果~~~
为什么去掉偶也不清楚~!
张赐 2009-02-23
  • 打赏
  • 举报
回复
可以设置的



//
// Get a handle to a device context.
//
HDC hdc = CreateCompatibleDC( 0 );
HFONT hFont;
HFONT hFontOld;

//
// Describe the font we want.
//

LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));

lf.lfHeight = 25; // in logical units
lf.lfWidth = 12; // in logical units
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = 500; // boldness, range 0(light) - 1000(bold)
lf.lfItalic = false;
lf.lfUnderline = false; //这里就是下划线
lf.lfStrikeOut = false;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = 0;
lf.lfClipPrecision = 0;
lf.lfQuality = 0;
lf.lfPitchAndFamily = 0;
strcpy(lf.lfFaceName, "Times New Roman"); // font style

//
// Create the font and select it with the device context.
//
hFont = CreateFontIndirect(&lf);
hFontOld = (HFONT)SelectObject(hdc, hFont);

//
// Create the text mesh based on the selected font in the HDC.
//
D3DXCreateText(Device, hdc, "Direct3D",
0.001f, 0.4f, &Text, 0, 0);

//
// Restore the old font and free the acquired HDC.
//
SelectObject(hdc, hFontOld);
DeleteObject( hFont );
DeleteDC( hdc );

allenhiman 2009-02-23
  • 打赏
  • 举报
回复
下划线,基本上只能是先创建文字的d3d模型,然后显示
有人说:D3D Font class doesn't support all the System.Drawing.Font properties - italics works, but that's it, bold, strikeout, and underline don't.

具体不知道,反正D3DXFONT_DESC没有对下划线的设置,我估计d3d不支持书写带下划线的文字
allenhiman 2009-02-23
  • 打赏
  • 举报
回复
注意Text是创建出来的3d模型
zyfu0000 2009-02-23
  • 打赏
  • 举报
回复
不好用!
IONPhantom 2009-02-22
  • 打赏
  • 举报
回复
还真没看见可以设置下划线的参数,而且DXSDK中的例子也没有使用下划线的例子

8,303

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧