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

Function wideCharacterFont

static/katex/katex.mjs:4741–4769  ·  view source on GitHub ↗
(wideChar, mode)

Source from the content-addressed store, hash-verified

4739["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif
4740["mathtt", "texttt", "Typewriter-Regular"]];
4741const wideCharacterFont = function wideCharacterFont(wideChar, mode) {
4742 // IE doesn't support codePointAt(). So work with the surrogate pair.
4743 const H = wideChar.charCodeAt(0); // high surrogate
4744
4745 const L = wideChar.charCodeAt(1); // low surrogate
4746
4747 const codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;
4748 const j = mode === "math" ? 0 : 1; // column index for CSS class.
4749
4750 if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {
4751 // wideLatinLetterData contains exactly 26 chars on each row.
4752 // So we can calculate the relevant row. No traverse necessary.
4753 const i = Math.floor((codePoint - 0x1D400) / 26);
4754 return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
4755 } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {
4756 // Numerals, ten per row.
4757 const i = Math.floor((codePoint - 0x1D7CE) / 10);
4758 return [wideNumeralData[i][2], wideNumeralData[i][j]];
4759 } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {
4760 // dotless i or j
4761 return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
4762 } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {
4763 // Greek letters. Not supported, yet.
4764 return ["", ""];
4765 } else {
4766 // We don't support any wide characters outside 1D400–1D7FF.
4767 throw new ParseError("Unsupported character: " + wideChar);
4768 }
4769};
4770
4771/**
4772 * This file contains information about the options that the Parser carries

Callers 1

makeOrdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected