mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
Fixed bug [Bug] <Error MIME al cargar fuente “Arial” desde Google Fonts en exportaciones públicas>
Fixes #2435
This commit is contained in:
@ -6,7 +6,18 @@ export type Font = {
|
|||||||
files: Record<string, string>;
|
files: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Known system fonts we consider available locally without fetching from Google Fonts.
|
||||||
|
* Extend this list when adding more system-safe families to the app.
|
||||||
|
*/
|
||||||
export const localFonts = ["Arial", "Cambria", "Garamond", "Times New Roman"];
|
export const localFonts = ["Arial", "Cambria", "Garamond", "Times New Roman"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a font family is a local/system font.
|
||||||
|
*
|
||||||
|
* Input: font family name (case-insensitive)
|
||||||
|
* Output: true if present in localFonts, otherwise false
|
||||||
|
*/
|
||||||
export const isLocalFont = (family: string): boolean =>
|
export const isLocalFont = (family: string): boolean =>
|
||||||
localFonts.some((f) => f.toLowerCase() === family.toLowerCase());
|
localFonts.some((f) => f.toLowerCase() === family.toLowerCase());
|
||||||
|
|
||||||
|
|||||||
24
libs/utils/src/namespaces/tests/fonts.test.ts
Normal file
24
libs/utils/src/namespaces/tests/fonts.test.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { describe, it, expect } from "vitest";
|
||||||
|
import { isLocalFont, localFonts } from "../fonts";
|
||||||
|
|
||||||
|
describe("isLocalFont", () => {
|
||||||
|
it("returns true for known local fonts (case-insensitive)", () => {
|
||||||
|
expect(isLocalFont("Arial")).toBe(true);
|
||||||
|
expect(isLocalFont("arial")).toBe(true);
|
||||||
|
expect(isLocalFont("Times New Roman")).toBe(true);
|
||||||
|
expect(isLocalFont("times new roman")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns false for non-local fonts", () => {
|
||||||
|
expect(isLocalFont("Roboto")).toBe(false);
|
||||||
|
expect(isLocalFont("Open Sans")).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("localFonts", () => {
|
||||||
|
it("includes the expected base set", () => {
|
||||||
|
for (const f of ["Arial", "Cambria", "Garamond", "Times New Roman"]) {
|
||||||
|
expect(localFonts).toContain(f);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user