[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/source
Tamas Bunth
tamas.bunth at collabora.co.uk
Tue Mar 20 08:55:53 UTC 2018
vcl/source/gdi/sallayout.cxx | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
New commits:
commit c5f0c10b3cb3d7014bb127e8d811377279ab5228
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Sat Feb 10 17:11:37 2018 +0100
tdf#115353 tdf#114743 Use first valid glyph
in AdjustLayout.
Change-Id: Iaa9a0cde2bd35fed5cbc9ebf0690341812679b6f
Reviewed-on: https://gerrit.libreoffice.org/49542
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index b8957ae14eb3..403d0b64c723 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1206,15 +1206,27 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
double fUnitMul = 1.0;
for( n = 0; n < nLevel; ++n )
maFallbackRuns[n].ResetPos();
+
+ int nFirstValid = -1;
+ for( n = 0; n < nLevel; ++n )
+ {
+ if(nValid[n] > 0)
+ {
+ nFirstValid = n;
+ break;
+ }
+ }
+ assert(nFirstValid >= 0);
+
// get the next codepoint index that needs fallback
- int nActiveCharPos = pGlyphs[0]->mnCharPos;
+ int nActiveCharPos = pGlyphs[nFirstValid]->mnCharPos;
int nActiveCharIndex = nActiveCharPos - mnMinCharPos;
// get the end index of the active run
int nLastRunEndChar = (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) ?
rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
- int nRunVisibleEndChar = pGlyphs[0]->mnCharPos;
+ int nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos;
// merge the fallback levels
- while( nValid[0] && (nLevel > 0))
+ while( nValid[nFirstValid] && (nLevel > 0))
{
// find best fallback level
for( n = 0; n < nLevel; ++n )
@@ -1241,15 +1253,15 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
// drop the NotDef glyphs in the base layout run if a fallback run exists
while (
- (maFallbackRuns[n-1].PosIsInRun(pGlyphs[0]->mnCharPos)) &&
- (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[0]->mnCharPos))
+ (maFallbackRuns[n-1].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos)) &&
+ (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->mnCharPos))
)
{
mpLayouts[0]->DropGlyph( nStartOld[0] );
nStartOld[0] = nStartNew[0];
- nValid[0] = mpLayouts[0]->GetNextGlyphs(1, &pGlyphs[0], aPos, nStartNew[0]);
+ nValid[nFirstValid] = mpLayouts[0]->GetNextGlyphs(1, &pGlyphs[nFirstValid], aPos, nStartNew[0]);
- if( !nValid[0] )
+ if( !nValid[nFirstValid] )
break;
}
}
@@ -1301,9 +1313,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
else
{
// break when a fallback is needed and available
- bool bNeedFallback = maFallbackRuns[0].PosIsInRun(pGlyphs[0]->mnCharPos);
+ bool bNeedFallback = maFallbackRuns[0].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos);
if( bNeedFallback )
- if (!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[0]->mnCharPos))
+ if (!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[nFirstValid]->mnCharPos))
break;
// break when change from resolved to unresolved base layout run
if( bKeepNotDef && !bNeedFallback )
@@ -1356,7 +1368,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
nRunAdvance -= aMultiArgs.mpDXArray[nLastRunEndChar - mnMinCharPos];
}
nLastRunEndChar = nRunVisibleEndChar;
- nRunVisibleEndChar = pGlyphs[0]->mnCharPos;
+ nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos;
// the requested width is still in pixel units
// => convert it to base level font units
nRunAdvance *= mnUnitsPerPixel;
@@ -1373,7 +1385,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
nXPos += nRunAdvance;
// prepare for next fallback run
- nActiveCharPos = pGlyphs[0]->mnCharPos;
+ nActiveCharPos = pGlyphs[nFirstValid]->mnCharPos;
// it essential that the runs don't get ahead of themselves and in the
// if( bKeepNotDef && !bNeedFallback ) statement above, the next run may
// have already been reached on the base level
More information about the Libreoffice-commits
mailing list