summaryrefslogtreecommitdiffstats
path: root/vcl/generic
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-05-06 16:54:53 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-05-06 17:22:30 +0200
commitf0393d7ff69011a16b100541ef18e5090544e4a1 (patch)
tree86c254a7dcc0e45852bb3c98cf5575ec1fef0ebb /vcl/generic
parentRemove unused variables (diff)
downloadcore-f0393d7ff69011a16b100541ef18e5090544e4a1.tar.gz
core-f0393d7ff69011a16b100541ef18e5090544e4a1.zip
[harfbuzz] Fix text width calculation, 3rd try
It turns out storing the width in the layout is not so good idea, because in some mysterious cases when font fallback is involved we call GetTextWidth() without calling LayoutText() first, and we return the width of the previous text run. It seems all I needed is to pass down the X offset with the glyph item, and take it into account when calculating the width. Change-Id: Idbdb6bba00573fb6ca773701757d667e21ac0912
Diffstat (limited to 'vcl/generic')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx14
1 files changed, 1 insertions, 13 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index cb6c1953a74a..935a0e5180d7 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -72,17 +72,6 @@ bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs )
}
// -----------------------------------------------------------------------
-long ServerFontLayout::GetTextWidth() const
-{
- long nWidth;
- if (bUseHarfBuzz)
- nWidth = GetWidth();
- else
- nWidth = GenericSalLayout::GetTextWidth();
-
- return nWidth;
-}
-
void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
GenericSalLayout::AdjustLayout( rArgs );
@@ -524,7 +513,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));
- const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance);
+ const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance, nXOffset);
rLayout.AppendGlyph(aGI);
aCurrPos.X() += nXAdvance;
@@ -533,7 +522,6 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
hb_buffer_destroy(pHbBuffer);
}
- rLayout.SetWidth(aCurrPos.X());
hb_font_destroy(pHbFont);