-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Labels
Description
Consider this formula:
\text{f(x)} = \cases{\text{1/3} & \text{if 0 ≤ x ≤ 1;} \\
\text{2/3} & \text{if 3 ≤ x ≤ 4;} \\
0..... & \colorbox{red}{\text{.elsewherge.}} \\
0..... & \colorbox{red}{\text{..}}}As you can see, on line elsewherge the red box is high and the item itself is shifted up because of this.
On the line .., on contrary, the box is quite low and thus the item is also placed incorrectly.
Now, consider this patch that temporarily disables the character depth calculation for the system fonts:
Index: src/WpfMath/Fonts/WpfSystemFont.cs
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/WpfMath/Fonts/WpfSystemFont.cs b/src/WpfMath/Fonts/WpfSystemFont.cs
--- a/src/WpfMath/Fonts/WpfSystemFont.cs (revision Staged)
+++ b/src/WpfMath/Fonts/WpfSystemFont.cs (date 1710012618138)
@@ -155,6 +155,6 @@
var scalingFactor = typeface.FontFamily.LineSpacing / typeface.FontFamily.Baseline;
height /= scalingFactor;
- return new TeXFontMetrics(formattedText.Width, height, depth, 0, 1.0);
+ return new TeXFontMetrics(formattedText.Width, height, 0, 0, 1.0);
}
}After it, the elsewherge placement is nearly perfect:

So, the problem is that the characters properly report its baseline to the box model, but it cannot take it into account when placing the matrix items (I believe that we should just take Height instead of TotalHeight somewhere in the matrix calculation).
