fonts
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-06-15 09:35:24 +03:30
parent c6d1097a30
commit b7ffb2b857
118 changed files with 1600 additions and 33 deletions
+5 -9
View File
@@ -1,18 +1,14 @@
import { getFontFamily } from "@/pages/editor/utils/fontFamily";
/** CSS font-weight values that match irancell @font-face declarations. */
/** CSS font-weight values for canvas/Konva text rendering. */
export const getCssFontWeight = (fontWeight?: string): number => {
if (!fontWeight || fontWeight === "normal") return 300;
if (fontWeight === "bold" || fontWeight === "bolder") return 600;
if (!fontWeight || fontWeight === "normal") return 400;
if (fontWeight === "bold" || fontWeight === "bolder") return 700;
const n = parseInt(fontWeight, 10);
if (!Number.isNaN(n)) {
if (n >= 600) return 600;
if (n <= 200) return 200;
return 300;
}
if (!Number.isNaN(n)) return n;
return 300;
return 400;
};
/** Konva.Text uses `fontStyle: bold` (canvas keyword), not numeric weight. */