Skip to content

Commit

Permalink
Word Export LT-21673: bidi problem with switching run order (#194)
Browse files Browse the repository at this point in the history
To be consistent with how FLEX displays consecutive left-to-right
runs, we do not want to switch their order. Remove the code that was
doing the switching and causing the display to be different
between Word and FLEX.
  • Loading branch information
mark-sil authored Oct 31, 2024
1 parent cc18faf commit 78c66cd
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,30 +491,6 @@ public void AppendToParagraph(IFragment fragToCopy, Run run, bool forceNewParagr
else
{
lastPar = GetLastParagraph();

// If the project is bidi and
// the run we are adding is not rtl and
// the paragraph already contains runs and
// the previous run is not rtl
// then add a run between them that is rtl and contains a rtl character.
// This is needed to get the runs to switch their order in Word.
if (IsBidi && run.RunProperties?.RightToLeftText == null)
{
var childRuns = lastPar.Elements<Run>();
if(childRuns.Any())
{
var previousRun = childRuns.Last();
if (previousRun.RunProperties?.RightToLeftText == null)
{
// Add a unicode RTL mark between two runs that are not rtl.
var rtlRun = new WP.Run();
rtlRun.AppendChild(new WP.Text("\u200f"));
rtlRun.RunProperties = new RunProperties();
rtlRun.RunProperties.RightToLeftText = new RightToLeftText();
lastPar.AppendChild(rtlRun);
}
}
}
}

// Deep clone the run b/c of its tree of properties and to maintain styles.
Expand Down

0 comments on commit 78c66cd

Please sign in to comment.