关于directx字体显示

bigbirdwind 2014-11-25 11:29:30
当backbuffer分辨率大于窗口客户区时,字体显示的质量不好,效果如下图,有什么解决方法
...全文
184 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-11-26
  • 打赏
  • 举报
回复
引用 8 楼 u013400368 的回复:
[quote=引用 5 楼 FancyMouse 的回复:] 先缩放图片,然后再渲染字体。先字体再缩放必然效果极差。
不太明白你的意思。 我是直接渲染字体,然后因为d3d的分辨率小于窗口客户区而效果不好 [/quote] 所以很多游戏不支持全屏/窗口或全屏/窗口时帧率和效果差别很大。
bigbirdwind 2014-11-26
  • 打赏
  • 举报
回复
引用 5 楼 FancyMouse 的回复:
先缩放图片,然后再渲染字体。先字体再缩放必然效果极差。
不太明白你的意思。 我是直接渲染字体,然后因为d3d的分辨率小于窗口客户区而效果不好
赵4老师 2014-11-26
  • 打赏
  • 举报
回复
引用 5 楼 FancyMouse 的回复:
先缩放图片,然后再渲染字体。先字体再缩放必然效果极差。
不一定,试试PhotoShop缩小图片功能。
FancyMouse 2014-11-26
  • 打赏
  • 举报
回复
先缩放图片,然后再渲染字体。先字体再缩放必然效果极差。
赵4老师 2014-11-26
  • 打赏
  • 举报
回复
引用 5 楼 FancyMouse 的回复:
先缩放图片,然后再渲染字体。先字体再缩放必然效果极差。
这个应该才是最终解决方案。
赵4老师 2014-11-26
  • 打赏
  • 举报
回复
引用 12 楼 u013400368 的回复:
[quote=引用 11 楼 zhao4zhong1 的回复:] 要不先试试用 SetStretchBltMode(DC,HALFTONE); StretchBlt(...)
direct3d和GDI混用?[/quote] 这也是个问题。
bigbirdwind 2014-11-26
  • 打赏
  • 举报
回复
引用 11 楼 zhao4zhong1 的回复:
要不先试试用 SetStretchBltMode(DC,HALFTONE); StretchBlt(...)
direct3d和GDI混用?
赵4老师 2014-11-26
  • 打赏
  • 举报
回复
要不先试试用 SetStretchBltMode(DC,HALFTONE); StretchBlt(...)
bigbirdwind 2014-11-26
  • 打赏
  • 举报
回复
引用 3 楼 zhao4zhong1 的回复:
继续瞎猜:(非专业回答) desc.Quality = PROOF_QUALITY;//DEFAULT_QUALITY; desc.OutputPrecision = 从下面挑几个值换换看 fdwOutputPrecision Specifies the output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, pitch, and font type. It can be one of the following values: Value Meaning OUT_CHARACTER_PRECIS Not used. OUT_DEFAULT_PRECIS Specifies the default font mapper behavior. OUT_DEVICE_PRECIS Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name. OUT_OUTLINE_PRECIS Windows NT: This value instructs the font mapper to choose from TrueType and other outline-based fonts. OUT_RASTER_PRECIS Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name. OUT_STRING_PRECIS This value is not used by the font mapper, but it is returned when raster fonts are enumerated. OUT_STROKE_PRECIS Windows NT: This value is not used by the font mapper, but it is returned when TrueType, other outline-based fonts, and vector fonts are enumerated. Windows 95: This value is used to map vector fonts, and is returned when TrueType or vector fonts are enumerated. OUT_TT_ONLY_PRECIS Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system, the font mapper returns to default behavior. OUT_TT_PRECIS Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name. Applications can use the OUT_DEVICE_PRECIS, OUT_RASTER_PRECIS, and OUT_TT_PRECIS values to control how the font mapper chooses a font when the operating system contains more than one font with a specified name. For example, if an operating system contains a font named Symbol in raster and TrueType form, specifying OUT_TT_PRECIS forces the font mapper to choose the TrueType version. Specifying OUT_TT_ONLY_PRECIS forces the font mapper to choose a TrueType font, even if it must substitute a TrueType font of another name.
嗯,效果更好,不过比例相差太大还是效果不好,我仔细看过一些窗口化的游戏,好像都是在完成缩放窗口后调整字体。
bigbirdwind 2014-11-26
  • 打赏
  • 举报
回复
如果要做成只有窗口化,完成拉伸窗口是不是都应该丢失再恢复设备和资源来适应窗口?这样子字体调整起来更容易
引用 9 楼 zhao4zhong1 的回复:
[quote=引用 8 楼 u013400368 的回复:] [quote=引用 5 楼 FancyMouse 的回复:] 先缩放图片,然后再渲染字体。先字体再缩放必然效果极差。
不太明白你的意思。 我是直接渲染字体,然后因为d3d的分辨率小于窗口客户区而效果不好 [/quote] 所以很多游戏不支持全屏/窗口或全屏/窗口时帧率和效果差别很大。[/quote]
bigbirdwind 2014-11-25
  • 打赏
  • 举报
回复
引用 1 楼 zhao4zhong1 的回复:
字体属性里面有没有类似高质量、平滑、反锯齿、……等类似的字眼设置一下?我瞎猜。
我用DXUT里的字体属性 desc.Height = iHeight; desc.Width = 0; desc.Weight = iWeight; desc.MipLevels = 1; desc.Italic = bItalic; desc.CharSet = DEFAULT_CHARSET; desc.OutputPrecision = OUT_DEFAULT_PRECIS; desc.Quality = DEFAULT_QUALITY; desc.PitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
赵4老师 2014-11-25
  • 打赏
  • 举报
回复
字体属性里面有没有类似高质量、平滑、反锯齿、……等类似的字眼设置一下?我瞎猜。
赵4老师 2014-11-25
  • 打赏
  • 举报
回复
继续瞎猜:(非专业回答) desc.Quality = PROOF_QUALITY;//DEFAULT_QUALITY; desc.OutputPrecision = 从下面挑几个值换换看 fdwOutputPrecision Specifies the output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, pitch, and font type. It can be one of the following values: Value Meaning OUT_CHARACTER_PRECIS Not used. OUT_DEFAULT_PRECIS Specifies the default font mapper behavior. OUT_DEVICE_PRECIS Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name. OUT_OUTLINE_PRECIS Windows NT: This value instructs the font mapper to choose from TrueType and other outline-based fonts. OUT_RASTER_PRECIS Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name. OUT_STRING_PRECIS This value is not used by the font mapper, but it is returned when raster fonts are enumerated. OUT_STROKE_PRECIS Windows NT: This value is not used by the font mapper, but it is returned when TrueType, other outline-based fonts, and vector fonts are enumerated. Windows 95: This value is used to map vector fonts, and is returned when TrueType or vector fonts are enumerated. OUT_TT_ONLY_PRECIS Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system, the font mapper returns to default behavior. OUT_TT_PRECIS Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name. Applications can use the OUT_DEVICE_PRECIS, OUT_RASTER_PRECIS, and OUT_TT_PRECIS values to control how the font mapper chooses a font when the operating system contains more than one font with a specified name. For example, if an operating system contains a font named Symbol in raster and TrueType form, specifying OUT_TT_PRECIS forces the font mapper to choose the TrueType version. Specifying OUT_TT_ONLY_PRECIS forces the font mapper to choose a TrueType font, even if it must substitute a TrueType font of another name.

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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