vcl/source/gdi/sallayout.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 793b66d942edd74e9e0368895575e48527e0793a
Author:     Don Lewis <truck...@apache.org>
AuthorDate: Thu Aug 9 23:01:28 2018 +0000
Commit:     Don Lewis <truck...@apache.org>
CommitDate: Thu Aug 9 23:01:28 2018 +0000

    nActiveCharPos can be less than mnMinCharPos if the ScriptItemize() call
    
    in UniscribeLayout::LayoutText() finds a mult-character script item
    that starts in the leading context and overlaps into the start of the
    run.  UniscribeLayout::LayoutText() drops the glyphs for the context
    characters, but does not (yet?) adjust the starting character position
    of the item.   Since the text layout direction can't change in the
    middle of the offending script item, we can safely use the direction at
    the start of the run.

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 0c59f79c4cc5..50fcf3346735 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1871,7 +1871,15 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs 
)
     // get the next codepoint index that needs fallback
     int nActiveCharPos = nCharPos[0];
     // get the end index of the active run
-    int nLastRunEndChar = (vRtl[nActiveCharPos - mnMinCharPos])?
+    // nActiveCharPos can be less than mnMinCharPos if the ScriptItemize() call
+    // in UniscribeLayout::LayoutText() finds a mult-character script item
+    // that starts in the leading context and overlaps into the start of the
+    // run.  UniscribeLayout::LayoutText() drops the glyphs for the context
+    // characters, but does not (yet?) adjust the starting character position
+    // of the item.   Since the text layout direction can't change in the
+    // middle of the offending script item, we can safely use the direction at
+    // the start of the run
+    int nLastRunEndChar = (vRtl[nActiveCharPos >= mnMinCharPos ? 
(nActiveCharPos - mnMinCharPos) : 0])?
         rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
     int nRunVisibleEndChar = nCharPos[0];
     // merge the fallback levels
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to