diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMPageConstructor.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMPageConstructor.cs index 7303173a885..a8a7e5a385d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMPageConstructor.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMPageConstructor.cs @@ -717,13 +717,15 @@ private bool _IsCombinable(FixedSOMFixedBlock fixedBlock, FixedSOMTextRun textRu //These two overlap vertically. Let's check whether there is a vertical separator in between double left = (fixedBlockRect.Right < textRunRect.Right) ? fixedBlockRect.Right: textRunRect.Right; double right =(fixedBlockRect.Left > textRunRect.Left) ? fixedBlockRect.Left: textRunRect.Left; - if (left > right) + if (left < right) { - double temp = left; - left = right; - right = temp; + return (!_lines.IsVerticallySeparated(left, textRunRect.Top, right, textRunRect.Bottom)); + } + else + { + // they also overlap horizontally, so they should be combined + return true; } - return (!_lines.IsVerticallySeparated(left, textRunRect.Top, right, textRunRect.Bottom)); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedTextBuilder.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedTextBuilder.cs index 90f10ed1826..f147725be83 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedTextBuilder.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedTextBuilder.cs @@ -1033,7 +1033,7 @@ Matrix transform newPathPrefix, // otherwise use this path prefix constructLines, fixedNodes, - transform * localTransform.Value + localTransform.Value * transform ); }//endofElementIsCanvas }