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

Function getGlobalMetrics

static/katex/katex.mjs:3785–3809  ·  view source on GitHub ↗

* Get the font metrics for a given size.

(size)

Source from the content-addressed store, hash-verified

3783 */
3784
3785function getGlobalMetrics(size) {
3786 let sizeIndex;
3787
3788 if (size >= 5) {
3789 sizeIndex = 0;
3790 } else if (size >= 3) {
3791 sizeIndex = 1;
3792 } else {
3793 sizeIndex = 2;
3794 }
3795
3796 if (!fontMetricsBySizeIndex[sizeIndex]) {
3797 const metrics = fontMetricsBySizeIndex[sizeIndex] = {
3798 cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
3799 };
3800
3801 for (const key in sigmasAndXis) {
3802 if (sigmasAndXis.hasOwnProperty(key)) {
3803 metrics[key] = sigmasAndXis[key][sizeIndex];
3804 }
3805 }
3806 }
3807
3808 return fontMetricsBySizeIndex[sizeIndex];
3809}
3810
3811/**
3812 * This file holds a list of all no-argument functions and single-character

Callers 1

fontMetricsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected