(height, options)
| 8419 | |
| 8420 | |
| 8421 | var makeSqrtImage = function makeSqrtImage(height, options) { |
| 8422 | // Define a newOptions that removes the effect of size changes such as \Huge. |
| 8423 | // We don't pick different a height surd for \Huge. For it, we scale up. |
| 8424 | var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. |
| 8425 | |
| 8426 | var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); |
| 8427 | var sizeMultiplier = newOptions.sizeMultiplier; // default |
| 8428 | // Create a span containing an SVG image of a sqrt symbol. |
| 8429 | |
| 8430 | var span; |
| 8431 | var spanHeight = 0; |
| 8432 | var texHeight = 0; |
| 8433 | var viewBoxHeight = 0; |
| 8434 | var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. |
| 8435 | // Then browser rounding error on the parent span height will not |
| 8436 | // encroach on the ink of the viniculum. But that padding is not |
| 8437 | // included in the TeX-like `height` used for calculation of |
| 8438 | // vertical alignment. So texHeight = span.height < span.style.height. |
| 8439 | |
| 8440 | if (delim.type === "small") { |
| 8441 | // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. |
| 8442 | viewBoxHeight = 1000 + vbPad; // 1000 unit glyph height. |
| 8443 | |
| 8444 | if (height < 1.0) { |
| 8445 | sizeMultiplier = 1.0; // mimic a \textfont radical |
| 8446 | } else if (height < 1.4) { |
| 8447 | sizeMultiplier = 0.7; // mimic a \scriptfont radical |
| 8448 | } |
| 8449 | |
| 8450 | spanHeight = (1.0 + emPad) / sizeMultiplier; |
| 8451 | texHeight = 1.00 / sizeMultiplier; |
| 8452 | span = delimiter_sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, options); |
| 8453 | span.style.minWidth = "0.853em"; |
| 8454 | advanceWidth = 0.833 / sizeMultiplier; // from the font. |
| 8455 | } else if (delim.type === "large") { |
| 8456 | // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. |
| 8457 | viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; |
| 8458 | texHeight = sizeToMaxHeight[delim.size] / sizeMultiplier; |
| 8459 | spanHeight = (sizeToMaxHeight[delim.size] + emPad) / sizeMultiplier; |
| 8460 | span = delimiter_sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, options); |
| 8461 | span.style.minWidth = "1.02em"; |
| 8462 | advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. |
| 8463 | } else { |
| 8464 | // Tall sqrt. In TeX, this would be stacked using multiple glyphs. |
| 8465 | // We'll use a single SVG to accomplish the same thing. |
| 8466 | spanHeight = height + emPad; |
| 8467 | texHeight = height; |
| 8468 | viewBoxHeight = Math.floor(1000 * height) + vbPad; |
| 8469 | span = delimiter_sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, options); |
| 8470 | span.style.minWidth = "0.742em"; |
| 8471 | advanceWidth = 1.056; |
| 8472 | } |
| 8473 | |
| 8474 | span.height = texHeight; |
| 8475 | span.style.height = spanHeight + "em"; |
| 8476 | return { |
| 8477 | span: span, |
| 8478 | advanceWidth: advanceWidth, |
nothing calls this directly
no test coverage detected