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;
}