Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

FIxed bug [Bug] <Error MIME al cargar fuente “Arial” desde Google Fonts en exportaciones públicas> Fixes #2435

sahilb49798950a26
diff --git a/apps/artboard/src/pages/artboard.tsx b/apps/artboard/src/pages/artboard.tsx
index bf7a70930..e0c3b660c 100644
--- a/apps/artboard/src/pages/artboard.tsx
+++ b/apps/artboard/src/pages/artboard.tsx
@@ -2,6 +2,7 @@ import { useEffect, useMemo } from "react";
import { Helmet } from "react-helmet-async";
import { Outlet } from "react-router";
import webfontloader from "webfontloader";
+import { isLocalFont } from "@reactive-resume/utils";
import { useArtboardStore } from "../store/artboard";
@@ -18,6 +19,15 @@ export const ArtboardPage = () => {
}, [metadata.typography.font]);
useEffect(() => {
+ const family = metadata.typography.font.family;
+ if (isLocalFont(family)) {
+ const width = window.document.body.offsetWidth;
+ const height = window.document.body.offsetHeight;
+ const message = { type: "PAGE_LOADED", payload: { width, height } };
+ window.postMessage(message, "*");
+ return;
+ }
+
webfontloader.load({
google: { families: [fontString] },
active: () => {
diff --git a/libs/utils/src/namespaces/fonts.ts b/libs/utils/src/namespaces/fonts.ts
index 939d22573..14fcc09dd 100644
--- a/libs/utils/src/namespaces/fonts.ts
+++ b/libs/utils/src/namespaces/fonts.ts
@@ -6,6 +6,10 @@ export type Font = {
files: Record<string, string>;
};
+export const localFonts = ["Arial", "Cambria", "Garamond", "Times New Roman"];
+export const isLocalFont = (family: string): boolean =>
+ localFonts.some((f) => f.toLowerCase() === family.toLowerCase());
+
export const fonts: Font[] = [
{
family: "Roboto",