Kaydet (Commit) 448680d1 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Jan Holesovsky

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 53a40c43)
Reviewed-on: https://gerrit.libreoffice.org/18268Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 50e82134
...@@ -1736,6 +1736,12 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const ...@@ -1736,6 +1736,12 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const
Point aPos = GetDrawPosition( aRelPos ); Point aPos = GetDrawPosition( aRelPos );
int nAdvance = 0; 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++) for (int i = nMinGlyphPos; i < nEndGlyphPos; i++)
{ {
assert(mrWinFontEntry.GlyphIsCached(mpOutGlyphs[i])); assert(mrWinFontEntry.GlyphIsCached(mpOutGlyphs[i]));
...@@ -1759,7 +1765,7 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const ...@@ -1759,7 +1765,7 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const
rChunk.maLocation[n].getWidth(), rChunk.maLocation[n].getHeight()); // ??? rChunk.maLocation[n].getWidth(), rChunk.maLocation[n].getHeight()); // ???
pImpl->DrawMask(*rChunk.mpTexture, salColor, a2Rects); pImpl->DrawMask(*rChunk.mpTexture, salColor, a2Rects);
} }
nAdvance += mpGlyphAdvances[i]; nAdvance += pGlyphWidths[i];
} }
} }
pImpl->PostDraw(); pImpl->PostDraw();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment