我试图使用TextOut()
展示U+1D400(代理对H = 0xD835
L = 0xDC00
),但无济于事。为什么?
案例WM_PAINT:
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
int iLogPixelsY;
iLogPixelsY = GetDeviceCaps(ps.hdc, LOGPIXELSY);
LOGFONT lf;
int iPts;
iPts = 11;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = -iPts * iLogPixelsY / 72;
lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;
wcscpy_s(lf.lfFaceName, L"Cambria Math");
HFONT hFont;
hFont = CreateFontIndirect(&lf);
hFont = (HFONT)SelectObject(ps.hdc, hFont);
wchar_t tx[2];
tx[0] = 0xD835;
tx[1] = 0xDC00;
TextOut(ps.hdc, 10, 100, tx, 1);
DeleteObject(SelectObject(ps.hdc, hFont));
EndPaint(hwnd, &ps);
break;
您正在调用TextOut指定字符串长度为1,但根据本文档,您应该传递2,因为它是一个代理对。