Skip to content

Fix: Allow chinese symbols in (AWT) tray menu - #4384

Merged
infeo merged 3 commits into
developfrom
fix/chinese-tray-menu
Nov 10, 2026
Merged

infeo merged 3 commits into
developfrom
fix/chinese-tray-menu

Conversation

@infeo

@infeo infeo commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Supersedes #4381. Description copied from there and adjusted. Initial fix/contribution made by @Red51531.

Summary

Chinese text in the Windows tray menu renders as squares. OpenJDK's Windows fontconfig defines sequence.allfonts.UTF-8.{hi,ja,ko} but no UTF-8.zh. With file.encoding=UTF-8, WFontConfiguration finds no GB2312_CHARSET component font for the AWT PopupMenu and falls back to Arial,ANSI_CHARSET. Korean has its own UTF-8.ko entry, which likely explains why it could not be reproduced with a Korean locale in #1474.

This PR generates runtime/lib/fontconfig.properties from the bundled .src after jlink, adding UTF-8.zh (+ zh.TW, zh.HK). FontConfiguration.findImpl() loads .properties before .bfc. file.encoding stays UTF-8, so no WinFsp/FUSE side effects. The build fails if any allfonts.UTF-8.zh* entry exists, so a future JDK change cannot silently drop the patch.

Related Issues

Closes #1474

Red51531 and others added 3 commits November 4, 2026 10:15
Addresses #1474 (tray menu shows squares for Chinese on Windows).

**Cause:** OpenJDK's Windows fontconfig defines `sequence.allfonts.UTF-8.{hi,ja,ko}` but no `UTF-8.zh`. With `file.encoding=UTF-8`, `WFontConfiguration` finds no `GB2312_CHARSET` component font for the AWT `PopupMenu` and falls back to `Arial,ANSI_CHARSET`, so Chinese renders as squares. Korean has its own `UTF-8.ko` entry, which likely explains why it could not be reproduced with a Korean locale.

**Change:** after jlink, generate `runtime/lib/fontconfig.properties` from the bundled `.src`, adding `UTF-8.zh` (+ `zh.TW`, `zh.HK`). `FontConfiguration.findImpl()` loads `.properties` before `.bfc`. `file.encoding` stays UTF-8, so no WinFsp/FUSE side effects. The build fails if the anchor line is missing, so a future JDK change cannot silently drop the patch.

**Tested:** Windows 11 (zh-CN), Cryptomator 1.19.6-msi-6588. The file produced by this script, loaded via `-Dsun.awt.fontconfig`, fixes the tray menu; an equivalent patch was also verified on a second machine. I did not build the installer locally. zh_TW / zh_HK are untested.

This may be superseded by the native tray work (@purejava's Shell_NotifyIconW POC); it is meant as a low-risk interim fix.
@infeo infeo added this to the 1.20.0 milestone Nov 5, 2026
@infeo infeo self-assigned this Nov 5, 2026
Copilot AI balanced review requested due to automatic review settings November 5, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Packaged Windows runtime validation is still needed because testing used an explicit fontconfig override on zh-CN, leaving automatic font discovery and installer tray rendering across zh-CN, zh-TW, and zh-HK unverified.

No open issues 🎉

What changed in this PR

This PR addresses Chinese text rendering as squares in the Windows AWT tray menu by patching the bundled runtime’s font configuration without changing UTF-8 encoding.

Changes:

  • Generate fontconfig.properties with UTF-8 sequences for Chinese, Taiwan, and Hong Kong locales.
  • Fail the build if any of the three target sequences already exists, prompting reassessment of the workaround.
  • Apply the patch after runtime creation and before packaging in both Windows build paths.
File Description
dist/​win/​build.ps1 Invoke the font configuration helper during local Windows builds.
dist/​win/​AddChineseFontConfigSequences.java Generate the patched configuration and check for existing target sequences.
.github/​workflows/​win-exe.yml Apply the font configuration patch before CI packaging.

Review effort: Balanced

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The build-msi job runs AddChineseFontConfigSequences.java against runtime after removing distrusted CA certificates. This adds missing UTF-8.zh font sequences to the generated Windows runtime.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix

Suggested reviewers: overheadhunter

Merge Risk: Minimal · up to 84d39

No concrete merge-blocking risk is established by the current review.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the main change: Chinese symbols in the AWT tray menu are fixed. The changeset adds the missing UTF-8.zh font sequences to the Windows runtime build, which addresses that rendering bug…
Description check Passed The description states the problem (Chinese text in the Windows tray menu renders as squares) and the cause (missing UTF-8.zh fontconfig sequences). It also describes the fix: generating runtime/lib/f…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Chinese symbols in the AWT tray menu are fixed. The changeset adds the missing UTF-8.zh font sequences to the Windows runtime build, which addresses that rendering bug. The title is specific and matches the objectives, though it does not mention the build-time mechanism.

Full details: Description check

Explanation

The description states the problem (Chinese text in the Windows tray menu renders as squares) and the cause (missing UTF-8.zh fontconfig sequences). It also describes the fix: generating runtime/lib/fontconfig.properties after jlink with UTF-8.zh entries. This matches the workflow change and the objectives.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1

.github/workflows/win-exe.yml-183-183: 1

183-183: Minor · Stability & Availability · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Quote the JAVA_HOME executable path.

This workflow runs run steps with Bash. (raw.githubusercontent.com) The unquoted expansion can undergo word splitting or pathname expansion. (gnu.org) A Java path containing whitespace or glob characters can prevent the MSI build step from starting Java. Use "${JAVA_HOME}/bin/java" here, and apply the same fix to the preceding invocation.

Proposed fix

-        run: ${JAVA_HOME}/bin/java dist/win/AddChineseFontConfigSequences.java runtime
+        run: "${JAVA_HOME}/bin/java" dist/win/AddChineseFontConfigSequences.java runtime

Source: Linters/SAST tools

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c3f38b4-a4ea-4ac2-a453-caabfab05cb4
Commits

Reviewing files that changed from the base of the PR and between 88c7a79 and 84d391b.

Files ignored due to path filters: 2

  • dist/win/AddChineseFontConfigSequences.java is excluded by !**/dist/**
  • dist/win/build.ps1 is excluded by !**/dist/**
Files selected for processing: 1

  • .github/workflows/win-exe.yml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@infeo

infeo commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Short smoke test with setting the language to Chinese (traditional, Hongkong ...) and using a local build. the tray now shows proper symbols.
Screenshot_tray_menu

@infeo
infeo merged commit 9b552d3 into develop Nov 10, 2026
10 checks passed
@infeo
infeo deleted the fix/chinese-tray-menu branch November 10, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Cryptomator tray menu has broken Unicode text

3 participants