Skip to content

[Bug]: Code blocks render Vietnamese (non-Latin) diacritics poorly — no font override option #61392

Description

@dungphan0038

Bug Description

In code blocks, Vietnamese characters with diacritics (ư, ơ, đ, ắ, ễ, ỗ, ự, ấ, ờ, ỹ, …) do not render in the monospace font. They fall back to a system font (e.g. Segoe UI), so the text looks misaligned/“broken” inside otherwise-monospaced code. There is no user-facing setting (Custom CSS or font picker) to override the code font, so non-Latin users cannot fix this without patching the app binary.

Steps to Reproduce

  1. In the desktop app, set the theme to mono (or ember).

  2. Send a message containing a code block with Vietnamese diacritics, e.g.:

    x = "học sinh mất gốc toán đà lạt — ưỡm ơ đễ"
    
  3. Open DevTools (Ctrl+Shift+I) → Elements → inspect a <code>/<pre> element → look at computed font-family.

Expected Behavior

Diacritics render cleanly inside the monospace font, aligned with the rest of the code.

Actual Behavior

Computed font-family on the code element is e.g.:

"Courier Prime", "Cascadia Code", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", emoji

The theme’s primary mono font (Courier Prime, loaded via fontUrl: https://fonts.googleapis.com/css2?family=Courier+Prime...) does not contain Vietnamese glyphs, so diacritics fall through to a system font and render outside the monospace metrics.

Affected Component

Other

Messaging Platform (if gateway-related)

No response

Debug Report

Report       https://paste.rs/JwrO4
agent.log    https://paste.rs/iyXnD
gui.log      https://paste.rs/2ByPl
desktop.log  https://paste.rs/ij8yV

Operating System

Windows 11

Python Version

3.14.4

Hermes Version

0.18.2

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

Root cause (verified)

  • Themes define typography.fontMono with a hardcoded stack; some themes pull the first font from Google Fonts over the network (Courier Prime, IBM Plex Mono). Those webfonts lack Vietnamese (Latin Extended-A) coverage.
  • The font stack has no Vietnam/Latin-Extended-capable fallback mono font, so glyphs drop to a proportional system font.
  • There is no settings/UI hook (verified: no customCss/injectCSS user path in the bundle; config.yaml has no font field) for the user to supply their own code font.
  • Note: the app’s bundled JetBrains Mono woff2 does contain Vietnamese glyphs (confirmed via fontTools), so the default/nous theme is less affected — but any theme using Courier Prime / IBM Plex Mono shows the problem, and no theme lets the user choose a Vietnam-friendly font.

Impact

  • Affects all non-Latin / diacritic-using users (Vietnamese, Thai, Arabic, CJK-mixed, etc.), not just Vietnamese.
  • Degrades readability of exactly the content these users paste most (code with localized comments, math, notes).

Proposed Fix (optional)

Workaround (user-side, fragile)

Patching resources/app.asar → editing the bundled CSS to add an @font-face + code,pre{font-family:"X",monospace!important} (with a Vietnam-capable font such as Iosevka) and repacking works. Confirmed fix. But it is wiped on every auto-update, so it must be re-applied each release.

Suggested fixes (any one would resolve it)

  1. Add a Vietnam/Latin-Extended-capable mono font to the fallback stack (e.g. Iosevka, or a system ui-monospace that covers the locale) after the primary theme font, so diacritics stay monospaced.
  2. Ensure theme webfonts include Vietnamese subsets (request &subset=vietnamese from Google Fonts, or self-host a Vietnam-capable build).
  3. Expose a user setting for the code font — either a “Code font” picker in Settings/Appearance, or a Custom CSS field — so users can supply their own font without binary patching.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havebugcomp/desktopElectron desktop app (apps/desktop/*)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions