最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

winapi - DirectWrite detect font padding - Stack Overflow

programmeradmin3浏览0评论

When using Noto Music from google fonts from example, there is this byzantine symbol I would draw:

with a unicode value of 0x1D046.

Having created a text format to draw that now with a big font size,

    FLOAT fs = 110.0f;
    fa->CreateTextFormat(L"Noto Music", 0, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, fs, L"", &t1);

it does draw the font but the character is too small, that's why I have to use so big size.

The bounding rectangle is shown and it's taken with my measure function:

CComPtr<IDWriteTextLayout> lay = 0;
pWriteFactory->CreateTextLayout(txt, l == -1 ? (UINT32)wcslen(txt) : l, ffo, 10000, 10000, &lay);
DWRITE_TEXT_METRICS m = { 0 };
lay->GetMetrics(&m);
float wi = (float)m.widthIncludingTrailingWhitespace;
float he = (float)m.height;

It seems that the character itself is very small, compared to the rect available to display it. Is there a way to detect the actual character drawing itself?

发布评论

评论列表(0)

  1. 暂无评论