使用CreateFont加上抗锯齿FLAG只能在字号大于一定点数时才能出现平滑效果,
能在小号字型下实现吗?
最好能够是调用现有API,且不使用GDI+行吗?(不是懒,主要是追求速度,因为是在在DirectX下显示文本)
虽然Widnows的字体输出函数理论上应完全可以,但我怎么看的许多代码都是自己设计的反走样代码呀?这样太慢了(比MS的更慢)。
请教。

解决方案 »

  1.   

    是不是只能用GetGlyphOutline,但听说这个函数BUG巨多,速度巨慢。
      

  2.   

    GDI+有字体的反走样函数,效果还可以,就是有点模糊
      

  3.   

    小号字时,多依赖字体内部的hint,避免笔画模糊,
    清晰已经不容易,平滑就有点勉强了,
    你说的小号字是多小的字号?
      

  4.   

    GDI+有现成技术,==我帮你去查......Antialiasing with Text :
    Microsoft® Windows® GDI+ provides various quality levels for drawing text. Typically, higher quality rendering takes more processing time than lower quality rendering.
    The following example draws text with two different quality settings:FontFamily  fontFamily(L"Times New Roman");
    Font        font(&fontFamily, 32, FontStyleRegular, UnitPixel);
    SolidBrush  solidBrush(Color(255, 0, 0, 255));
    WCHAR       string1[] = L"SingleBitPerPixel";
    WCHAR       string2[] = L"AntiAlias";graphics.SetTextRenderingHint(TextRenderingHintSingleBitPerPixel);
    graphics.DrawString(string1, -1, &font, PointF(10.0f, 10.0f), &solidBrush);graphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
    graphics.DrawString(string2, -1, &font, PointF(10.0f, 60.0f), &solidBrush);但是速度可能稍微慢点
      

  5.   

    谢谢大家,最后我还是用GetGlyphOutline指定BITMAP_GRAY8获得了任意字号下的6位?灰度图像,就像Photoshop中一样(当然实际差远了),并存入cache中。出于速度和通用性考虑没有使用GDI+