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

Function retrieveTextFontName

static/katex/katex.mjs:5824–5862  ·  view source on GitHub ↗
(fontFamily, fontWeight, fontShape)

Source from the content-addressed store, hash-verified

5822
5823
5824const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {
5825 let baseFontName = "";
5826
5827 switch (fontFamily) {
5828 case "amsrm":
5829 baseFontName = "AMS";
5830 break;
5831
5832 case "textrm":
5833 baseFontName = "Main";
5834 break;
5835
5836 case "textsf":
5837 baseFontName = "SansSerif";
5838 break;
5839
5840 case "texttt":
5841 baseFontName = "Typewriter";
5842 break;
5843
5844 default:
5845 baseFontName = fontFamily;
5846 // use fonts added by a plugin
5847 }
5848
5849 let fontStylesName;
5850
5851 if (fontWeight === "textbf" && fontShape === "textit") {
5852 fontStylesName = "BoldItalic";
5853 } else if (fontWeight === "textbf") {
5854 fontStylesName = "Bold";
5855 } else if (fontWeight === "textit") {
5856 fontStylesName = "Italic";
5857 } else {
5858 fontStylesName = "Regular";
5859 }
5860
5861 return `${baseFontName}-${fontStylesName}`;
5862};
5863/**
5864 * Maps TeX font commands to objects containing:
5865 * - variant: string used for "mathvariant" attribute in buildMathML.js

Callers 1

makeOrdFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected