本文整理汇总了C++中Glyph::GetUnitsPerEm方法的典型用法代码示例。如果您正苦于以下问题:C++ Glyph::GetUnitsPerEm方法的具体用法?C++ Glyph::GetUnitsPerEm怎么用?C++ Glyph::GetUnitsPerEm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Glyph
的用法示例。
在下文中一共展示了Glyph::GetUnitsPerEm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawMusicText
void BBoxDeviceContext::DrawMusicText(const std::wstring& text, int x, int y)
{
assert( m_fontStack.top() );
int g_x, g_y, g_w, g_h;
int lastCharWidth = 0;
for (unsigned int i = 0; i < text.length(); i++)
{
wchar_t c = text[i];
Glyph *glyph = Resources::GetGlyph(c);
if (!glyph) {
continue;
}
glyph->GetBoundingBox(&g_x, &g_y, &g_w, &g_h);
int x_off = x + g_x * m_fontStack.top()->GetPointSize() / glyph->GetUnitsPerEm();
// because we are in the drawing context, y position are already flipped
int y_off = y - g_y * m_fontStack.top()->GetPointSize() / glyph->GetUnitsPerEm();
UpdateBB(x_off, y_off,
x_off + g_w * m_fontStack.top()->GetPointSize() / glyph->GetUnitsPerEm(),
// idem, y position are flipped
y_off - g_h * m_fontStack.top()->GetPointSize() / glyph->GetUnitsPerEm());
lastCharWidth = g_w * m_fontStack.top()->GetPointSize() / glyph->GetUnitsPerEm();
x += lastCharWidth; // move x to next char
}
}