From 898ac84f055ae538823bffcb33bb80896d962299 Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 21 Mar 2013 17:31:32 +0300 Subject: [PATCH] Glyph layout corrections according to code review. --- graphics/glyph_layout.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/graphics/glyph_layout.cpp b/graphics/glyph_layout.cpp index 34adf92098..d48b852fac 100644 --- a/graphics/glyph_layout.cpp +++ b/graphics/glyph_layout.cpp @@ -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