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
14 changes: 14 additions & 0 deletions components/mjs/input/tex/extensions/dsfont/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"build": {
"id": "[tex]/dsfont",
"component": "input/tex/extensions/dsfont",
"targets": ["input/tex/dsfont"]
},
"webpack": {
"name": "input/tex/extensions/dsfont",
"libs": [
"components/src/input/tex-base/lib",
"components/src/core/lib"
]
}
}
17 changes: 17 additions & 0 deletions components/mjs/input/tex/extensions/dsfont/dsfont.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './lib/dsfont.js';
import {MathJax, combineDefaults} from 'mathjax-full/js/components/global.js';

const FONTPATH = (typeof document === 'undefined' ?
'@mathjax/mathjax-dsfont-font-extension' :
'https://cdn.jsdelivr.net/npm/mathjax-dsfont-font-extension');

if (MathJax.config?.loader) {
combineDefaults(MathJax.config.loader, 'paths', {
'mathjax-dsfont-extension': FONTPATH
});
MathJax.config.loader['[tex]/dsfont'] = {
checkReady() {
return MathJax.loader.load(`[mathjax-dsfont-extension]/${MathJax.config?.startup?.output || 'chtml'}`);
}
};
}
57 changes: 57 additions & 0 deletions ts/input/tex/dsfont/DsfontConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*************************************************************
*
* Copyright (c) 2017-2023 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


/**
* @fileoverview The dsfont package.
*
* @author [email protected] (Volker Sorge)
*/

import {Configuration} from '../Configuration.js';
import {CommandMap} from '../TokenMap.js';
import BaseMethods from '../base/BaseMethods.js';
import TexParser from '../TexParser.js';

/**
* The methods that implement the dsfont package.
*/

new CommandMap('dsfont', {
mathds: 'ChooseFont',
}, {
ChooseFont: function (parser: TexParser, name: string) {
BaseMethods.MathFont(
parser, name,
parser.options.dsfont.sans ? '-ds-ss' : '-ds-rm');
}
});

//
// Define the package configuration, including switch for sans serif.
//
export const DsfontConfiguration = Configuration.create('dsfont', {
handler: {
macro: ['dsfont'],
},
options: {
dsfont: {
sans: false
}
}
});