summaryrefslogtreecommitdiff
path: root/vcl/generic
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-04-28 13:18:42 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-04-29 12:45:40 +0200
commit1f7d7d0f327aff54af8f9fa8b60e2460827dc4e1 (patch)
tree5dfda07446331e09cb9765606eb59c8258a44b57 /vcl/generic
parent2e302f18efe8f2e5f3c17d7734a8adcb670fbe42 (diff)
[harfbuzz] Fix text width calculation for real
No more second guessing if text width, we know that information already, so pass it around instead of trying to re-create it. Change-Id: I19faacbc309d38753c3c9f7214dfa0bf59cc66b5
Diffstat (limited to 'vcl/generic')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx35
1 files changed, 3 insertions, 32 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 856f8b43d310..496f2f21c26a 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -76,33 +76,9 @@ long ServerFontLayout::GetTextWidth() const
{
long nWidth;
if (bUseHarfBuzz)
- {
- GlyphVector aGlyphItems = GenericSalLayout::GetGlyphItems();
-
- if( aGlyphItems.empty() )
- return 0;
-
- // initialize the extent
- long nMinPos = 0;
- long nMaxPos = 0;
-
- for( GlyphVector::const_iterator pG = aGlyphItems.begin(), end = aGlyphItems.end(); pG != end ; ++pG )
- {
- // update the text extent with the glyph extent
- long nXPos = pG->maLinearPos.X();
- if( nMinPos > nXPos )
- nMinPos = nXPos;
- nXPos += pG->mnOrigWidth;
- if( nMaxPos < nXPos )
- nMaxPos = nXPos;
- }
-
- nWidth = nMaxPos - nMinPos;
- }
+ nWidth = GetWidth();
else
- {
nWidth = GenericSalLayout::GetTextWidth();
- }
return nWidth;
}
@@ -448,9 +424,6 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
continue;
}
- const GlyphMetric& rGM = rFont.GetGlyphMetric(nGlyphIndex);
- int nGlyphWidth = rGM.GetCharWidth();
-
long nGlyphFlags = 0;
if (bRightToLeft)
nGlyphFlags |= GlyphItem::IS_RTL_GLYPH;
@@ -473,10 +446,7 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
int32_t nYAdvance = pHbPositions[i].y_advance >> 6;
Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset));
-
- GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth);
- aGI.mnNewWidth = nXAdvance;
-
+ const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance);
rLayout.AppendGlyph(aGI);
aCurrPos.X() += nXAdvance;
@@ -485,6 +455,7 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
hb_buffer_destroy(pHbBuffer);
}
+ rLayout.SetWidth(aCurrPos.X());
hb_font_destroy(pHbFont);