font family displayed

This commit is contained in:
2026-02-04 19:28:06 +00:00
parent 599a601a56
commit 813ff13bf6
7 changed files with 28 additions and 7 deletions

View File

@@ -15,7 +15,8 @@
url("https://fonts.ob248.com/fonts/Basteleur-Moonlight.woff2") url("https://fonts.ob248.com/fonts/Basteleur-Moonlight.woff2")
format("woff2"), format("woff2"),
url("https://fonts.ob248.com/fonts/Basteleur-Moonlight.woff") format("woff"), url("https://fonts.ob248.com/fonts/Basteleur-Moonlight.woff") format("woff"),
url("https://fonts.ob248.com/fonts/Basteleur-Moonlight.ttf") format("truetype"); url("https://fonts.ob248.com/fonts/Basteleur-Moonlight.ttf")
format("truetype");
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;

View File

@@ -4,7 +4,8 @@
url("https://fonts.ob248.com/fonts/FlorDeRuina-Germen.woff2") url("https://fonts.ob248.com/fonts/FlorDeRuina-Germen.woff2")
format("woff2"), format("woff2"),
url("https://fonts.ob248.com/fonts/FlorDeRuina-Germen.woff") format("woff"), url("https://fonts.ob248.com/fonts/FlorDeRuina-Germen.woff") format("woff"),
url("https://fonts.ob248.com/fonts/FlorDeRuina-Germen.ttf") format("truetype"); url("https://fonts.ob248.com/fonts/FlorDeRuina-Germen.ttf")
format("truetype");
font-weight: 50; font-weight: 50;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;
@@ -16,7 +17,8 @@
url("https://fonts.ob248.com/fonts/FlorDeRuina-Semilla.woff2") url("https://fonts.ob248.com/fonts/FlorDeRuina-Semilla.woff2")
format("woff2"), format("woff2"),
url("https://fonts.ob248.com/fonts/FlorDeRuina-Semilla.woff") format("woff"), url("https://fonts.ob248.com/fonts/FlorDeRuina-Semilla.woff") format("woff"),
url("https://fonts.ob248.com/fonts/FlorDeRuina-Semilla.ttf") format("truetype"); url("https://fonts.ob248.com/fonts/FlorDeRuina-Semilla.ttf")
format("truetype");
font-weight: 80; font-weight: 80;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;

View File

@@ -4,7 +4,8 @@
url("https://fonts.ob248.com/fonts/kaerukaeru-Regular.woff2") url("https://fonts.ob248.com/fonts/kaerukaeru-Regular.woff2")
format("woff2"), format("woff2"),
url("https://fonts.ob248.com/fonts/kaerukaeru-Regular.woff") format("woff"), url("https://fonts.ob248.com/fonts/kaerukaeru-Regular.woff") format("woff"),
url("https://fonts.ob248.com/fonts/kaerukaeru-Regular.ttf") format("truetype"); url("https://fonts.ob248.com/fonts/kaerukaeru-Regular.ttf")
format("truetype");
font-weight: 80; font-weight: 80;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;

View File

@@ -3,7 +3,8 @@
src: src:
url("https://fonts.ob248.com/fonts/Ouroboros-Regular.woff2") format("woff2"), url("https://fonts.ob248.com/fonts/Ouroboros-Regular.woff2") format("woff2"),
url("https://fonts.ob248.com/fonts/Ouroboros-Regular.woff") format("woff"), url("https://fonts.ob248.com/fonts/Ouroboros-Regular.woff") format("woff"),
url("https://fonts.ob248.com/fonts/Ouroboros-Regular.ttf") format("truetype"); url("https://fonts.ob248.com/fonts/Ouroboros-Regular.ttf")
format("truetype");
font-weight: 80; font-weight: 80;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;

View File

@@ -4,7 +4,8 @@
url("https://fonts.ob248.com/fonts/VG5000-Regular_web.woff2") url("https://fonts.ob248.com/fonts/VG5000-Regular_web.woff2")
format("woff2"), format("woff2"),
url("https://fonts.ob248.com/fonts/VG5000-Regular_web.woff") format("woff"), url("https://fonts.ob248.com/fonts/VG5000-Regular_web.woff") format("woff"),
url("https://fonts.ob248.com/fonts/VG5000-Regular_web.ttf") format("truetype"); url("https://fonts.ob248.com/fonts/VG5000-Regular_web.ttf")
format("truetype");
font-weight: 80; font-weight: 80;
font-style: normal; font-style: normal;
font-display: swap; font-display: swap;

View File

@@ -78,7 +78,11 @@
const importUrl = card.getAttribute("data-import-url"); const importUrl = card.getAttribute("data-import-url");
const importSnippet = buildImportSnippet(importUrl); const importSnippet = buildImportSnippet(importUrl);
const importOutput = card.querySelector("[data-import]"); const importOutput = card.querySelector("[data-import]");
const snippet = card.querySelector(".font-card__snippet");
const copyButton = card.querySelector("[data-copy]"); const copyButton = card.querySelector("[data-copy]");
const familyName = card
.querySelector(".font-card__title")
?.textContent?.trim();
const weightSelect = card.querySelector("[data-weight-select]"); const weightSelect = card.querySelector("[data-weight-select]");
const weightRange = card.querySelector("[data-weight-range]"); const weightRange = card.querySelector("[data-weight-range]");
const demoText = card.querySelector("[data-demo]"); const demoText = card.querySelector("[data-demo]");
@@ -105,6 +109,17 @@
importOutput.textContent = importSnippet; importOutput.textContent = importSnippet;
} }
if (snippet && familyName) {
const familyOutput = document.createElement("span");
familyOutput.className = "font-card__family";
familyOutput.textContent = `font-family: "${familyName}";`;
if (copyButton) {
snippet.insertBefore(familyOutput, copyButton);
} else {
snippet.appendChild(familyOutput);
}
}
if (!weightRange && !weightSelect) { if (!weightRange && !weightSelect) {
if (demoText && Number.isFinite(defaultWeight)) { if (demoText && Number.isFinite(defaultWeight)) {
demoText.style.fontWeight = String(defaultWeight); demoText.style.fontWeight = String(defaultWeight);

View File

@@ -1,6 +1,6 @@
import { readdir } from "node:fs/promises"; import { readdir } from "node:fs/promises";
import { join, parse } from "node:path"; import { join, parse } from "node:path";
import { Hono, type Context } from "hono"; import { type Context, Hono } from "hono";
import { serveStatic } from "hono/bun"; import { serveStatic } from "hono/bun";
const app = new Hono(); const app = new Hono();