MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / getPreviewFontFamily

Function getPreviewFontFamily

app.js:2017–2026  ·  view source on GitHub ↗
(u8g2FontName)

Source from the content-addressed store, hash-verified

2015}
2016
2017function getPreviewFontFamily(u8g2FontName) {
2018 const f = String(u8g2FontName || "").toLowerCase();
2019 // Rough mapping: we don't have U8g2 fonts in the browser, so map to "similar" web families
2020 if (f.includes("helv")) return 'system-ui, -apple-system, "Segoe UI", Arial, sans-serif';
2021 if (f.includes("ncen")) return 'Georgia, "Times New Roman", Times, serif';
2022 if (f.includes("profont") || f.includes("t0_") || f.includes("6x") || f.includes("5x") || f.includes("7x") || f.includes("8x") || f.includes("9x") || f.includes("10x")) {
2023 return 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
2024 }
2025 return 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
2026}
2027
2028function getPreviewTftFontStyle(tftFontValue, textSize) {
2029 const v = String(tftFontValue || DEFAULT_TFT_FONT);

Callers 1

renderElementsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected