Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows GetCharABCWidths()和GetGlyphOutline()返回FALSE。为什么?_Windows_Winapi - Fatal编程技术网

Windows GetCharABCWidths()和GetGlyphOutline()返回FALSE。为什么?

Windows GetCharABCWidths()和GetGlyphOutline()返回FALSE。为什么?,windows,winapi,Windows,Winapi,当字体大小从(-16*i)/72更改为(-n*i)/72(对于16以下的任何n)时,GetCharABCWidths()和GetGlyphOutline()函数中似乎存在错误 字符“a”仍然正确显示,但函数返回FALSE和GDI_错误。 为什么 GetCharABCWidths()的GetLastError()返回0(错误\u成功),对于 GetGlyphOutline()GetLastError()返回1003(无法完成函数) 在我的系统上,Symbol既是光栅字体(symbole.fon)又

当字体大小从(-16*i)/72更改为(-n*i)/72(对于16以下的任何n)时,GetCharABCWidths()和GetGlyphOutline()函数中似乎存在错误

字符“a”仍然正确显示,但函数返回FALSE和GDI_错误。 为什么

GetCharABCWidths()的GetLastError()返回0(错误\u成功),对于 GetGlyphOutline()GetLastError()返回1003(无法完成函数)


在我的系统上,Symbol既是光栅字体(
symbole.fon
)又是OpenType字体(
Symbol.ttf
),因此当GDI决定使用该字体的光栅版本时,您将无法获得任何TrueType指标。要解决此问题,请将
LOGFONT
fdwOutputPrecision
成员设置为合适的值,例如
OUT\u TT\u PRECIS

。这些函数现在在n=14的情况下工作。你能解释一下为什么他们以前只为n>=16工作吗?@jaayrosa我的光栅字体提供了8、10、12、14、18、24的大小。所以我希望你的代码在这六个值上失败。但我不知道GDI使用什么算法来选择字体。我真的很感谢你的帮助。我怎么知道我的系统上安装的字体?@jaayrosa我只是在“控制面板”的“字体”下查看了一下。如果您阅读了MSDN,但它没有说您可以调用GetLastError(),那么调用它是毫无意义的。通常GDI函数不支持GetLastError()!
MAT2 gmat = { {0, 1}, {0, 0}, {0, 0}, {0, 1} };


case WM_PAINT:

        PAINTSTRUCT ps;

        BeginPaint(hwnd, &ps);

        int i;

        i = GetDeviceCaps(ps.hdc, LOGPIXELSY);

        LOGFONT lf;

        memset(&lf, 0, sizeof(LOGFONT));
        lf.lfHeight = (-14 * i) / 72;
        lf.lfWeight = FW_NORMAL;
        lf.lfItalic = 0;
        lf.lfCharSet = SYMBOL_CHARSET;
        wcscpy(lf.lfFaceName, L"Symbol");

        HFONT hFont;

        hFont = CreateFontIndirect(&lf);
        hFont = (HFONT)SelectObject(ps.hdc, hFont);

        BOOL bx;
        ABC abc;
        TCHAR tx;
        DWORD dwx;

        tx = 'a';

        if( !GetCharABCWidths(ps.hdc, tx, tx, &abc) ) dwx = GetLastError();

        GLYPHMETRICS gm;

        if( GetGlyphOutline(ps.hdc, tx, GGO_METRICS, &gm, 0, NULL, &gmat) == GDI_ERROR )
            dwx = GetLastError();

        TextOut(ps.hdc, 10, 20, (LPTSTR)&tx, 1);

        EndPaint(hwnd, &ps);