[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:
Hossein Saniei
2018-06-10 05:12:35 +04:30
committed by Kevin Barabash
parent 251283ffc1
commit 8b1e1b4886
10 changed files with 453 additions and 264 deletions

View File

@@ -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}.`);
}