修复部分 Linux 环境中未正确选择默认字体的问题 (#4036)

This commit is contained in:
Glavo 2025-06-27 17:23:27 +08:00 committed by GitHub
parent 03c95cd726
commit 432465ab46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -163,6 +163,16 @@ public final class FontManager {
} }
} }
if (family.indexOf(',') >= 0) {
for (String candidateFamily : family.split(",")) {
for (Font font : fonts) {
if (font.getFamily().equalsIgnoreCase(candidateFamily)) {
return font;
}
}
}
}
LOG.warning(String.format("Family '%s' not found in font file '%s'", family, path)); LOG.warning(String.format("Family '%s' not found in font file '%s'", family, path));
return fonts[0]; return fonts[0];
} catch (NoSuchMethodException | IllegalAccessException ignored) { } catch (NoSuchMethodException | IllegalAccessException ignored) {