[PR #506] [MERGED] fix(client): normalize custom font family names #4646

Closed
opened 2026-10-22 04:09:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/506
Author: @TheLonelyDevil9
Created: 5/7/2026
Status: ✅ Merged
Merged: 5/7/2026
Merged by: @TheLonelyDevil9

Base: main ← Head: fix/custom-font-family-quotes


📝 Commits (1)

  • ed4d464 fix(client): normalize custom font family names

📊 Changes

1 file changed (+27 additions, -3 deletions)

View changed files

📝 packages/client/src/App.tsx (+27 -3)

📄 Description

What?

Normalize custom font family names before registering browser FontFace objects and before writing the --font-user CSS variable.

Closes #501.

Why?

Custom fonts selected in Settings could be registered with embedded quote characters in the family name, such as "Noto Sans" instead of Noto Sans. That malformed family could interfere with matching custom theme @font-face rules for the same family and cause text to render at the wrong weight.

How?

  • Added a small helper to strip one accidental matching quote wrapper from stored or returned font family names.
  • Kept CSS variable output quoted and escaped, so names with spaces remain valid font-family values.
  • Passed the unquoted family name to the FontFace constructor.
  • Registered downloaded/custom font files with weight: "400" to match the regular font files Marinara serves from the font loader.

Testing?

Ran locally:

pnpm check

Manual verification still needed before release:

  • Manually verify selecting a custom Google Font in Settings registers document.fonts with an unquoted family name.
  • Manually verify custom theme @font-face rules for the same family still match their intended weights.
  • Manually verify default font selection still removes --font-user.

Screenshots (optional)

Not included. This is a font registration fix; visual verification should be done with the reporter's DevTools document.fonts check and a custom theme weight check.

Anything Else?

This is intentionally scoped to the client-side font registration path. It does not change the server font file scanner or Google Fonts download route.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling and validation of custom font-family inputs for more reliable font loading and display.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/506 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 5/7/2026 **Status:** ✅ Merged **Merged:** 5/7/2026 **Merged by:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Base:** `main` ← **Head:** `fix/custom-font-family-quotes` --- ### 📝 Commits (1) - [`ed4d464`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ed4d464ed7217413604a9282a36ff07ee463ef80) fix(client): normalize custom font family names ### 📊 Changes **1 file changed** (+27 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/App.tsx` (+27 -3) </details> ### 📄 Description ## What? Normalize custom font family names before registering browser `FontFace` objects and before writing the `--font-user` CSS variable. Closes #501. ## Why? Custom fonts selected in Settings could be registered with embedded quote characters in the family name, such as `"Noto Sans"` instead of `Noto Sans`. That malformed family could interfere with matching custom theme `@font-face` rules for the same family and cause text to render at the wrong weight. ## How? - Added a small helper to strip one accidental matching quote wrapper from stored or returned font family names. - Kept CSS variable output quoted and escaped, so names with spaces remain valid `font-family` values. - Passed the unquoted family name to the `FontFace` constructor. - Registered downloaded/custom font files with `weight: "400"` to match the regular font files Marinara serves from the font loader. ## Testing? Ran locally: ```sh pnpm check ``` Manual verification still needed before release: - [ ] Manually verify selecting a custom Google Font in Settings registers `document.fonts` with an unquoted family name. - [ ] Manually verify custom theme `@font-face` rules for the same family still match their intended weights. - [ ] Manually verify default font selection still removes `--font-user`. ## Screenshots (optional) Not included. This is a font registration fix; visual verification should be done with the reporter's DevTools `document.fonts` check and a custom theme weight check. ## Anything Else? This is intentionally scoped to the client-side font registration path. It does not change the server font file scanner or Google Fonts download route. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved handling and validation of custom font-family inputs for more reliable font loading and display. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:27 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4646
No description provided.