Repository navigation
Conversation
Addresses cryptomator#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.
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
| $fontConfigSrc = Join-Path $runtimeImagePath 'lib\fontconfig.properties.src' | ||
| $fontConfigDst = Join-Path (Resolve-Path $runtimeImagePath) 'lib\fontconfig.properties' |
There was a problem hiding this comment.
can you explain the asymmetry regarding $runtimeImagePath vs Resolve-Path $runtimeImagePath?
There was a problem hiding this comment.
The asymmetry comes from the two different APIs consuming these paths:
$fontConfigSrcis read viaGet-Content, a PowerShell cmdlet, which resolves relative paths against the PowerShell location ($PWD).$fontConfigDstis written via[System.IO.File]::WriteAllText, a .NET method, which resolves relative paths against the process working directory ([Environment]::CurrentDirectory). PowerShell does not keep these two in sync, so after acdin an interactive session,.\runtime\...could point to a different location.
Resolve-Path is applied to $runtimeImagePath rather than to the full destination path because fontconfig.properties does not exist yet at that point, and Resolve-Path fails on non-existent paths.
In CI both directories are identical, so there is no practical difference there. If you prefer, I can make it symmetric by resolving the runtime path once and using it for both:
$runtimeImageFullPath = (Resolve-Path $runtimeImagePath).Path
$fontConfigSrc = Join-Path $runtimeImageFullPath 'lib\fontconfig.properties.src'
$fontConfigDst = Join-Path $runtimeImageFullPath 'lib\fontconfig.properties'
Summary
Chinese text in the Windows tray menu renders as squares. OpenJDK's Windows fontconfig defines
sequence.allfonts.UTF-8.{hi,ja,ko}but noUTF-8.zh. Withfile.encoding=UTF-8,WFontConfigurationfinds noGB2312_CHARSETcomponent font for the AWTPopupMenuand falls back toArial,ANSI_CHARSET. Korean has its ownUTF-8.koentry, which likely explains why it could not be reproduced with a Korean locale in #1474.This PR generates
runtime/lib/fontconfig.propertiesfrom the bundled.srcafter jlink, addingUTF-8.zh(+zh.TW,zh.HK).FontConfiguration.findImpl()loads.propertiesbefore.bfc.file.encodingstays 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 or run the test suite locally (build-script-only change). 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.
Related Issues
Fixes #4215
Related to #1474
Checklist