Skip to content
Merged
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
8 changes: 0 additions & 8 deletions components/mjs/output/chtml/nofont.js

This file was deleted.

6 changes: 0 additions & 6 deletions components/mjs/output/svg/nofont.js

This file was deleted.

5 changes: 2 additions & 3 deletions components/mjs/output/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {hasWindow} from '#js/util/context.js';
export const FONTPATH = hasWindow ?
'https://cdn.jsdelivr.net/npm/@mathjax/%%FONT%%-font':
'@mathjax/%%FONT%%-font';

export const OutputUtil = {
config(jax, jaxClass, defaultFont, fontClass) {

Expand All @@ -14,7 +13,7 @@ export const OutputUtil = {
combineDefaults(MathJax.config, jax, MathJax.config.output || {});

let config = MathJax.config[jax];
let font = config.font || defaultFont;
let font = config.font || config.fontData || defaultFont;
if (typeof(font) !== 'string') {
config.fontData = font;
config.font = font = font.NAME;
Expand All @@ -30,7 +29,7 @@ export const OutputUtil = {
}
const name = font.substring(1, font.length - 1);

if (name !== defaultFont) {
if (name !== defaultFont || !fontClass) {

MathJax.loader.addPackageData(`output/${jax}`, {extraLoads: [`${font}/${jax}`]});

Expand Down
6 changes: 2 additions & 4 deletions components/webpack.common.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ const PLUGINS = function (js, dir, target, font, jax, name) {
// Replace default font with the no-font file
//
if (!font) {
const jax = (name.match(/chtml|svg/) || ['chtml'])[0];
const nofont = path.resolve(DIRNAME, target, 'output', jax, 'nofont.js');
plugins.push(
new webpack.NormalModuleReplacementPlugin(
/DefaultFont.js/,
/-font\/.*?\/default\.js/,
function (resource) {
resource.request = path.relative(resource.context, nofont).replace(/^([^.])/, './$1');
resource.request = resource.request.replace(/\/.*?\/default\.js/, '/nofont.js');
}
)
);
Expand Down