-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1057 from mathjax/package/dsfont
Adds the dsfont package.
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}`); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 v.sorge@mathjax.org (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 | ||
} | ||
} | ||
}); | ||
|