diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-02 15:40:53 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-09-02 14:46:41 +0000 |
commit | 448680d16585f454e609acfd09437b2607566714 (patch) | |
tree | 2ce26052401ea074426e827f6bbca4096da4f238 | |
parent | 50e82134148673583c42a3ddb2ce5c6cf0b01767 (diff) |
tdf#93857 opengl: adapt UniscribeLayout's DrawCachedGlyphs() to FillDXArray()
The problem was UniscribeLayout::DrawCachedGlyphs() counted the total
advance value unconditionally from mpGlyphAdvances, while
UniscribeLayout::FillDXArray() (which provides advance values to e.g.
Writer) only used mpGlyphAdvances in case of NULL mpJustifications. Fix
this by first checking mpJustifications in
UniscribeLayout::DrawCachedGlyphs(), too.
With this, e.g. typing "x" in Writer 10 times will not result in a
"misplaced" cursor caret.
Change-Id: I16c7a258ff77b25c5121b9b974e72ad6efe5e9fc
(cherry picked from commit 53a40c43a1ac88e761e97a2832367525ee6b0426)
Reviewed-on: https://gerrit.libreoffice.org/18268
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index c5f7e65c9a0e..2bd188783fc0 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -1736,6 +1736,12 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const Point aPos = GetDrawPosition( aRelPos ); int nAdvance = 0; + + // This has to be in sync with UniscribeLayout::FillDXArray(), so that + // actual and reported glyph positions (used for e.g. cursor caret + // positioning) match. + const int* pGlyphWidths = mpJustifications ? mpJustifications : mpGlyphAdvances; + for (int i = nMinGlyphPos; i < nEndGlyphPos; i++) { assert(mrWinFontEntry.GlyphIsCached(mpOutGlyphs[i])); @@ -1759,7 +1765,7 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const rChunk.maLocation[n].getWidth(), rChunk.maLocation[n].getHeight()); // ??? pImpl->DrawMask(*rChunk.mpTexture, salColor, a2Rects); } - nAdvance += mpGlyphAdvances[i]; + nAdvance += pGlyphWidths[i]; } } pImpl->PostDraw(); |