forked from organicmaps/organicmaps
we need to allow baseline offset when calculate text position
This commit is contained in:
parent
c138ac9af2
commit
4140b7552a
3 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,5 +120,7 @@ namespace graphics
|
|||
|
||||
m2::PointD const & offset() const;
|
||||
void setOffset(m2::PointD const & offs);
|
||||
|
||||
int baseLineOffset();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue