MCPcopy Create free account
hub / github.com/TruthHun/BookStack / buildCommon_makeSymbol

Function buildCommon_makeSymbol

static/katex/katex.js:5312–5347  ·  view source on GitHub ↗
(value, fontName, mode, options, classes)

Source from the content-addressed store, hash-verified

5310
5311
5312var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {
5313 var lookup = buildCommon_lookupSymbol(value, fontName, mode);
5314 var metrics = lookup.metrics;
5315 value = lookup.value;
5316 var symbolNode;
5317
5318 if (metrics) {
5319 var italic = metrics.italic;
5320
5321 if (mode === "text" || options && options.font === "mathit") {
5322 italic = 0;
5323 }
5324
5325 symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);
5326 } else {
5327 // TODO(emily): Figure out a good way to only print this in development
5328 typeof console !== "undefined" && console.warn("No character metrics for '" + value + "' in style '" + fontName + "'");
5329 symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes);
5330 }
5331
5332 if (options) {
5333 symbolNode.maxFontSize = options.sizeMultiplier;
5334
5335 if (options.style.isTight()) {
5336 symbolNode.classes.push("mtight");
5337 }
5338
5339 var color = options.getColor();
5340
5341 if (color) {
5342 symbolNode.style.color = color;
5343 }
5344 }
5345
5346 return symbolNode;
5347};
5348/**
5349 * Makes a symbol in Main-Regular or AMS-Regular.
5350 * Used for rel, bin, open, close, inner, and punct.

Callers 2

buildCommon_mathsymFunction · 0.85
buildCommon_makeOrdFunction · 0.85

Calls 3

buildCommon_lookupSymbolFunction · 0.85
isTightMethod · 0.80
getColorMethod · 0.80

Tested by

no test coverage detected