Kaydet (Commit) 2417df71 authored tarafından Martin Hosken's avatar Martin Hosken Kaydeden (comit) Tor Lillqvist

Fix tdf95222, graphite justification

Change-Id: I9ea7167ca21bc18db6ed7f82fc54f3824468db4e
Reviewed-on: https://gerrit.libreoffice.org/20276Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMartin Hosken <martin_hosken@sil.org>
(cherry picked from commit fbad13e4)
üst 2aca701f
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#undef NDEBUG #undef NDEBUG
#endif #endif
// #define GRLAYOUT_DEBUG 1 //#define GRLAYOUT_DEBUG 1
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
...@@ -602,6 +602,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) ...@@ -602,6 +602,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
++nClusterCount; ++nClusterCount;
} }
} }
#ifdef GRLAYOUT_DEBUG
fprintf(grLog(), "Expand by width %f for %ld clusters\n", nDeltaWidth, nClusterCount);
#endif
if (nClusterCount > 1) if (nClusterCount > 1)
{ {
float fExtraPerCluster = static_cast<float>(nDeltaWidth) / static_cast<float>(nClusterCount - 1); float fExtraPerCluster = static_cast<float>(nDeltaWidth) / static_cast<float>(nClusterCount - 1);
...@@ -740,25 +743,26 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt ...@@ -740,25 +743,26 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
// calculate visual cluster widths // calculate visual cluster widths
if (lastChar > args.mnEndCharPos) lastChar = args.mnEndCharPos; if (lastChar > args.mnEndCharPos) lastChar = args.mnEndCharPos;
if (firstChar < args.mnMinCharPos) firstChar = args.mnMinCharPos; if (firstChar < args.mnMinCharPos) firstChar = args.mnMinCharPos;
long nNewClusterWidth = args.mpDXArray[lastChar - args.mnMinCharPos];
long nOrigClusterWidth = mvCharDxs[lastChar - mnMinCharPos]; long nOrigClusterWidth = mvCharDxs[lastChar - mnMinCharPos];
long nNewClusterWidth = args.mpDXArray[lastChar - args.mnMinCharPos];
long nDGlyphOrigin = 0; long nDGlyphOrigin = 0;
if (firstChar >= args.mnMinCharPos) if (firstChar > args.mnMinCharPos)
{ {
nNewClusterWidth -= args.mpDXArray[firstChar - args.mnMinCharPos]; //nNewClusterWidth -= args.mpDXArray[firstChar - args.mnMinCharPos];
nOrigClusterWidth -= mvCharDxs[firstChar - mnMinCharPos]; //nOrigClusterWidth -= mvCharDxs[firstChar - mnMinCharPos];
nDGlyphOrigin = args.mpDXArray[firstChar - args.mnMinCharPos] nDGlyphOrigin = args.mpDXArray[firstChar - args.mnMinCharPos - 1]
- mvCharDxs[firstChar - mnMinCharPos]; - mvCharDxs[firstChar - mnMinCharPos - 1];
} }
// update visual cluster // update visual cluster
long nDWidth = nNewClusterWidth - nOrigClusterWidth; long nDWidth = nNewClusterWidth - nOrigClusterWidth;
if (firstChar >= args.mnMinCharPos) if (firstChar >= args.mnMinCharPos)
for (int n = firstChar; n <= lastChar; ++n) for (int n = firstChar; n <= lastChar; ++n)
if (mvCharDxs[n - mnMinCharPos] != -1) if (n > mnMinCharPos && mvCharDxs[n - mnMinCharPos - 1] != -1)
mvCharDxs[n - mnMinCharPos] += nDWidth + nDGlyphOrigin; mvCharDxs[n - mnMinCharPos - 1] += nDGlyphOrigin; // + nDWidth;
for (unsigned int n = i; n < nLastGlyph; n++) for (unsigned int n = i; n < nLastGlyph; n++)
mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl ? -1 : 1); //mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl ? -1 : 1);
mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin * (bRtl ? -1 : 1);
rDeltaWidth[nBaseGlyph] = nDWidth; rDeltaWidth[nBaseGlyph] = nDWidth;
#ifdef GRLAYOUT_DEBUG #ifdef GRLAYOUT_DEBUG
...@@ -771,6 +775,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt ...@@ -771,6 +775,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
// Update the dx vector with the new values. // Update the dx vector with the new values.
std::copy(args.mpDXArray, args.mpDXArray + nChars, std::copy(args.mpDXArray, args.mpDXArray + nChars,
mvCharDxs.begin() + (args.mnMinCharPos - mnMinCharPos)); mvCharDxs.begin() + (args.mnMinCharPos - mnMinCharPos));
//args.mpDXArray[0] = 0;
#ifdef GRLAYOUT_DEBUG #ifdef GRLAYOUT_DEBUG
fprintf(grLog(),"ApplyDx %ld(%ld)\n", args.mpDXArray[nChars - 1], mnWidth); fprintf(grLog(),"ApplyDx %ld(%ld)\n", args.mpDXArray[nChars - 1], mnWidth);
#endif #endif
......
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