首页 > 解决方案 > Windows字体光栅化,黑盒错误?

问题描述

因为我不想做提示,所以我放弃了自己光栅化 TTF 的努力,所以我转向了 Windows 的方法......我想我发现了一个错误。

我使用了 Windows 的DrawText函数,左栏中是GLYPHMETRICS结构,其中加载了GetGlyphOutline

    SetRect(&rect, 10,0,5,5);
    SetTextColor(glyph_hdc, RGB(255,0,0));
    DrawText(glyph_hdc, TEXT("A"), -1,&rect, DT_NOCLIP);
    ...
    SetRect(&rect, 70,0,5,5);
    SetTextColor(glyph_hdc, RGB(255,0,0));
    DrawText(glyph_hdc, TEXT("!"), -1,&rect, DT_NOCLIP);


GetGlyphOutlineA(glyph_hdc, ascii_code, GGO_BITMAP, &glyph_metric_A, 10000, win_bitmap, &m2);

我在 Adob​​e Illustrator 中使用灰色 2x1 矩形来测量距离... 在此处输入图像描述

我希望图片能很好地说明明显的错误:BlackBoxX 和 BlackBoxY 应该包含字形。你认为这是一个内部错误吗?你知道如何纠正这个吗?似乎黑匣子没有考虑到提示。

标签: windowsfontstruetyperasterizing

解决方案


推荐阅读