we need to allow baseline offset when calculate text position

This commit is contained in:
ExMix 2013-05-30 18:39:46 +03:00 committed by Alex Zolotarev
parent c138ac9af2
commit 4140b7552a
3 changed files with 14 additions and 0 deletions

View file

@ -518,4 +518,13 @@ namespace graphics
{
return m_fontDesc;
}
int GlyphLayout::baseLineOffset()
{
int result = 0;
for (size_t i = 0; i < m_metrics.size(); ++i)
result = min(m_metrics[i].m_yOffset, result);
return -result;
}
}

View file

@ -120,5 +120,7 @@ namespace graphics
m2::PointD const & offset() const;
void setOffset(m2::PointD const & offs);
int baseLineOffset();
};
}

View file

@ -129,6 +129,9 @@ namespace graphics
m_glyphLayouts.push_back(GlyphLayout(p.m_glyphCache, p.m_auxFontDesc, m2::PointD(0, 0), auxRes[i], graphics::EPosCenter));
}
for (size_t i = 0; i < m_glyphLayouts.size(); ++i)
allElemHeight -= m_glyphLayouts[i].baseLineOffset();
double curShift = allElemHeight / 2;
/// performing aligning of glyphLayouts as for the center position