本文整理汇总了C++中FontPtr::getGlyphAspectRatio方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPtr::getGlyphAspectRatio方法的具体用法?C++ FontPtr::getGlyphAspectRatio怎么用?C++ FontPtr::getGlyphAspectRatio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPtr
的用法示例。
在下文中一共展示了FontPtr::getGlyphAspectRatio方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateTextPixelSize
void OgreText::calculateTextPixelSize(DisplayString text, FontPtr mpFont, Real mCharHeight, Real& width, Real& height)
{
Real vpWidth, vpHeight;
vpWidth = (Real) (OverlayManager::getSingleton().getViewportWidth());
vpHeight = (Real) (OverlayManager::getSingleton().getViewportHeight());
//ROS_ERROR("[viewport] w: %f h: %f",vpWidth,vpHeight);
Real mViewportAspectCoef = vpHeight/vpWidth;
height = mCharHeight;
width = 0;
Real len = 0.0f;
for(DisplayString::iterator i = text.begin();i!=text.end();++i)
{
Font::CodePoint character = OGRE_DEREF_DISPLAYSTRING_ITERATOR(i);
if (character == UNICODE_CR
|| character == UNICODE_NEL
|| character == UNICODE_LF)
{
height += mCharHeight;
if(len > width)
width = len;
len = 0;
}
else if (character == UNICODE_SPACE) // space
{
len += mpFont->getGlyphAspectRatio(UNICODE_ZERO) * mCharHeight;// * 2.0 * mViewportAspectCoef;
}
else
{
len += mpFont->getGlyphAspectRatio(character) * mCharHeight;// * 2.0 * mViewportAspectCoef;
}
}
if(len > width)
width = len;
}