[GH-ISSUE #501] [Issue]: Custom font registration uses literal quote characters in family name, breaking weight matching #230

Closed
opened 2026-10-20 17:26:33 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Rasa23 on GitHub (May 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/501

Summary

When a Google Font is selected in Settings → Visual Style → Font, ME registers a FontFace whose family name is a literal string including embedded quote characters (e.g. "Noto Sans" rather than Noto Sans). This malformed registration appears to win font matching over properly-formed @font-face rules with the same family name, causing text to render at the wrong weight.

Expected behavior

Selecting "Noto Sans" as the active font registers the family with name Noto Sans (no embedded quotes) at the appropriate numeric weight. Custom theme @font-face rules adding additional weights for the same family should match and apply normally.

Actual behavior

ME registers a FontFace with family: "\"Noto Sans\"" and weight: "normal". With this registration present, custom-theme @font-face rules for the same family stop behaving correctly. In our case, a theme rule loading NotoSans-Bold.ttf at font-weight: 700 ended up rendering bold for all Noto Sans text, including text where CSS computed font-weight: 400. DevTools Computed shows font-weight: 400 on regular text, but Rendered Fonts reports PostScript name: NotoSans-Bold.

Steps to reproduce

  1. Settings → Visual Style → Font → select "Noto Sans".
  2. Save, hard reload (Ctrl+Shift+R).
  3. Open DevTools Console and run:
    [...document.fonts].map(f => ({ family: f.family, weight: f.weight }))
    
  4. Observe one entry has family: "\"Noto Sans\"" (the family name itself contains literal quote characters) and weight: "normal".

Environment

  • Marinara Engine version: 1.5.8 (also observed on 1.5.7)
  • Install type: source (git clone)
  • OS + version: Windows 11
  • Browser or app shell: Google Chrome

Logs, screenshots, or video

Image

Additional context

Console output of [...document.fonts] showing the malformed family name (escaped quotes are part of the actual string, not display formatting):

0: { family: "Straight Quotes", weight: "normal" }
1: { family: "Noto Sans",        weight: "400"    }   // from custom theme @font-face
2: { family: "Noto Sans",        weight: "700"    }   // from custom theme @font-face
3: { family: "\"Noto Sans\"",    weight: "normal" }   // ME-registered, malformed

Workaround: leave ME's font picker on "Default" and load the desired font entirely from theme CSS under a unique family name (e.g. NotoSansCustom). This avoids the conflict because the malformed "Noto Sans" registration never gets created.

Likely cause: wherever ME's font loader hydrates the user-selected font into a FontFace and adds it to document.fonts, the family name is being passed through with surrounding CSS quotes still attached rather than stripped. The weight: "normal" (string) rather than numeric value may be a related issue in the same code path. (...at least, this is what Claude tells me!)

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Rasa23 on GitHub (May 7, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/501 ## Summary When a Google Font is selected in Settings → Visual Style → Font, ME registers a `FontFace` whose family name is a literal string including embedded quote characters (e.g. `"Noto Sans"` rather than `Noto Sans`). This malformed registration appears to win font matching over properly-formed `@font-face` rules with the same family name, causing text to render at the wrong weight. ## Expected behavior Selecting "Noto Sans" as the active font registers the family with name `Noto Sans` (no embedded quotes) at the appropriate numeric weight. Custom theme `@font-face` rules adding additional weights for the same family should match and apply normally. ## Actual behavior ME registers a `FontFace` with `family: "\"Noto Sans\""` and `weight: "normal"`. With this registration present, custom-theme `@font-face` rules for the same family stop behaving correctly. In our case, a theme rule loading `NotoSans-Bold.ttf` at `font-weight: 700` ended up rendering bold for *all* Noto Sans text, including text where CSS computed `font-weight: 400`. DevTools Computed shows `font-weight: 400` on regular text, but Rendered Fonts reports `PostScript name: NotoSans-Bold`. ## Steps to reproduce 1. Settings → Visual Style → Font → select "Noto Sans". 2. Save, hard reload (Ctrl+Shift+R). 3. Open DevTools Console and run: ```js [...document.fonts].map(f => ({ family: f.family, weight: f.weight })) ``` 4. Observe one entry has `family: "\"Noto Sans\""` (the family name itself contains literal quote characters) and `weight: "normal"`. ## Environment - Marinara Engine version: 1.5.8 (also observed on 1.5.7) - Install type: source (git clone) - OS + version: Windows 11 - Browser or app shell: Google Chrome ## Logs, screenshots, or video <img width="497" height="397" alt="Image" src="https://github.com/user-attachments/assets/9a88987d-4d4c-4f50-a7d1-a060d638e8b5" /> ## Additional context Console output of `[...document.fonts]` showing the malformed family name (escaped quotes are part of the actual string, not display formatting): ``` 0: { family: "Straight Quotes", weight: "normal" } 1: { family: "Noto Sans", weight: "400" } // from custom theme @font-face 2: { family: "Noto Sans", weight: "700" } // from custom theme @font-face 3: { family: "\"Noto Sans\"", weight: "normal" } // ME-registered, malformed ``` **Workaround:** leave ME's font picker on "Default" and load the desired font entirely from theme CSS under a unique family name (e.g. `NotoSansCustom`). This avoids the conflict because the malformed `"Noto Sans"` registration never gets created. **Likely cause:** wherever ME's font loader hydrates the user-selected font into a `FontFace` and adds it to `document.fonts`, the family name is being passed through with surrounding CSS quotes still attached rather than stripped. The `weight: "normal"` (string) rather than numeric value may be a related issue in the same code path. (...at least, this is what Claude tells me!) ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:26:33 +07:00
  • closed this issue
  • added the
    bug
    label
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#230
No description provided.