Glyph layout corrections according to code review.

This commit is contained in:
vng 2013-03-21 17:31:32 +03:00 committed by Alex Zolotarev
parent 18021df482
commit 898ac84f05

View file

@ -236,20 +236,18 @@ namespace graphics
PathPoint arrPathStart = m_path.front();
/// @todo Do we really need offset pivot somewhere?
//m_path.offsetPoint(arrPathStart, m_textOffset).m_pt;
m_pivot = arrPathStart.m_pt;
// offset of the text from path's start
// Offset of the text from path's start.
// In normal behaviour it should be always > 0,
// but now we do scale tiles for the fixed layout.
double offset = m_textOffset - m_path.pathOffset();
/// @todo The path text is always inside the path geometry now.
//ASSERT_GREATER_OR_EQUAL(offset, 0.0, ());
if (offset < 0.0)
offset = 0.0;
if (-offset >= m_textLength)
return;
{
/// @todo Try to fix this heuristic.
if (offset > -3.0)
offset = 0.0;
else
return;
}
// find first visible glyph
size_t symPos = 0;
@ -258,6 +256,9 @@ namespace graphics
PathPoint glyphStartPt = m_path.offsetPoint(arrPathStart, offset);
/// @todo Calculate better pivot (invariant point when scaling and rotating text).
m_pivot = glyphStartPt.m_pt;
m_firstVisible = symPos;
GlyphLayoutElem prevElem; // previous glyph, to compute kerning from