FontConfig(自定义字体)
基本信息
| 属性 | 值 |
|---|---|
| 类 | com.gtnewhorizons.angelica.config.FontConfig |
| 路径 | src/main/java/com/gtnewhorizons/angelica/config/FontConfig.java |
| 行数 | 87 |
| 注解 | @Config(modid = "angelica", category = "customfont")(:5) |
| 配置文件 | 写入 angelica modid 的配置,分类 customfont(与 AngelicaModulesConfig 不同文件) |
| 字段数 | 16 |
注意 FontConfig 的 @Config 注解没有 filename 参数,因此它不使用 angelica-modules 这个文件名,而是落到 modid angelica 的默认配置位置、分类 customfont。
全部 16 个字段
| # | 字段 | 行 | 类型 | 默认 | 取值范围 |
|---|---|---|---|---|---|
| 1 | enableCustomFont |
:9 |
boolean | false |
— |
| 2 | customFontNamePrimary |
:13 |
String | "(none)" |
— |
| 3 | customFontNameFallback |
:17 |
String | "(none)" |
— |
| 4 | customFontQuality |
:22 |
int | 30 |
RangeInt(6, 72) |
| 5 | fontShadowOffset |
:27 |
float | 1F |
RangeFloat(0, 2) |
| 6 | shadowCopies |
:32 |
int | 1 |
RangeInt(1, 8) |
| 7 | boldCopies |
:37 |
int | 2 |
RangeInt(1, 8) |
| 8 | glyphAspect |
:42 |
float | 0F |
RangeFloat(-1, 1) |
| 9 | glyphScale |
:47 |
float | 1F |
RangeFloat(0.1, 3) |
| 10 | whitespaceScale |
:52 |
float | 1F |
RangeFloat(0.1, 3) |
| 11 | glyphSpacing |
:57 |
float | 0F |
RangeFloat(-2, 2) |
| 12 | fontAAMode |
:64 |
int | 2 |
RangeInt(0, 2) |
| 13 | fontAAStrength |
:69 |
int | 7 |
RangeInt(1, 24) |
| 14 | customFontScale |
:74 |
float | 1.5F |
RangeFloat(0.1, 3) |
| 15 | fontShadowOffsetUC |
:79 |
float | 0.5F |
RangeFloat(0, 2) |
| 16 | enableGlyphReplacements |
:86 |
boolean | true |
— |
几个容易误读的字段
fontAAMode:三档枚举值编码为 int
:59-64 的注释写明取值语义:
@Config.Comment({
"Controls font antialiasing. 0 = none, 1 = 4x MSAA, 2 = 16x MSAA.",
"Turning off AA lets shaders pick up the text."})
@Config.DefaultInt(2)
@Config.RangeInt(min = 0, max = 2)
public static int fontAAMode;
默认 2 = 16x MSAA(最高)。注释第二行说明关闭 AA 会让着色器接管文字渲染。
customFontQuality 与 fontAAStrength 不是一回事
| 字段 | 默认 | 含义 |
|---|---|---|
customFontQuality |
30(6–72) |
字体栅格化质量,注释明说「less pixelated but increasing memory usage」 |
fontAAStrength |
7(1–24) |
只作用于抗锯齿采样间距,注释明说「Higher values increase blur」 |
一个是分辨率,一个是模糊程度,调高 customFontQuality 不等于调高 fontAAStrength。
fontShadowOffsetUC 只作用于 Unicode 字体
:76-79 注释:「A shadow offset multiplier applied only to the Unicode font.」默认 0.5F,与全局的 fontShadowOffset(默认 1F)是两个独立值。
boldCopies 与 shadowCopies 方向相反
| 字段 | 默认 | 含义 |
|---|---|---|
shadowCopies |
1 |
阴影副本数,注释:「The number of shadows to be drawn behind text at various offsets」 |
boldCopies |
2 |
粗体副本数,注释:「The number of bold copies to be drawn behind text at various offsets」 |
两者都是「在文字背后以不同偏移重复绘制」,粗体默认比阴影多一层。
enableGlyphReplacements 的注释引用了外部 issue
:81-86 的注释是一段拼接字符串 + 一条 URL:
See for additional details: https://github.com/GTNewHorizons/Angelica/issues/1239#issuecomment-3729877936
语义是:mod 可以向 Angelica 提供「特殊字符 → 替换字符 或 改用默认 Unicode 字体」的映射;把该项设为 false 可禁用替换,适用于自定义字体本身支持这些特殊字符的场景。默认 true。
总开关位置
enableCustomFont 默认 false。它与 AngelicaConfig 里的 enableFontRenderer(AngelicaConfig.java:122)是两个不同开关,本文件不重复后者的定义。
相关条目
- AngelicaModulesConfig - 同 modid 的主配置,含
enableFontRenderer - fontRenderer mixin 分组 - 3 个字体相关 mixin
- AngelicaClientTweaker -
ConfigurationManager.registerConfig(FontConfig.class)的调用点