Skip to content

Commit 7bf5e1b

Browse files
authored
Merge pull request #1168 from mathjax/woff2
Move to scoped packages for fonts, and use woff2 format
2 parents 2e5c45b + 0a0e944 commit 7bf5e1b

11 files changed

Lines changed: 42 additions & 42 deletions

File tree

components/bin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"#menu/*": "mj-context-menu/cjs/*",
88
"#sre/*": "speech-rule-engine/cjs/*",
99
"#mhchem/*": "mhchemparser/dist/*",
10-
"#default-font/*": "mathjax-newcm-font/cjs/*"
10+
"#default-font/*": "@mathjax/mathjax-newcm-font/cjs/*"
1111
}
1212
}

components/mjs/input/tex/extension.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export function fontExtension(id, name, pkg = `@mathjax/${name}`) {
55
if (MathJax.loader) {
66
const FONTPATH = hasWindow ? `https://cdn.jsdelivr.net/npm/${name}` : pkg;
77
const path = name.replace(/-font-extension$/, '-extension');
8-
const extension = name.replace(/-font-extension$/, '');
98
const jax = (MathJax.config?.startup?.output || 'chtml');
109
combineDefaults(MathJax.config.loader, 'paths', {[path]: FONTPATH});
1110
combineDefaults(MathJax.config.loader, 'dependencies', {[`[${path}]/${jax}`]: [`output/${jax}`]});

components/mjs/output/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {Package} from '#js/components/package.js';
33
import {hasWindow} from '#js/util/context.js';
44

55
export const FONTPATH = hasWindow ?
6-
'https://cdn.jsdelivr.net/npm/%%FONT%%-font':
6+
'https://cdn.jsdelivr.net/npm/@mathjax/%%FONT%%-font':
77
'@mathjax/%%FONT%%-font';
88

99
export const OutputUtil = {
@@ -64,7 +64,7 @@ export const OutputUtil = {
6464
});
6565
if (jax === 'chtml') {
6666
combineDefaults(MathJax.config, jax, {
67-
fontURL: Package.resolvePath(`${font}/${jax}/woff`, false),
67+
fontURL: Package.resolvePath(`${font}/${jax}/woff2`, false),
6868
});
6969
}
7070

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"#menu/*": "mj-context-menu/js/*",
5353
"#sre/*": "speech-rule-engine/js/*",
5454
"#mhchem/*": "mhchemparser/esm/*",
55-
"#default-font/*": "mathjax-newcm-font/mjs/*"
55+
"#default-font/*": "@mathjax/mathjax-newcm-font/mjs/*"
5656
},
5757
"files": [
5858
"/bundle",
@@ -154,8 +154,8 @@
154154
]
155155
},
156156
"dependencies": {
157+
"@mathjax/mathjax-newcm-font": "0.4.0-beta.8",
157158
"@xmldom/xmldom": "^0.8.10",
158-
"mathjax-newcm-font": "^4.0.0-beta.7",
159159
"mhchemparser": "^4.2.1",
160160
"mj-context-menu": "^0.9.1",
161161
"speech-rule-engine": "^4.1.0-beta.11",

pnpm-lock.yaml

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testsuite/tests/input/tex/Bussproofs.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ describe('BussproofsRegProofs', () => {
20362036
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{prooftree}\\AXC{}\\RL{$Hyp^{1}$}\\UIC{$P$}\\AXC{$P\\rightarrow Q$}\\RL{$\\rightarrow_E$}\\solidLine\\BIC{$Q^2$}\\AXC{$Q\\rightarrow R$} \\RL{$\\rightarrow_E$} \\BIC{$R$} \\AXC{$Q$}\\RL{Rit$^2$} \\UIC{$Q$}\\RL{$\\wedge_I$}\\BIC{$Q\\wedge R$}\\RL{\${\\rightarrow_I}^1$}\\UIC{$P\\rightarrow Q\\wedge R$}\\end{prooftree}" display="block">
20372037
<mrow semantics="bspr_inference:1;bspr_proof:true;bspr_labelledRule:right">
20382038
<mrow>
2039-
<mspace width="13.248em"></mspace>
2039+
<mspace width="13.25em"></mspace>
20402040
<mrow data-latex="\\begin{prooftree}\\AXC{}\\RL{$Hyp^{1}$}\\UIC{$P$}\\AXC{$P\\rightarrow Q$}\\RL{$\\rightarrow_E$}\\solidLine\\BIC{$Q^2$}\\AXC{$Q\\rightarrow R$} \\RL{$\\rightarrow_E$} \\BIC{$R$} \\AXC{$Q$}\\RL{Rit$^2$} \\UIC{$Q$}\\RL{$\\wedge_I$}\\BIC{$Q\\wedge R$}\\RL{\${\\rightarrow_I}^1$}\\UIC{$P\\rightarrow Q\\wedge R$}\\end{prooftree}" data-latex-item="{prooftree}">
20412041
<mspace width="-1.155em"></mspace>
20422042
<mtable align="top 2" rowlines="solid" framespacing="0 0" semantics="bspr_inferenceRule:down">
@@ -2047,9 +2047,9 @@ describe('BussproofsRegProofs', () => {
20472047
<mtd rowalign="bottom">
20482048
<mrow semantics="bspr_inference:2;bspr_labelledRule:right">
20492049
<mrow>
2050-
<mspace width="-13.248em"></mspace>
2050+
<mspace width="-13.25em"></mspace>
20512051
<mrow>
2052-
<mspace width="9.11em"></mspace>
2052+
<mspace width="9.111em"></mspace>
20532053
<mrow data-latex="\\RL{\${\\rightarrow_I}^1$}">
20542054
<mtable align="top 2" rowlines="solid" framespacing="0 0" semantics="bspr_inferenceRule:down">
20552055
<mtr>
@@ -2058,7 +2058,7 @@ describe('BussproofsRegProofs', () => {
20582058
<mtr>
20592059
<mtd rowalign="bottom">
20602060
<mrow semantics="bspr_inference:2;bspr_labelledRule:right">
2061-
<mspace width="-9.11em"></mspace>
2061+
<mspace width="-9.111em"></mspace>
20622062
<mrow>
20632063
<mspace width="3.592em"></mspace>
20642064
<mrow data-latex="\\BIC{$R$}">
@@ -2276,7 +2276,7 @@ describe('BussproofsRegProofs', () => {
22762276
</mrow>
22772277
</mrow>
22782278
</mrow>
2279-
<mspace width="-5.455em"></mspace>
2279+
<mspace width="-5.456em"></mspace>
22802280
</mrow>
22812281
</mtd>
22822282
</mtr>
@@ -2316,7 +2316,7 @@ describe('BussproofsRegProofs', () => {
23162316
</mpadded>
23172317
</mrow>
23182318
</mrow>
2319-
<mspace width="2.952em"></mspace>
2319+
<mspace width="2.953em"></mspace>
23202320
</mrow>
23212321
</math>`
23222322
));
@@ -2328,7 +2328,7 @@ describe('BussproofsRegProofs', () => {
23282328
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{prooftree}\\alwaysRootAtTop\\AXC{}\\RL{$Hyp^{1}$}\\UIC{$P$}\\AXC{$P\\rightarrow Q$}\\RL{$\\rightarrow_E$}\\solidLine\\BIC{$Q^2$}\\alwaysRootAtBottom\\AXC{$Q\\rightarrow R$} \\RL{$\\rightarrow_E$} \\BIC{$R$} \\AXC{$Q$}\\RL{Rit$^2$} \\UIC{$Q$}\\RL{$\\wedge_I$}\\BIC{$Q\\wedge R$}\\RL{\${\\rightarrow_I}^1$}\\UIC{$P\\rightarrow Q\\wedge R$}\\end{prooftree}" display="block">
23292329
<mrow semantics="bspr_inference:1;bspr_proof:true;bspr_labelledRule:right">
23302330
<mrow>
2331-
<mspace width="13.248em"></mspace>
2331+
<mspace width="13.25em"></mspace>
23322332
<mrow data-latex="\\begin{prooftree}\\alwaysRootAtTop\\AXC{}\\RL{$Hyp^{1}$}\\UIC{$P$}\\AXC{$P\\rightarrow Q$}\\RL{$\\rightarrow_E$}\\solidLine\\BIC{$Q^2$}\\alwaysRootAtBottom\\AXC{$Q\\rightarrow R$} \\RL{$\\rightarrow_E$} \\BIC{$R$} \\AXC{$Q$}\\RL{Rit$^2$} \\UIC{$Q$}\\RL{$\\wedge_I$}\\BIC{$Q\\wedge R$}\\RL{\${\\rightarrow_I}^1$}\\UIC{$P\\rightarrow Q\\wedge R$}\\end{prooftree}" data-latex-item="{prooftree}">
23332333
<mspace width="-1.155em"></mspace>
23342334
<mtable align="top 2" rowlines="solid" framespacing="0 0" semantics="bspr_inferenceRule:down">
@@ -2339,9 +2339,9 @@ describe('BussproofsRegProofs', () => {
23392339
<mtd rowalign="bottom">
23402340
<mrow semantics="bspr_inference:2;bspr_labelledRule:right">
23412341
<mrow>
2342-
<mspace width="-13.248em"></mspace>
2342+
<mspace width="-13.25em"></mspace>
23432343
<mrow>
2344-
<mspace width="9.11em"></mspace>
2344+
<mspace width="9.111em"></mspace>
23452345
<mrow data-latex="\\RL{\${\\rightarrow_I}^1$}">
23462346
<mtable align="top 2" rowlines="solid" framespacing="0 0" semantics="bspr_inferenceRule:down">
23472347
<mtr>
@@ -2350,7 +2350,7 @@ describe('BussproofsRegProofs', () => {
23502350
<mtr>
23512351
<mtd rowalign="bottom">
23522352
<mrow semantics="bspr_inference:2;bspr_labelledRule:right">
2353-
<mspace width="-9.11em"></mspace>
2353+
<mspace width="-9.111em"></mspace>
23542354
<mrow>
23552355
<mspace width="3.592em"></mspace>
23562356
<mrow data-latex="\\BIC{$R$}">
@@ -2568,7 +2568,7 @@ describe('BussproofsRegProofs', () => {
25682568
</mrow>
25692569
</mrow>
25702570
</mrow>
2571-
<mspace width="-5.455em"></mspace>
2571+
<mspace width="-5.456em"></mspace>
25722572
</mrow>
25732573
</mtd>
25742574
</mtr>
@@ -2608,7 +2608,7 @@ describe('BussproofsRegProofs', () => {
26082608
</mpadded>
26092609
</mrow>
26102610
</mrow>
2611-
<mspace width="2.952em"></mspace>
2611+
<mspace width="2.953em"></mspace>
26122612
</mrow>
26132613
</math>`
26142614
));

ts/output/chtml/FontData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ export class ChtmlFontData extends FontData<
9595
*/
9696
public static OPTIONS = {
9797
...FontData.OPTIONS,
98-
dynamicPrefix: './output/chtml/fonts',
99-
fontURL: 'js/output/chtml/fonts/woff',
98+
dynamicPrefix: './chtml/dynamic',
99+
fontURL: './chtml/woff2',
100100
};
101101

102102
/**
@@ -186,7 +186,7 @@ export class ChtmlFontData extends FontData<
186186
const name = font.slice(4);
187187
fontStyles[`@font-face /* ${name} */`] = {
188188
'font-family': font,
189-
src: `url("%%URL%%/${font.toLowerCase()}.woff") format("woff")`,
189+
src: `url("%%URL%%/${font.toLowerCase()}.woff2") format("woff2")`,
190190
};
191191
styles[`.${name}`] = {
192192
'font-family': `${this.defaultCssFamilyPrefix}, ${font}`,

ts/output/common/FontData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ export class FontData<
382382
/* prettier-ignore */
383383
public static OPTIONS: OptionList = {
384384
unknownFamily: 'serif', // Should use 'monospace' with LiteAdaptor
385-
dynamicPrefix: '.' // Location of dynamically loaded files
385+
dynamicPrefix: '.', // Location of dynamically loaded files
386386
};
387387

388388
/**

ts/output/svg/FontData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
FontExtensionData,
3232
mergeOptions,
3333
} from '../common/FontData.js';
34+
3435
export * from '../common/FontData.js';
3536

3637
export type CharStringMap = { [name: number]: string };
@@ -86,7 +87,7 @@ export class SvgFontData extends FontData<
8687
*/
8788
public static OPTIONS = {
8889
...FontData.OPTIONS,
89-
dynamicPrefix: './output/svg/fonts',
90+
dynamicPrefix: './svg/dynamic',
9091
};
9192

9293
/**

tsconfig/cjs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"#menu/*": ["../node_modules/mj-context-menu/cjs/*"],
1212
"#sre/*": ["../node_modules/speech-rule-engine/cjs/*"],
1313
"#mhchem/*": ["../node_modules/mhchemparser/dist/*"],
14-
"#default-font/*": ["../node_modules/mathjax-modern-font/cjs/*"]
14+
"#default-font/*": ["../node_modules/@mathjax/mathjax-newcm-font/cjs/*"]
1515
}
1616
},
1717
"exclude": [

0 commit comments

Comments
 (0)