summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mathml/tools/stretchy.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/mathml/tools/stretchy.py
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/mathml/tools/stretchy.py')
-rwxr-xr-xtesting/web-platform/tests/mathml/tools/stretchy.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/mathml/tools/stretchy.py b/testing/web-platform/tests/mathml/tools/stretchy.py
new file mode 100755
index 0000000000..b93dbcee74
--- /dev/null
+++ b/testing/web-platform/tests/mathml/tools/stretchy.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+from utils import mathfont
+import fontforge
+
+# Create a WOFF font with glyphs for all the operator strings.
+font = mathfont.create("stretchy", "Copyright (c) 2021 Igalia S.L.")
+
+# Set parameters for stretchy tests.
+font.math.MinConnectorOverlap = mathfont.em // 2
+
+# Make sure that underover parameters don't add extra spacing.
+font.math.LowerLimitBaselineDropMin = 0
+font.math.LowerLimitGapMin = 0
+font.math.StretchStackBottomShiftDown = 0
+font.math.StretchStackGapAboveMin = 0
+font.math.UnderbarVerticalGap = 0
+font.math.UnderbarExtraDescender = 0
+font.math.UpperLimitBaselineRiseMin = 0
+font.math.UpperLimitGapMin = 0
+font.math.StretchStackTopShiftUp = 0
+font.math.StretchStackGapBelowMin = 0
+font.math.OverbarVerticalGap = 0
+font.math.AccentBaseHeight = 0
+font.math.OverbarExtraAscender = 0
+
+# These two characters will be stretchable in both directions.
+horizontalArrow = 0x295A # LEFTWARDS HARPOON WITH BARB UP FROM BAR
+verticalArrow = 0x295C # UPWARDS HARPOON WITH BARB RIGHT FROM BAR
+
+mathfont.createSizeVariants(font)
+
+# Add stretchy vertical and horizontal constructions for the horizontal arrow.
+mathfont.createSquareGlyph(font, horizontalArrow)
+mathfont.createStretchy(font, horizontalArrow, True)
+mathfont.createStretchy(font, horizontalArrow, False)
+
+# Add stretchy vertical and horizontal constructions for the vertical arrow.
+mathfont.createSquareGlyph(font, verticalArrow)
+mathfont.createStretchy(font, verticalArrow, True)
+mathfont.createStretchy(font, verticalArrow, False)
+
+mathfont.save(font)