katex 0.13.20 → 0.13.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/cli.js +1 -1
- package/contrib/copy-tex/README.md +3 -3
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +5 -5
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +4 -4
- package/dist/katex.js +1625 -1602
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +2087 -2080
- package/package.json +16 -7
- package/src/buildCommon.js +12 -12
- package/src/buildHTML.js +5 -4
- package/src/delimiter.js +11 -10
- package/src/domTree.js +2 -1
- package/src/environments/array.js +9 -9
- package/src/environments/cd.js +2 -1
- package/src/fontMetricsData.js +2 -1
- package/src/fonts/generate_fonts.py +3 -6
- package/src/fonts/makeFF +2 -0
- package/src/functions/accent.js +4 -3
- package/src/functions/cr.js +3 -3
- package/src/functions/delimsizing.js +4 -2
- package/src/functions/enclose.js +7 -7
- package/src/functions/genfrac.js +2 -2
- package/src/functions/includegraphics.js +7 -9
- package/src/functions/lap.js +3 -2
- package/src/functions/op.js +2 -1
- package/src/functions/rule.js +10 -10
- package/src/functions/sizing.js +2 -1
- package/src/functions/sqrt.js +2 -1
- package/src/functions/supsub.js +3 -2
- package/src/functions/utils/assembleSupSub.js +6 -5
- package/src/katex.less +3 -3
- package/src/macros.js +3 -2
- package/src/mathMLTree.js +3 -2
- package/src/metrics/extract_ttfs.py +3 -0
- package/src/stretchy.js +8 -7
- package/src/units.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "katex",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.24",
|
|
4
4
|
"description": "Fast math typesetting for the web.",
|
|
5
5
|
"main": "dist/katex.js",
|
|
6
6
|
"homepage": "https://katex.org",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/KaTeX/KaTeX.git"
|
|
10
10
|
},
|
|
11
|
+
"funding": [
|
|
12
|
+
"https://opencollective.com/katex",
|
|
13
|
+
"https://github.com/sponsors/katex"
|
|
14
|
+
],
|
|
11
15
|
"files": [
|
|
12
16
|
"katex.js",
|
|
13
17
|
"cli.js",
|
|
@@ -21,6 +25,8 @@
|
|
|
21
25
|
"@babel/core": "^7.10.4",
|
|
22
26
|
"@babel/eslint-parser": "^7.15.0",
|
|
23
27
|
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
|
28
|
+
"@babel/plugin-syntax-flow": "^7.14.5",
|
|
29
|
+
"@babel/plugin-transform-react-jsx": "^7.14.9",
|
|
24
30
|
"@babel/plugin-transform-runtime": "^7.10.4",
|
|
25
31
|
"@babel/preset-env": "^7.10.4",
|
|
26
32
|
"@babel/preset-flow": "^7.10.4",
|
|
@@ -42,9 +48,11 @@
|
|
|
42
48
|
"caniuse-lite": "^1.0.30001102",
|
|
43
49
|
"css-loader": "^6.0.0",
|
|
44
50
|
"cssnano": "^5.0.0-rc.1",
|
|
45
|
-
"eslint": "^
|
|
46
|
-
"eslint-
|
|
47
|
-
"eslint-plugin-
|
|
51
|
+
"eslint": "^8.0.0",
|
|
52
|
+
"eslint-import-resolver-webpack": "^0.13.2",
|
|
53
|
+
"eslint-plugin-actions": "^2.0.0",
|
|
54
|
+
"eslint-plugin-flowtype": "^8.0.0",
|
|
55
|
+
"eslint-plugin-import": "^2.25.2",
|
|
48
56
|
"eslint-plugin-react": "^7.20.3",
|
|
49
57
|
"flow-bin": "^0.135.0",
|
|
50
58
|
"fs-extra": "^10.0.0",
|
|
@@ -68,6 +76,7 @@
|
|
|
68
76
|
"p-retry": "^4.6.1",
|
|
69
77
|
"pako": "^2.0.0",
|
|
70
78
|
"postcss": "^8.0.0",
|
|
79
|
+
"postcss-less": "^5.0.0",
|
|
71
80
|
"postcss-loader": "^6.0.0",
|
|
72
81
|
"postcss-preset-env": "^6.7.0",
|
|
73
82
|
"prettier": "^2.0.5",
|
|
@@ -78,8 +87,8 @@
|
|
|
78
87
|
"semantic-release": "^18.0.0",
|
|
79
88
|
"sri-toolbox": "^0.2.0",
|
|
80
89
|
"style-loader": "^3.0.0",
|
|
81
|
-
"stylelint": "^
|
|
82
|
-
"stylelint-config-standard": "^
|
|
90
|
+
"stylelint": "^14.0.0",
|
|
91
|
+
"stylelint-config-standard": "^23.0.0",
|
|
83
92
|
"terser-webpack-plugin": "^5.0.3",
|
|
84
93
|
"webpack": "^5.51.1",
|
|
85
94
|
"webpack-bundle-analyzer": "^4.0.0",
|
|
@@ -114,7 +123,7 @@
|
|
|
114
123
|
"dist:zip": "rimraf katex/ katex.tar.gz katex.zip && cp -R dist katex && tar czf katex.tar.gz katex && zip -rq katex.zip katex && rimraf katex/"
|
|
115
124
|
},
|
|
116
125
|
"dependencies": {
|
|
117
|
-
"commander": "^
|
|
126
|
+
"commander": "^8.0.0"
|
|
118
127
|
},
|
|
119
128
|
"husky": {
|
|
120
129
|
"hooks": {
|
package/src/buildCommon.js
CHANGED
|
@@ -9,7 +9,7 @@ import {SymbolNode, Anchor, Span, PathNode, SvgNode, createClass} from "./domTre
|
|
|
9
9
|
import {getCharacterMetrics} from "./fontMetrics";
|
|
10
10
|
import symbols, {ligatures} from "./symbols";
|
|
11
11
|
import {wideCharacterFont} from "./wide-character";
|
|
12
|
-
import {calculateSize} from "./units";
|
|
12
|
+
import {calculateSize, makeEm} from "./units";
|
|
13
13
|
import {DocumentFragment} from "./tree";
|
|
14
14
|
|
|
15
15
|
import type Options from "./Options";
|
|
@@ -364,7 +364,7 @@ const makeLineSpan = function(
|
|
|
364
364
|
thickness || options.fontMetrics().defaultRuleThickness,
|
|
365
365
|
options.minRuleThickness,
|
|
366
366
|
);
|
|
367
|
-
line.style.borderBottomWidth = line.height
|
|
367
|
+
line.style.borderBottomWidth = makeEm(line.height);
|
|
368
368
|
line.maxFontSize = 1.0;
|
|
369
369
|
return line;
|
|
370
370
|
};
|
|
@@ -550,7 +550,7 @@ const makeVList = function(params: VListParam, options: Options): DomSpan {
|
|
|
550
550
|
}
|
|
551
551
|
pstrutSize += 2;
|
|
552
552
|
const pstrut = makeSpan(["pstrut"], []);
|
|
553
|
-
pstrut.style.height = pstrutSize
|
|
553
|
+
pstrut.style.height = makeEm(pstrutSize);
|
|
554
554
|
|
|
555
555
|
// Create a new list of actual children at the correct offsets
|
|
556
556
|
const realChildren = [];
|
|
@@ -567,7 +567,7 @@ const makeVList = function(params: VListParam, options: Options): DomSpan {
|
|
|
567
567
|
const style = child.wrapperStyle || {};
|
|
568
568
|
|
|
569
569
|
const childWrap = makeSpan(classes, [pstrut, elem], undefined, style);
|
|
570
|
-
childWrap.style.top = (-pstrutSize - currPos - elem.depth)
|
|
570
|
+
childWrap.style.top = makeEm(-pstrutSize - currPos - elem.depth);
|
|
571
571
|
if (child.marginLeft) {
|
|
572
572
|
childWrap.style.marginLeft = child.marginLeft;
|
|
573
573
|
}
|
|
@@ -586,7 +586,7 @@ const makeVList = function(params: VListParam, options: Options): DomSpan {
|
|
|
586
586
|
// This cell's bottom edge will determine the containing table's baseline
|
|
587
587
|
// without overly expanding the containing line-box.
|
|
588
588
|
const vlist = makeSpan(["vlist"], realChildren);
|
|
589
|
-
vlist.style.height = maxPos
|
|
589
|
+
vlist.style.height = makeEm(maxPos);
|
|
590
590
|
|
|
591
591
|
// A second row is used if necessary to represent the vlist's depth.
|
|
592
592
|
let rows;
|
|
@@ -598,7 +598,7 @@ const makeVList = function(params: VListParam, options: Options): DomSpan {
|
|
|
598
598
|
// So we put another empty span inside the depth strut span.
|
|
599
599
|
const emptySpan = makeSpan([], []);
|
|
600
600
|
const depthStrut = makeSpan(["vlist"], [emptySpan]);
|
|
601
|
-
depthStrut.style.height = -minPos
|
|
601
|
+
depthStrut.style.height = makeEm(-minPos);
|
|
602
602
|
|
|
603
603
|
// Safari wants the first row to have inline content; otherwise it
|
|
604
604
|
// puts the bottom of the *second* row on the baseline.
|
|
@@ -626,7 +626,7 @@ const makeGlue = (measurement: Measurement, options: Options): DomSpan => {
|
|
|
626
626
|
// Make an empty span for the space
|
|
627
627
|
const rule = makeSpan(["mspace"], [], options);
|
|
628
628
|
const size = calculateSize(measurement, options);
|
|
629
|
-
rule.style.marginRight =
|
|
629
|
+
rule.style.marginRight = makeEm(size);
|
|
630
630
|
return rule;
|
|
631
631
|
};
|
|
632
632
|
|
|
@@ -744,17 +744,17 @@ const staticSvg = function(value: string, options: Options): SvgSpan {
|
|
|
744
744
|
const [pathName, width, height] = svgData[value];
|
|
745
745
|
const path = new PathNode(pathName);
|
|
746
746
|
const svgNode = new SvgNode([path], {
|
|
747
|
-
"width": width
|
|
748
|
-
"height": height
|
|
747
|
+
"width": makeEm(width),
|
|
748
|
+
"height": makeEm(height),
|
|
749
749
|
// Override CSS rule `.katex svg { width: 100% }`
|
|
750
|
-
"style": "width:" + width
|
|
750
|
+
"style": "width:" + makeEm(width),
|
|
751
751
|
"viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
|
|
752
752
|
"preserveAspectRatio": "xMinYMin",
|
|
753
753
|
});
|
|
754
754
|
const span = makeSvgSpan(["overlay"], [svgNode], options);
|
|
755
755
|
span.height = height;
|
|
756
|
-
span.style.height = height
|
|
757
|
-
span.style.width = width
|
|
756
|
+
span.style.height = makeEm(height);
|
|
757
|
+
span.style.width = makeEm(width);
|
|
758
758
|
return span;
|
|
759
759
|
};
|
|
760
760
|
|
package/src/buildHTML.js
CHANGED
|
@@ -11,6 +11,7 @@ import Style from "./Style";
|
|
|
11
11
|
import buildCommon from "./buildCommon";
|
|
12
12
|
import {Span, Anchor} from "./domTree";
|
|
13
13
|
import utils from "./utils";
|
|
14
|
+
import {makeEm} from "./units";
|
|
14
15
|
import {spacings, tightSpacings} from "./spacingData";
|
|
15
16
|
import {_htmlGroupBuilders as groupBuilders} from "./defineFunction";
|
|
16
17
|
import {DocumentFragment} from "./tree";
|
|
@@ -299,9 +300,9 @@ function buildHTMLUnbreakable(children, options) {
|
|
|
299
300
|
// the height of the expression, and the bottom of the HTML element
|
|
300
301
|
// falls at the depth of the expression.
|
|
301
302
|
const strut = makeSpan(["strut"]);
|
|
302
|
-
strut.style.height = (body.height + body.depth)
|
|
303
|
+
strut.style.height = makeEm(body.height + body.depth);
|
|
303
304
|
if (body.depth) {
|
|
304
|
-
strut.style.verticalAlign = -body.depth
|
|
305
|
+
strut.style.verticalAlign = makeEm(-body.depth);
|
|
305
306
|
}
|
|
306
307
|
body.children.unshift(strut);
|
|
307
308
|
|
|
@@ -395,9 +396,9 @@ export default function buildHTML(tree: AnyParseNode[], options: Options): DomSp
|
|
|
395
396
|
// (the height of the enclosing htmlNode) for proper vertical alignment.
|
|
396
397
|
if (tagChild) {
|
|
397
398
|
const strut = tagChild.children[0];
|
|
398
|
-
strut.style.height = (htmlNode.height + htmlNode.depth)
|
|
399
|
+
strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
|
|
399
400
|
if (htmlNode.depth) {
|
|
400
|
-
strut.style.verticalAlign = (-htmlNode.depth)
|
|
401
|
+
strut.style.verticalAlign = makeEm(-htmlNode.depth);
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
|
package/src/delimiter.js
CHANGED
|
@@ -30,6 +30,7 @@ import buildCommon from "./buildCommon";
|
|
|
30
30
|
import {getCharacterMetrics} from "./fontMetrics";
|
|
31
31
|
import symbols from "./symbols";
|
|
32
32
|
import utils from "./utils";
|
|
33
|
+
import {makeEm} from "./units";
|
|
33
34
|
import fontMetricsData from "./fontMetricsData";
|
|
34
35
|
|
|
35
36
|
import type Options from "./Options";
|
|
@@ -93,7 +94,7 @@ const centerSpan = function(
|
|
|
93
94
|
options.fontMetrics().axisHeight;
|
|
94
95
|
|
|
95
96
|
span.classes.push("delimcenter");
|
|
96
|
-
span.style.top = shift
|
|
97
|
+
span.style.top = makeEm(shift);
|
|
97
98
|
span.height -= shift;
|
|
98
99
|
span.depth += shift;
|
|
99
100
|
};
|
|
@@ -186,21 +187,21 @@ const makeInner = function(
|
|
|
186
187
|
): VListElem {
|
|
187
188
|
// Create a span with inline SVG for the inner part of a tall stacked delimiter.
|
|
188
189
|
const width = fontMetricsData['Size4-Regular'][ch.charCodeAt(0)]
|
|
189
|
-
? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4]
|
|
190
|
-
: fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4]
|
|
190
|
+
? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4]
|
|
191
|
+
: fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4];
|
|
191
192
|
const path = new PathNode("inner", innerPath(ch, Math.round(1000 * height)));
|
|
192
193
|
const svgNode = new SvgNode([path], {
|
|
193
|
-
"width": width
|
|
194
|
-
"height": height
|
|
194
|
+
"width": makeEm(width),
|
|
195
|
+
"height": makeEm(height),
|
|
195
196
|
// Override CSS rule `.katex svg { width: 100% }`
|
|
196
|
-
"style": "width:" + width
|
|
197
|
+
"style": "width:" + makeEm(width),
|
|
197
198
|
"viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),
|
|
198
199
|
"preserveAspectRatio": "xMinYMin",
|
|
199
200
|
});
|
|
200
201
|
const span = buildCommon.makeSvgSpan([], [svgNode], options);
|
|
201
202
|
span.height = height;
|
|
202
|
-
span.style.height = height
|
|
203
|
-
span.style.width = width
|
|
203
|
+
span.style.height = makeEm(height);
|
|
204
|
+
span.style.width = makeEm(width);
|
|
204
205
|
return {type: "elem", elem: span};
|
|
205
206
|
};
|
|
206
207
|
|
|
@@ -427,7 +428,7 @@ const sqrtSvg = function(
|
|
|
427
428
|
const svg = new SvgNode([pathNode], {
|
|
428
429
|
// Note: 1000:1 ratio of viewBox to document em width.
|
|
429
430
|
"width": "400em",
|
|
430
|
-
"height": height
|
|
431
|
+
"height": makeEm(height),
|
|
431
432
|
"viewBox": "0 0 400000 " + viewBoxHeight,
|
|
432
433
|
"preserveAspectRatio": "xMinYMin slice",
|
|
433
434
|
});
|
|
@@ -514,7 +515,7 @@ const makeSqrtImage = function(
|
|
|
514
515
|
}
|
|
515
516
|
|
|
516
517
|
span.height = texHeight;
|
|
517
|
-
span.style.height = spanHeight
|
|
518
|
+
span.style.height = makeEm(spanHeight);
|
|
518
519
|
|
|
519
520
|
return {
|
|
520
521
|
span,
|
package/src/domTree.js
CHANGED
|
@@ -16,6 +16,7 @@ import utils from "./utils";
|
|
|
16
16
|
import {path} from "./svgGeometry";
|
|
17
17
|
import type Options from "./Options";
|
|
18
18
|
import {DocumentFragment} from "./tree";
|
|
19
|
+
import {makeEm} from "./units";
|
|
19
20
|
|
|
20
21
|
import type {VirtualNode} from "./tree";
|
|
21
22
|
|
|
@@ -406,7 +407,7 @@ export class SymbolNode implements HtmlDomNode {
|
|
|
406
407
|
|
|
407
408
|
if (this.italic > 0) {
|
|
408
409
|
span = document.createElement("span");
|
|
409
|
-
span.style.marginRight = this.italic
|
|
410
|
+
span.style.marginRight = makeEm(this.italic);
|
|
410
411
|
}
|
|
411
412
|
|
|
412
413
|
if (this.classes.length > 0) {
|
|
@@ -8,7 +8,7 @@ import mathMLTree from "../mathMLTree";
|
|
|
8
8
|
import ParseError from "../ParseError";
|
|
9
9
|
import {assertNodeType, assertSymbolNodeType} from "../parseNode";
|
|
10
10
|
import {checkSymbolNodeType} from "../parseNode";
|
|
11
|
-
import {calculateSize} from "../units";
|
|
11
|
+
import {calculateSize, makeEm} from "../units";
|
|
12
12
|
import utils from "../utils";
|
|
13
13
|
|
|
14
14
|
import * as html from "../buildHTML";
|
|
@@ -368,7 +368,7 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
|
|
368
368
|
if (!firstSeparator) {
|
|
369
369
|
colSep = buildCommon.makeSpan(["arraycolsep"], []);
|
|
370
370
|
colSep.style.width =
|
|
371
|
-
options.fontMetrics().doubleRuleSep
|
|
371
|
+
makeEm(options.fontMetrics().doubleRuleSep);
|
|
372
372
|
cols.push(colSep);
|
|
373
373
|
}
|
|
374
374
|
|
|
@@ -377,13 +377,13 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
|
|
377
377
|
const separator = buildCommon.makeSpan(
|
|
378
378
|
["vertical-separator"], [], options
|
|
379
379
|
);
|
|
380
|
-
separator.style.height = totalHeight
|
|
381
|
-
separator.style.borderRightWidth =
|
|
380
|
+
separator.style.height = makeEm(totalHeight);
|
|
381
|
+
separator.style.borderRightWidth = makeEm(ruleThickness);
|
|
382
382
|
separator.style.borderRightStyle = lineType;
|
|
383
|
-
separator.style.margin = `0
|
|
383
|
+
separator.style.margin = `0 ${makeEm(-ruleThickness / 2)}`;
|
|
384
384
|
const shift = totalHeight - offset;
|
|
385
385
|
if (shift) {
|
|
386
|
-
separator.style.verticalAlign = -shift
|
|
386
|
+
separator.style.verticalAlign = makeEm(-shift);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
cols.push(separator);
|
|
@@ -406,7 +406,7 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
|
|
406
406
|
sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
|
|
407
407
|
if (sepwidth !== 0) {
|
|
408
408
|
colSep = buildCommon.makeSpan(["arraycolsep"], []);
|
|
409
|
-
colSep.style.width = sepwidth
|
|
409
|
+
colSep.style.width = makeEm(sepwidth);
|
|
410
410
|
cols.push(colSep);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
@@ -437,7 +437,7 @@ const htmlBuilder: HtmlBuilder<"array"> = function(group, options) {
|
|
|
437
437
|
sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
|
|
438
438
|
if (sepwidth !== 0) {
|
|
439
439
|
colSep = buildCommon.makeSpan(["arraycolsep"], []);
|
|
440
|
-
colSep.style.width = sepwidth
|
|
440
|
+
colSep.style.width = makeEm(sepwidth);
|
|
441
441
|
cols.push(colSep);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
@@ -523,7 +523,7 @@ const mathmlBuilder: MathMLBuilder<"array"> = function(group, options) {
|
|
|
523
523
|
const gap = (group.arraystretch === 0.5)
|
|
524
524
|
? 0.1 // {smallmatrix}, {subarray}
|
|
525
525
|
: 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
|
|
526
|
-
table.setAttribute("rowspacing", gap
|
|
526
|
+
table.setAttribute("rowspacing", makeEm(gap));
|
|
527
527
|
|
|
528
528
|
// MathML table lines go only between cells.
|
|
529
529
|
// To place a line on an edge we'll use <menclose>, if necessary.
|
package/src/environments/cd.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as html from "../buildHTML";
|
|
|
6
6
|
import * as mml from "../buildMathML";
|
|
7
7
|
import {assertSymbolNodeType} from "../parseNode";
|
|
8
8
|
import ParseError from "../ParseError";
|
|
9
|
+
import {makeEm} from "../units";
|
|
9
10
|
|
|
10
11
|
import type Parser from "../Parser";
|
|
11
12
|
import type {ParseNode, AnyParseNode} from "../parseNode";
|
|
@@ -257,7 +258,7 @@ defineFunction({
|
|
|
257
258
|
const label = buildCommon.wrapFragment(
|
|
258
259
|
html.buildGroup(group.label, newOptions, options), options);
|
|
259
260
|
label.classes.push("cd-label-" + group.side);
|
|
260
|
-
label.style.bottom = (0.8 - label.depth)
|
|
261
|
+
label.style.bottom = makeEm(0.8 - label.depth);
|
|
261
262
|
// Zero out label height & depth, so vertical align of arrow is set
|
|
262
263
|
// by the arrow height, not by the label.
|
|
263
264
|
label.height = 0;
|
package/src/fontMetricsData.js
CHANGED
|
@@ -582,6 +582,7 @@ export default {
|
|
|
582
582
|
"8764": [-0.10889, 0.39111, 0, 0, 0.89444],
|
|
583
583
|
"8768": [0.19444, 0.69444, 0, 0, 0.31944],
|
|
584
584
|
"8771": [0.00222, 0.50222, 0, 0, 0.89444],
|
|
585
|
+
"8773": [0.027, 0.638, 0, 0, 0.894],
|
|
585
586
|
"8776": [0.02444, 0.52444, 0, 0, 0.89444],
|
|
586
587
|
"8781": [0.00222, 0.50222, 0, 0, 0.89444],
|
|
587
588
|
"8801": [0.00222, 0.50222, 0, 0, 0.89444],
|
|
@@ -1099,7 +1100,7 @@ export default {
|
|
|
1099
1100
|
"8764": [-0.13313, 0.36687, 0, 0, 0.77778],
|
|
1100
1101
|
"8768": [0.19444, 0.69444, 0, 0, 0.27778],
|
|
1101
1102
|
"8771": [-0.03625, 0.46375, 0, 0, 0.77778],
|
|
1102
|
-
"8773": [-0.022, 0.589, 0, 0,
|
|
1103
|
+
"8773": [-0.022, 0.589, 0, 0, 0.778],
|
|
1103
1104
|
"8776": [-0.01688, 0.48312, 0, 0, 0.77778],
|
|
1104
1105
|
"8781": [-0.03625, 0.46375, 0, 0, 0.77778],
|
|
1105
1106
|
"8784": [-0.133, 0.673, 0, 0, 0.778],
|
|
@@ -15,13 +15,12 @@ if len(sys.argv) < 2:
|
|
|
15
15
|
font_file = sys.argv[1]
|
|
16
16
|
font_name = os.path.splitext(os.path.basename(font_file))[0]
|
|
17
17
|
|
|
18
|
-
# now or SOURCE_DATE_EPOCH, if present
|
|
19
|
-
timestamp = timestampNow()
|
|
20
18
|
|
|
21
19
|
font = TTFont(font_file, recalcBBoxes=False, recalcTimestamp=False)
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
font['head'].
|
|
21
|
+
# fix timestamp to the epoch
|
|
22
|
+
font['head'].created = 0
|
|
23
|
+
font['head'].modified = 0
|
|
25
24
|
|
|
26
25
|
# remove fontforge timestamps
|
|
27
26
|
if 'FFTM' in font:
|
|
@@ -36,8 +35,6 @@ if 'GDEF' in font:
|
|
|
36
35
|
font['name'].names = [record for record in font['name'].names if record.platformID != 1]
|
|
37
36
|
font['cmap'].tables = [table for table in font['cmap'].tables if table.platformID != 1]
|
|
38
37
|
|
|
39
|
-
font['name'].setName('Version ' + str(timestamp), 5, 3, 1, 1033)
|
|
40
|
-
|
|
41
38
|
# fix OS/2 and hhea metrics
|
|
42
39
|
glyf = font['glyf']
|
|
43
40
|
ascent = int(max(glyf[c].yMax for c in font.getGlyphOrder() if hasattr(glyf[c], "yMax")))
|
package/src/fonts/makeFF
CHANGED
|
@@ -1311,6 +1311,7 @@ $extra{'Main-Regular'} = {
|
|
|
1311
1311
|
'Select(0u3D)','Copy()',
|
|
1312
1312
|
'Select(0u2245)',
|
|
1313
1313
|
'PasteWithOffset(0,-111)',
|
|
1314
|
+
'SetWidth(778)',
|
|
1314
1315
|
],
|
|
1315
1316
|
|
|
1316
1317
|
bowtie => [
|
|
@@ -1607,6 +1608,7 @@ $extra{'Main-Bold'} = {
|
|
|
1607
1608
|
'Select(0u3D)','Copy()',
|
|
1608
1609
|
'Select(0u2245)',
|
|
1609
1610
|
'PasteWithOffset(0,-136)',
|
|
1611
|
+
'SetWidth(894)',
|
|
1610
1612
|
],
|
|
1611
1613
|
|
|
1612
1614
|
bowtie => [
|
package/src/functions/accent.js
CHANGED
|
@@ -6,6 +6,7 @@ import utils from "../utils";
|
|
|
6
6
|
import stretchy from "../stretchy";
|
|
7
7
|
import {assertNodeType} from "../parseNode";
|
|
8
8
|
import {assertSpan, assertSymbolDomNode} from "../domTree";
|
|
9
|
+
import {makeEm} from "../units";
|
|
9
10
|
|
|
10
11
|
import * as html from "../buildHTML";
|
|
11
12
|
import * as mml from "../buildMathML";
|
|
@@ -131,7 +132,7 @@ export const htmlBuilder: HtmlBuilderSupSub<"accent"> = (grp, options) => {
|
|
|
131
132
|
left -= width / 2;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
accentBody.style.left = left
|
|
135
|
+
accentBody.style.left = makeEm(left);
|
|
135
136
|
|
|
136
137
|
// \textcircled uses the \bigcirc glyph, so it needs some
|
|
137
138
|
// vertical adjustment to match LaTeX.
|
|
@@ -161,8 +162,8 @@ export const htmlBuilder: HtmlBuilderSupSub<"accent"> = (grp, options) => {
|
|
|
161
162
|
wrapperClasses: ["svg-align"],
|
|
162
163
|
wrapperStyle: skew > 0
|
|
163
164
|
? {
|
|
164
|
-
width: `calc(100% - ${2 * skew}
|
|
165
|
-
marginLeft:
|
|
165
|
+
width: `calc(100% - ${makeEm(2 * skew)})`,
|
|
166
|
+
marginLeft: makeEm(2 * skew),
|
|
166
167
|
}
|
|
167
168
|
: undefined,
|
|
168
169
|
},
|
package/src/functions/cr.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import defineFunction from "../defineFunction";
|
|
5
5
|
import buildCommon from "../buildCommon";
|
|
6
6
|
import mathMLTree from "../mathMLTree";
|
|
7
|
-
import {calculateSize} from "../units";
|
|
7
|
+
import {calculateSize, makeEm} from "../units";
|
|
8
8
|
import {assertNodeType} from "../parseNode";
|
|
9
9
|
|
|
10
10
|
// \DeclareRobustCommand\\{...\@xnewline}
|
|
@@ -41,7 +41,7 @@ defineFunction({
|
|
|
41
41
|
span.classes.push("newline");
|
|
42
42
|
if (group.size) {
|
|
43
43
|
span.style.marginTop =
|
|
44
|
-
calculateSize(group.size, options)
|
|
44
|
+
makeEm(calculateSize(group.size, options));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return span;
|
|
@@ -53,7 +53,7 @@ defineFunction({
|
|
|
53
53
|
node.setAttribute("linebreak", "newline");
|
|
54
54
|
if (group.size) {
|
|
55
55
|
node.setAttribute("height",
|
|
56
|
-
calculateSize(group.size, options)
|
|
56
|
+
makeEm(calculateSize(group.size, options)));
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return node;
|
|
@@ -6,6 +6,7 @@ import mathMLTree from "../mathMLTree";
|
|
|
6
6
|
import ParseError from "../ParseError";
|
|
7
7
|
import utils from "../utils";
|
|
8
8
|
import {assertNodeType, checkSymbolNodeType} from "../parseNode";
|
|
9
|
+
import {makeEm} from "../units";
|
|
9
10
|
|
|
10
11
|
import * as html from "../buildHTML";
|
|
11
12
|
import * as mml from "../buildMathML";
|
|
@@ -126,8 +127,9 @@ defineFunction({
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
node.setAttribute("stretchy", "true");
|
|
129
|
-
|
|
130
|
-
node.setAttribute("
|
|
130
|
+
const size = makeEm(delimiter.sizeToMaxHeight[group.size]);
|
|
131
|
+
node.setAttribute("minsize", size);
|
|
132
|
+
node.setAttribute("maxsize", size);
|
|
131
133
|
|
|
132
134
|
return node;
|
|
133
135
|
},
|
package/src/functions/enclose.js
CHANGED
|
@@ -6,7 +6,7 @@ import utils from "../utils";
|
|
|
6
6
|
import stretchy from "../stretchy";
|
|
7
7
|
import {phasePath} from "../svgGeometry";
|
|
8
8
|
import {PathNode, SvgNode} from "../domTree";
|
|
9
|
-
import {calculateSize} from "../units";
|
|
9
|
+
import {calculateSize, makeEm} from "../units";
|
|
10
10
|
import {assertNodeType} from "../parseNode";
|
|
11
11
|
|
|
12
12
|
import * as html from "../buildHTML";
|
|
@@ -48,20 +48,20 @@ const htmlBuilder = (group, options) => {
|
|
|
48
48
|
|
|
49
49
|
const angleHeight = inner.height + inner.depth + lineWeight + clearance;
|
|
50
50
|
// Reserve a left pad for the angle.
|
|
51
|
-
inner.style.paddingLeft = (angleHeight / 2 + lineWeight)
|
|
51
|
+
inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight);
|
|
52
52
|
|
|
53
53
|
// Create an SVG
|
|
54
54
|
const viewBoxHeight = Math.floor(1000 * angleHeight * scale);
|
|
55
55
|
const path = phasePath(viewBoxHeight);
|
|
56
56
|
const svgNode = new SvgNode([new PathNode("phase", path)], {
|
|
57
57
|
"width": "400em",
|
|
58
|
-
"height":
|
|
58
|
+
"height": makeEm(viewBoxHeight / 1000),
|
|
59
59
|
"viewBox": `0 0 400000 ${viewBoxHeight}`,
|
|
60
60
|
"preserveAspectRatio": "xMinYMin slice",
|
|
61
61
|
});
|
|
62
62
|
// Wrap it in a span with overflow: hidden.
|
|
63
63
|
img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options);
|
|
64
|
-
img.style.height = angleHeight
|
|
64
|
+
img.style.height = makeEm(angleHeight);
|
|
65
65
|
imgShift = inner.depth + lineWeight + clearance;
|
|
66
66
|
|
|
67
67
|
} else {
|
|
@@ -104,10 +104,10 @@ const htmlBuilder = (group, options) => {
|
|
|
104
104
|
img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options);
|
|
105
105
|
if (/fbox|boxed|fcolorbox/.test(label)) {
|
|
106
106
|
img.style.borderStyle = "solid";
|
|
107
|
-
img.style.borderWidth =
|
|
107
|
+
img.style.borderWidth = makeEm(ruleThickness);
|
|
108
108
|
} else if (label === "angl" && ruleThickness !== 0.049) {
|
|
109
|
-
img.style.borderTopWidth =
|
|
110
|
-
img.style.borderRightWidth =
|
|
109
|
+
img.style.borderTopWidth = makeEm(ruleThickness);
|
|
110
|
+
img.style.borderRightWidth = makeEm(ruleThickness);
|
|
111
111
|
}
|
|
112
112
|
imgShift = inner.depth + bottomPad;
|
|
113
113
|
|
package/src/functions/genfrac.js
CHANGED
|
@@ -9,7 +9,7 @@ import {assert} from "../utils";
|
|
|
9
9
|
|
|
10
10
|
import * as html from "../buildHTML";
|
|
11
11
|
import * as mml from "../buildMathML";
|
|
12
|
-
import {calculateSize} from "../units";
|
|
12
|
+
import {calculateSize, makeEm} from "../units";
|
|
13
13
|
|
|
14
14
|
const adjustStyle = (size, originalStyle) => {
|
|
15
15
|
// Figure out what style this fraction should be in based on the
|
|
@@ -196,7 +196,7 @@ const mathmlBuilder = (group, options) => {
|
|
|
196
196
|
node.setAttribute("linethickness", "0px");
|
|
197
197
|
} else if (group.barSize) {
|
|
198
198
|
const ruleWidth = calculateSize(group.barSize, options);
|
|
199
|
-
node.setAttribute("linethickness", ruleWidth
|
|
199
|
+
node.setAttribute("linethickness", makeEm(ruleWidth));
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
const style = adjustStyle(group.size, options.style);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import defineFunction from "../defineFunction";
|
|
3
3
|
import type {Measurement} from "../units";
|
|
4
|
-
import {calculateSize, validUnit} from "../units";
|
|
4
|
+
import {calculateSize, validUnit, makeEm} from "../units";
|
|
5
5
|
import ParseError from "../ParseError";
|
|
6
6
|
import {Img} from "../domTree";
|
|
7
7
|
import mathMLTree from "../mathMLTree";
|
|
@@ -108,7 +108,6 @@ defineFunction({
|
|
|
108
108
|
|
|
109
109
|
if (group.totalheight.number > 0) {
|
|
110
110
|
depth = calculateSize(group.totalheight, options) - height;
|
|
111
|
-
depth = Number(depth.toFixed(2));
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
let width = 0;
|
|
@@ -116,12 +115,12 @@ defineFunction({
|
|
|
116
115
|
width = calculateSize(group.width, options);
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
const style: CssStyle = {height: height + depth
|
|
118
|
+
const style: CssStyle = {height: makeEm(height + depth)};
|
|
120
119
|
if (width > 0) {
|
|
121
|
-
style.width = width
|
|
120
|
+
style.width = makeEm(width);
|
|
122
121
|
}
|
|
123
122
|
if (depth > 0) {
|
|
124
|
-
style.verticalAlign = -depth
|
|
123
|
+
style.verticalAlign = makeEm(-depth);
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
const node = new Img(group.src, group.alt, style);
|
|
@@ -138,14 +137,13 @@ defineFunction({
|
|
|
138
137
|
let depth = 0;
|
|
139
138
|
if (group.totalheight.number > 0) {
|
|
140
139
|
depth = calculateSize(group.totalheight, options) - height;
|
|
141
|
-
|
|
142
|
-
node.setAttribute("valign", "-" + depth + "em");
|
|
140
|
+
node.setAttribute("valign", makeEm(-depth));
|
|
143
141
|
}
|
|
144
|
-
node.setAttribute("height", height + depth
|
|
142
|
+
node.setAttribute("height", makeEm(height + depth));
|
|
145
143
|
|
|
146
144
|
if (group.width.number > 0) {
|
|
147
145
|
const width = calculateSize(group.width, options);
|
|
148
|
-
node.setAttribute("width", width
|
|
146
|
+
node.setAttribute("width", makeEm(width));
|
|
149
147
|
}
|
|
150
148
|
node.setAttribute("src", group.src);
|
|
151
149
|
return node;
|
package/src/functions/lap.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import defineFunction from "../defineFunction";
|
|
4
4
|
import buildCommon from "../buildCommon";
|
|
5
5
|
import mathMLTree from "../mathMLTree";
|
|
6
|
+
import {makeEm} from "../units";
|
|
6
7
|
|
|
7
8
|
import * as html from "../buildHTML";
|
|
8
9
|
import * as mml from "../buildMathML";
|
|
@@ -46,9 +47,9 @@ defineFunction({
|
|
|
46
47
|
// Otherwise, a tall argument may be misplaced.
|
|
47
48
|
// This code resolved issue #1153
|
|
48
49
|
const strut = buildCommon.makeSpan(["strut"]);
|
|
49
|
-
strut.style.height = (node.height + node.depth)
|
|
50
|
+
strut.style.height = makeEm(node.height + node.depth);
|
|
50
51
|
if (node.depth) {
|
|
51
|
-
strut.style.verticalAlign = -node.depth
|
|
52
|
+
strut.style.verticalAlign = makeEm(-node.depth);
|
|
52
53
|
}
|
|
53
54
|
node.children.unshift(strut);
|
|
54
55
|
|
package/src/functions/op.js
CHANGED
|
@@ -8,6 +8,7 @@ import utils from "../utils";
|
|
|
8
8
|
import Style from "../Style";
|
|
9
9
|
import {assembleSupSub} from "./utils/assembleSupSub";
|
|
10
10
|
import {assertNodeType} from "../parseNode";
|
|
11
|
+
import {makeEm} from "../units";
|
|
11
12
|
|
|
12
13
|
import * as html from "../buildHTML";
|
|
13
14
|
import * as mml from "../buildMathML";
|
|
@@ -132,7 +133,7 @@ export const htmlBuilder: HtmlBuilderSupSub<"op"> = (grp, options) => {
|
|
|
132
133
|
} else {
|
|
133
134
|
if (baseShift) {
|
|
134
135
|
base.style.position = "relative";
|
|
135
|
-
base.style.top = baseShift
|
|
136
|
+
base.style.top = makeEm(baseShift);
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
return base;
|