Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to scoped packages for fonts, and use woff2 format #1168

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/bin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"#menu/*": "mj-context-menu/cjs/*",
"#sre/*": "speech-rule-engine/cjs/*",
"#mhchem/*": "mhchemparser/dist/*",
"#default-font/*": "mathjax-newcm-font/cjs/*"
"#default-font/*": "@mathjax/mathjax-newcm-font/cjs/*"
}
}
2 changes: 1 addition & 1 deletion components/mjs/output/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const OutputUtil = {
});
if (jax === 'chtml') {
combineDefaults(MathJax.config, jax, {
fontURL: Package.resolvePath(`${font}/${jax}/woff`, false),
fontURL: Package.resolvePath(`${font}/${jax}/woff2`, false),
});
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"#menu/*": "mj-context-menu/js/*",
"#sre/*": "speech-rule-engine/js/*",
"#mhchem/*": "mhchemparser/esm/*",
"#default-font/*": "mathjax-newcm-font/mjs/*"
"#default-font/*": "@mathjax/mathjax-newcm-font/mjs/*"
},
"files": [
"/bundle",
Expand Down Expand Up @@ -154,8 +154,8 @@
]
},
"dependencies": {
"@mathjax/mathjax-newcm-font": "0.4.0-beta.8",
"@xmldom/xmldom": "^0.8.10",
"mathjax-newcm-font": "^4.0.0-beta.7",
"mhchemparser": "^4.2.1",
"mj-context-menu": "^0.9.1",
"speech-rule-engine": "^4.1.0-beta.11",
Expand Down
34 changes: 17 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ts/output/chtml/FontData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export class ChtmlFontData extends FontData<
*/
public static OPTIONS = {
...FontData.OPTIONS,
dynamicPrefix: './output/chtml/fonts',
fontURL: 'js/output/chtml/fonts/woff',
dynamicPrefix: './chtml/dynamic',
fontURL: './chtml/woff2',
};

/**
Expand Down Expand Up @@ -186,7 +186,7 @@ export class ChtmlFontData extends FontData<
const name = font.slice(4);
fontStyles[`@font-face /* ${name} */`] = {
'font-family': font,
src: `url("%%URL%%/${font.toLowerCase()}.woff") format("woff")`,
src: `url("%%URL%%/${font.toLowerCase()}.woff2") format("woff2")`,
};
styles[`.${name}`] = {
'font-family': `${this.defaultCssFamilyPrefix}, ${font}`,
Expand Down
2 changes: 1 addition & 1 deletion ts/output/common/FontData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export class FontData<
/* prettier-ignore */
public static OPTIONS: OptionList = {
unknownFamily: 'serif', // Should use 'monospace' with LiteAdaptor
dynamicPrefix: '.' // Location of dynamically loaded files
dynamicPrefix: '.', // Location of dynamically loaded files
};

/**
Expand Down
3 changes: 2 additions & 1 deletion ts/output/svg/FontData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
FontExtensionData,
mergeOptions,
} from '../common/FontData.js';

export * from '../common/FontData.js';

export type CharStringMap = { [name: number]: string };
Expand Down Expand Up @@ -86,7 +87,7 @@ export class SvgFontData extends FontData<
*/
public static OPTIONS = {
...FontData.OPTIONS,
dynamicPrefix: './output/svg/fonts',
dynamicPrefix: './svg/dynamic',
};

/**
Expand Down
2 changes: 1 addition & 1 deletion tsconfig/cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"#menu/*": ["../node_modules/mj-context-menu/cjs/*"],
"#sre/*": ["../node_modules/speech-rule-engine/cjs/*"],
"#mhchem/*": ["../node_modules/mhchemparser/dist/*"],
"#default-font/*": ["../node_modules/mathjax-modern-font/cjs/*"]
"#default-font/*": ["../node_modules/@mathjax/mathjax-newcm-font/cjs/*"]
}
},
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion tsconfig/mjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"#menu/*": ["../node_modules/mj-context-menu/js/*"],
"#sre/*": ["../node_modules/speech-rule-engine/js/*"],
"#mhchem/*": ["../node_modules/mhchemparser/esm/*"],
"#default-font/*": ["../node_modules/mathjax-modern-font/mjs/*"]
"#default-font/*": ["../node_modules/@mathjax/mathjax-newcm-font/mjs/*"]
}
},
"exclude": ["../ts/**/cjs/*"]
Expand Down