mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-18 09:18:39 +00:00
[plugin system] Add a utility function (setFontMetrics) to extend builtin fontMetrics (#1269)
* Add and expose addFontMetrics function * fix typo * recreate package.json-lock * Add setFontMetrics function to change the defualt metricMap - change getFontMetrics to getGlobalMetrics * use new setFontMetrics on main KaTeX object * fix package-lock.json error by rebuilding it * Add appropriate tests * update the snapshot
This commit is contained in:
committed by
Kevin Barabash
parent
251283ffc1
commit
8b1e1b4886
@@ -26,7 +26,7 @@ import Style from "./Style";
|
||||
|
||||
import domTree from "./domTree";
|
||||
import buildCommon from "./buildCommon";
|
||||
import fontMetrics from "./fontMetrics";
|
||||
import {getCharacterMetrics} from "./fontMetrics";
|
||||
import symbols from "./symbols";
|
||||
import utils from "./utils";
|
||||
|
||||
@@ -48,7 +48,7 @@ const getMetrics = function(
|
||||
): CharacterMetrics {
|
||||
const replace = symbols.math[symbol] && symbols.math[symbol].replace;
|
||||
const metrics =
|
||||
fontMetrics.getCharacterMetrics(replace || symbol, font, mode);
|
||||
getCharacterMetrics(replace || symbol, font, mode);
|
||||
if (!metrics) {
|
||||
throw new Error(`Unsupported symbol ${symbol} and font size ${font}.`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user