Skip to content

Fix #4072: 修复无法使用部分中文字体的问题 #4074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Glavo
Copy link
Member

@Glavo Glavo commented Jul 8, 2025

No description provided.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issue #4072 by replacing direct JavaFX Font usage with a new FontReference abstraction to support custom Chinese fonts and updating stylesheet logic to detect default fonts by family name.

  • Introduces FontReference class to store font family and optional style instead of javafx.scene.text.Font.
  • Updates FontManager properties and methods to use FontReference and adjusts logging.
  • Modifies getFontStyleSheet in StyleSheets to check for the default system font by its family string.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
HMCL/src/main/java/org/jackhuang/hmcl/setting/StyleSheets.java Removed direct Font import, changed getFontStyleSheet to use FontReference and match default by family name.
HMCL/src/main/java/org/jackhuang/hmcl/setting/FontManager.java Switched font property to FontReference, updated getters/setters, added FontReference inner class, and simplified logging.
Comments suppressed due to low confidence (2)

HMCL/src/main/java/org/jackhuang/hmcl/setting/FontManager.java:94

  • [nitpick] This log may print "null" when using the default font; consider logging both the resolved family and style (or defaulting to DEFAULT_FONT.get().getFamily()) for clearer diagnostics.
        LOG.info("Font: " + fontFamily);

HMCL/src/main/java/org/jackhuang/hmcl/setting/FontManager.java:211

  • Public FontReference API lacks Javadoc; consider adding class and method documentation to explain its purpose and usage.
        private final String family;

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.

[Bug] 自 3.6.12.279 以来,Windows 平台可能无法正确设置启动器字体
1 participant