(group, options, type)
| 5424 | |
| 5425 | |
| 5426 | const makeOrd = function makeOrd(group, options, type) { |
| 5427 | const mode = group.mode; |
| 5428 | const text = group.text; |
| 5429 | const classes = ["mord"]; // Math mode or Old font (i.e. \rm) |
| 5430 | |
| 5431 | const isFont = mode === "math" || mode === "text" && options.font; |
| 5432 | const fontOrFamily = isFont ? options.font : options.fontFamily; |
| 5433 | |
| 5434 | if (text.charCodeAt(0) === 0xD835) { |
| 5435 | // surrogate pairs get special treatment |
| 5436 | const _wideCharacterFont = wideCharacterFont(text, mode), |
| 5437 | wideFontName = _wideCharacterFont[0], |
| 5438 | wideFontClass = _wideCharacterFont[1]; |
| 5439 | |
| 5440 | return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); |
| 5441 | } else if (fontOrFamily) { |
| 5442 | let fontName; |
| 5443 | let fontClasses; |
| 5444 | |
| 5445 | if (fontOrFamily === "boldsymbol" || fontOrFamily === "mathnormal") { |
| 5446 | const fontData = fontOrFamily === "boldsymbol" ? boldsymbol(text, mode, options, classes) : mathnormal(text, mode, options, classes); |
| 5447 | fontName = fontData.fontName; |
| 5448 | fontClasses = [fontData.fontClass]; |
| 5449 | } else if (utils.contains(mathitLetters, text)) { |
| 5450 | fontName = "Main-Italic"; |
| 5451 | fontClasses = ["mathit"]; |
| 5452 | } else if (isFont) { |
| 5453 | fontName = fontMap[fontOrFamily].fontName; |
| 5454 | fontClasses = [fontOrFamily]; |
| 5455 | } else { |
| 5456 | fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape); |
| 5457 | fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; |
| 5458 | } |
| 5459 | |
| 5460 | if (lookupSymbol(text, fontName, mode).metrics) { |
| 5461 | return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); |
| 5462 | } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { |
| 5463 | // Deconstruct ligatures in monospace fonts (\texttt, \tt). |
| 5464 | const parts = []; |
| 5465 | |
| 5466 | for (let i = 0; i < text.length; i++) { |
| 5467 | parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); |
| 5468 | } |
| 5469 | |
| 5470 | return makeFragment(parts); |
| 5471 | } |
| 5472 | } // Makes a symbol in the default font for mathords and textords. |
| 5473 | |
| 5474 | |
| 5475 | if (type === "mathord") { |
| 5476 | const fontLookup = mathdefault(text, mode, options, classes); |
| 5477 | return makeSymbol(text, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass])); |
| 5478 | } else if (type === "textord") { |
| 5479 | const font = symbols[mode][text] && symbols[mode][text].font; |
| 5480 | |
| 5481 | if (font === "ams") { |
| 5482 | const fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); |
| 5483 | return makeSymbol(text, fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); |
nothing calls this directly
no test coverage detected