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!

fix(pdf): cover the Arrows block in the symbol fallback detector (#3608) (#3613)

Diyo Anggara Pradipa Putrab42098cef005
diff --git a/packages/pdf/src/hooks/use-register-fonts.test.ts b/packages/pdf/src/hooks/use-register-fonts.test.ts
index 9368297a4..3dc91044a 100644
--- a/packages/pdf/src/hooks/use-register-fonts.test.ts
+++ b/packages/pdf/src/hooks/use-register-fonts.test.ts
@@ -102,6 +102,23 @@ describe("resolvePdfFonts", () => {
expect(registered).not.toContainEqual(expect.objectContaining({ family: "Noto Serif SC" }));
});
+ it("registers the Noto Sans Symbols 2 fallback for text symbols like arrows (#3608)", () => {
+ const symbolsSource = getWebFontSource("Noto Sans Symbols 2", "400", false);
+ const { registered, registerFonts } = withRegistry();
+
+ const pdfTypography = registerFonts(typography, "en-US", false, new Set(["symbols"]));
+
+ expect(pdfTypography.body.fontFamily).toEqual(["IBM Plex Serif", "Noto Sans Symbols 2", "Noto Serif"]);
+ expect(registered).toContainEqual(
+ expect.objectContaining({
+ family: "Noto Sans Symbols 2",
+ weight: 400,
+ italic: false,
+ src: symbolsSource,
+ }),
+ );
+ });
+
it("registers the fallback family's true Bold face when primary bold exceeds stored weights (#3310)", () => {
const { registered, registerFonts } = withRegistry();
@@ -181,6 +198,15 @@ describe("resumeContentScripts", () => {
expect(scripts.size).toBe(1);
});
+ it("detects text-symbol arrows for the symbols fallback (#3608)", () => {
+ // U+2192 (→) lives in the Arrows block U+2190–U+21FF, which the symbols
+ // detector must include so Noto Sans Symbols 2 covers it.
+ const scripts = resumeContentScripts(withSummary("Hours → Minutes"));
+ expect(scripts.has("symbols")).toBe(true);
+ // The arrow is a text symbol, not emoji or any other script.
+ expect(scripts.size).toBe(1);
+ });
+
it("detects multiple scripts in mixed content", () => {
const scripts = resumeContentScripts(withSummary("안녕 翠翠 سلام こんにちは پژوهشگر שלום สวัสดี"));
expect(scripts.has("hangul")).toBe(true);
diff --git a/packages/pdf/src/hooks/use-register-fonts.ts b/packages/pdf/src/hooks/use-register-fonts.ts
index 8bf8f03af..dcc236f3b 100644
--- a/packages/pdf/src/hooks/use-register-fonts.ts
+++ b/packages/pdf/src/hooks/use-register-fonts.ts
@@ -166,10 +166,11 @@ const thaiRegex = /[฀-๿]/;
// same reason: without it, keycap-only content falls back to a font without
// the enclosure mark and renders garbled.
const emojiRegex = /[\u{1F1E6}-\u{1F1FF}]|\u{20E3}|\p{Extended_Pictographic}/u;
-// Geometric Shapes, Miscellaneous Symbols, Dingbats and Miscellaneous Symbols
-// and Arrows: text symbols like ★ (U+2605) that Latin fonts and Noto Emoji lack (#3581).
-// Pictographs in these blocks (☀, ✔, ⭐) are emoji and already resolve to Noto Emoji.
-const symbolsRegex = /(?!\p{Extended_Pictographic})[■-➿⬀-⯿]/u;
+// Arrows, Geometric Shapes, Miscellaneous Symbols, Dingbats and Miscellaneous
+// Symbols and Arrows: text symbols like → (U+2192) and ★ (U+2605) that Latin
+// fonts and Noto Emoji lack (#3581, #3608). Pictographs in these blocks
+// (☀, ✔, ⭐) are emoji and already resolve to Noto Emoji.
+const symbolsRegex = /(?!\p{Extended_Pictographic})[←-⇿■-➿⬀-⯿]/u;
const scriptDetectors: { script: Script; regex: RegExp }[] = [
{ script: "hangul", regex: hangulRegex },