temml 0.10.19 → 0.10.21

Sign up to get free protection for your applications and to get access to all the features.
package/src/svg.js DELETED
@@ -1,110 +0,0 @@
1
- import mathMLTree from "./mathMLTree"
2
- import { Span, Svg } from "./domTree"
3
-
4
- const pathGeometry = {
5
- // tilde1 is a modified version of a glyph from the MnSymbol package
6
- tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
7
- -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
8
- 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
9
- 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
10
- -68.267.847-113-73.952-191-73.952z`,
11
-
12
- // ditto tilde2, tilde3, & tilde4
13
- tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418
14
- -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
15
- 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
16
- c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
17
- 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,
18
-
19
- tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
20
- -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
21
- 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
22
- 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
23
- -338 0-409-156.573-744-156.573z`,
24
-
25
- tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
26
- -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
27
- 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
28
- 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
29
- -175.236-744-175.236z`,
30
-
31
- // widehat1 is a modified version of a glyph from the MnSymbol package
32
- widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
33
- c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,
34
-
35
- // ditto widehat2, widehat3, & widehat4
36
- widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
37
- -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
38
-
39
- widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
40
- -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
41
-
42
- widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
43
- -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
44
-
45
- // widecheck paths are all inverted versions of widehat
46
- widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
47
- -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,
48
-
49
- widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
50
- -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
51
-
52
- widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
53
- -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
54
-
55
- widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
56
- -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`
57
-
58
- }
59
-
60
- export const svgAccent = group => {
61
- const label = group.label.slice(1)
62
- const numChars = group.base.type === "ordgroup" ? group.base.body.length : 1
63
- let viewBoxWidth
64
- let viewBoxHeight
65
- let pathName
66
- let height
67
-
68
- if (numChars > 5) {
69
- if (label === "widehat" || label === "widecheck") {
70
- viewBoxHeight = 420;
71
- viewBoxWidth = 2364;
72
- height = 0.42;
73
- pathName = label + "4";
74
- } else {
75
- viewBoxHeight = 312;
76
- viewBoxWidth = 2340;
77
- height = 0.34;
78
- pathName = "tilde4";
79
- }
80
- } else {
81
- const imgIndex = [1, 1, 2, 2, 3, 3][numChars];
82
- if (label === "widehat" || label === "widecheck") {
83
- viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
84
- viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
85
- height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
86
- pathName = label + imgIndex;
87
- } else {
88
- viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
89
- viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
90
- height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
91
- pathName = "tilde" + imgIndex;
92
- }
93
- }
94
- const svg = new Svg(
95
- { width: "100%",
96
- height: `${height}em`,
97
- viewBox: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
98
- preserveAspectRatio: "none"
99
- },
100
- pathGeometry[pathName],
101
- null
102
- )
103
- const span = new Span([], [svg],
104
- { display: "inline-block", position: "relative", width: "100%", height: `${height}em` }
105
- )
106
- const node = new mathMLTree.MathNode("mo", [span], [], { "math-depth":1 })
107
- node.setAttribute("stretchy", "true")
108
- return node
109
-
110
- }