Caxton
Caxton,以 William Caxton 命名,是一款为 Minecraft 添加 TrueType 和 OpenType 字体支持的模组。
可在 Modrinth
和 CurseForge 上获取!
功能特性
- 得益于 MSDF 技术,在任何尺寸下都能呈现清晰的文本
- 支持真正的粗体和斜体字体
- 复杂的文本渲染
- 不使用 AWT
当前限制
- 目前不支持旧版字体中的阿拉伯文连字处理。 在存在样式且需要正确处理双向文本的情况下实现这一功能十分复杂,因为我们无法为此使用 ICU4J 的 API。如果你希望阿拉伯文正确渲染,则必须使用在 Caxton 下具备阿拉伯文支持的字体。
- 从字体生成 MTSDF 的成本较高。因此,Caxton 会并行化此过程,并在首次完成后缓存结果。
- Minecraft 及许多模组中的大量 UI 元素对文本渲染存在错误假设。使它们感知到双向文本——更不用说连字等问题——将是一项艰巨的任务,我们欢迎在此领域的补丁。
- GUI 元素已打补丁以应对此问题,但无论其基础方向如何,显示的文本均左对齐。
- 字体微调(Font hinting)可能永远不会得到支持。
模组和资源包兼容性
部分兼容(存在注意事项)
不兼容
布局处理不正确
以下模组已知存在文本布局处理不正确的问题。它们不会导致游戏崩溃,但这些模组的 GUI 元素可能会出现意外行为,并可能在日志中显示关于不支持的文本处理方法的警告。
包含自定义文本相关核心光影的资源包
修改与文本相关的核心光影的资源包(例如来自 Vanilla Tweaks 的“Dark UI”和“Transparent UI”资源包)需要修改才能与 Caxton 字体配合使用。
操作系统支持
Caxton 使用原生库来辅助文本形状生成和 MSDF 生成。预编译版的整合包包含了适用于 x86_64 Windows 和 Linux 平台的该库版本。如果你在其他平台上游玩,则必须自行构建整合包副本。
如果整合包仍然无法识别你的平台,请将 config/caxton.json 中的 rustTarget 设置更改为对应你平台的 Rust 平台名称 之一,并在此处报告问题。
注意:由于我家里没有 Mac,受许可协议限制,我无法为 macOS 构建二进制文件。
如何使用 Caxton
Caxton 目前内置了两个用于字体的资源包。第一个包含的字体是 Inter,第二个是 Open Sans。
如果这些都不符合你的需求,你可以使用自己的字体通过资源包实现。在分发包含字体文件的资源包之前,请阅读字体的许可证,以确保你拥有分发该字体的权利。
通过资源包添加字体
Caxton 添加了一个类型为 caxton 的字体提供程序,支持 regular、bold、italic 和 bold_italic 键。每个键都可以设置为一个标识符,其中 <namespace>:<path> 解析为字体文件 assets/<namespace>/textures/font/<path>。要指定其他选项,请使用对象,其中键 file 指定路径:
{
// 唯一必需的元素。
"file": "<namespace>:<path>",
// 字体相对于默认大小的缩放系数。
// 如果此值为 1.0,则字体被缩放,使得上升高度适配默认位图字体的 7 像素。
// 在 Caxton 0.3.0 中添加。
"scale_factor": 1.0,
// 阴影偏移量,以 memefont 像素大小为倍数。
"shadow_offset": 1.0,
// 在 X 轴和 Y 轴上移动渲染文本的量,单位为 memefont 像素。
// 在 Caxton 0.4.4 中添加。
"shift": [
0.0,
0.0
],
// 一个 32 位整数,其位被解释为描述应用于字符倾斜度的 32 位浮点数。
// 这可用于在没有斜体变体的字体中模拟斜体效果,
// 但如果存在专用的斜体变体,始终优先使用该变体。
// 在 Caxton 0.5.6 中添加。
// Caxton 0.7.0 不支持。
"the_font_designer_couldnt_be_assed_to_make_an_italic_variant_so_slant_the_text": 0,
// OpenType 功能标签列表。语法见下文:
// https://docs.rs/rustybuzz/0.6.0/rustybuzz/struct.Feature.html#method.from_str
"features": [],
// 仅对光栅化技术有效。MSDF 字体始终启用插值。
// 如果为 true,字形位图中的像素将被插值。
// 在 Caxton 0.4.0 中添加。在 Caxton 0.7.0 中被字体元数据设置取代。
"blur": false
}
如果字体 JSON 文件中存在 caxton_providers 键的对象,则在安装 Caxton 时,它将替代 providers 使用。这可用于在 Caxton 未安装时加载 Caxton 字体并提供回退方案。
如果未指定 caxton_providers,则将改用 providers。
你还可以添加文件 assets/<namespace>/textures/font/<path>.json,其中包含用于光栅化字体的设置:
{
// 指定字体文件的实际路径,类似于 Caxton
// 字体提供程序中的显示方式。
// 通常情况下可以省略此项,但在使用可变字体时可能会很有用。
"path": "<字体文件的路径>",
// 以下所有选项均为可选,并且将使用提供的默认值。
}
// 纹理贴图中每个像素对应的字体单位数。
// 如果使用“msdf”字体渲染技术,可以将其设置为较高的值。
// 如果使用“raster”,则应将其设置为较低的值。
"shrinkage": 32.0,
// 在字形边界框的每一侧保留的像素数量。
// 此值应大于 range,若留空则默认使用 range 的值。
"margin": 4,
// 字形在最小和最大可表示符号距离之间的范围宽度。这是一个不超过 255 的正整数。
// 这也决定了发光招牌文本边框的宽度。
"range": 4,
// 是否反转符号距离场(true 或 false)。
// 如果为 null,Caxton 将尝试自动确定该值,但如果猜测错误,你可以覆盖此设置。
"invert": null,
// 此选项用于设置可变字体中的变化轴坐标。
// 每个元素遵循以下格式:
// { "axis": <轴类型>, "value": <轴值> }
"variations": [],
// 在字体集合中使用的字体系列的索引。
// 如果不确定,请保持为 0。
// 于 Caxton 0.3.0 添加。
"face_index": 0,
// 指定是否使用基于 MSDF 的渲染方法(“msdf”),
// 或使用字形位图(“raster” – 实验性功能)。
// “msdf” 推荐用于大多数字体,但 “raster” 更适合像素字体。
// 此外,只有 “raster” 完全兼容 Iris Shaders;如果加载了光影,MSDF 字体中的文本将不会显示在世界中。
// 于 Caxton 0.4.0 添加。
"tech": "msdf",
// 最大 mipmap 级别(0 – 4)。
// 如果使用 MSDF 渲染技术,设置此项没有意义。
// 但是,在使用 raster 渲染技术时,对于非像素字体可能有用。
// 于 Caxton 0.4.0 添加。
"max_mipmap": 0,
// 仅对 raster 技术生效。MSDF 字体始终启用插值。
// 如果为 true,则会对字形位图中的纹理单元进行插值。
// 在 Caxton 0.7.0 中取代字体提供程序设置。
"blur": false
}
请确保包含字体文件的扩展名。 例如,如果您的字体位于 assets/example/textures/font/example.otf,那么您的 JSON 文件应位于 assets/example/textures/font/example.otf.json(而不是 example.json)。
全局配置
以下选项可在 config/caxton.json 中设置:
{
// 与你的平台对应的 Rust 平台名称之一 (https://doc.rust-lang.org/nightly/rustc/platform-support.html)
// 如果此项为 null,则 Caxton 将自动为你的平台确定正确的值,因此建议仅在必要时修改此选项。
// 添加于 Caxton 0.2.1。
"rustTarget": null,
// 使用不同的方法在经验条上绘制等级文本:
// 对于 Caxton 字体,这会使用轮廓着色器来绘制文本,而不是先绘制四份偏移的轮廓色副本,再绘制填充色的主文本。
// 此选项主要用于使轮廓字体的经验等级文本看起来更好。它曾作为 ImmediatelyFast 中错误渲染问题的变通方案,但在该模组的某些后续版本中引发了问题。
// 从 Caxton 0.5.0 开始,Caxton 会检测是否安装了 ImmediatelyFast 1.2.0 或更高版本,并使用其 API 来缓解开启此设置时产生的问题。
// 参见:
// * https://gitlab.com/Kyarei/caxton/-/issues/31
// * https://github.com/RaphiMC/ImmediatelyFast/issues/49
// 非 Caxton 字体不受影响。
// 添加于 Caxton 0.4.0。
"tweakExpText": true,
// 对 Caxton 文本渲染层中的图元进行从前到后的排序。
// 禁用此设置理论上可能导致文本渲染错误;
// 然而,ImmediatelyFast 期望此设置处于禁用状态,且 ImmediatelyFast 的开发者未收到过在此功能禁用时出现渲染问题的报告。
// 如果你遇到渲染问题,即某些文本似乎以错误的 Z 轴顺序绘制,请尝试启用此选项(并在 ImmediatelyFast 中禁用 HUD 批处理)。
// 参见:https://github.com/RaphiMC/ImmediatelyFast/issues/49
// 添加于 Caxton 0.4.0。
"sortTextRenderLayers": false,
// 在 0.6.0 之前,Caxton 复用了原版的 `TextRenderer.Drawer` 类
// 但强制设置其 `x` 和 `y` 字段,而不是为每次操作创建新实例。
// 这导致与 ImmediatelyFast 的一个 mixin 不兼容,
// 因此引入了此选项来解决此问题。
// 截至 0.6.0-alpha.4,不再需要此选项,因为 Caxton 不再使用 `TextRenderer.Drawer`。
// 参见:https://gitlab.com/Kyarei/caxton/-/issues/50
// 添加于 Caxton 0.4.7。
// 移除于 Caxton 0.6.0。
"reuseTextRendererDrawer": true,
// 某些文本处理方法本质上存在缺陷且不受 Caxton 支持。
// 每当调用这些方法时,Caxton 都会记录警告。如果将此选项设置为 true,则 Caxton 将抛出异常。
// 此选项主要用于调试。如有疑虑,请将其设置为 false。
// 添加于 Caxton 0.2.1。
"fatalOnBrokenMethodCall": false,
// 跟踪有关 Caxton 字体对象引用添加或移除的信息,以便进行调试。
// 如有疑虑,请将其设置为 false。
// 在 Caxton 0.3.0 中添加。
"debugRefcountChanges": false,
// 禁用特定日期的彩蛋文本。
// 在 Caxton 0.5.6 中添加。
"disableEasterEggs": false
}
从源码构建
如果你想从源码构建 Caxton,除了 Gradle 之外,你还需要安装 Rust toolchain 和 Clang。
默认情况下,原生库仅针对宿主机平台进行构建。若要为其他平台构建,请在 xyz.flirora.caxton.additionalTargets 属性中通过其 target triples(以逗号分隔)指定额外的目标平台。例如,如果你希望为 x86_64 Windows 构建该库,可以执行以下命令:
gradle build -Dxyz.flirora.caxton.additionalTargets=x86_64-pc-windows-gnu
如果遇到关于未知目标的错误,请修改 caxton-impl/build.gradle 中的 cargoCrossBuildTasks 变量。
与其他模组的对比
BetterFonts / TrueType Font Replacement
最初由 thvortex 在 1.4.4 版本创建,后由 bechill 更新至 1.4.7,再由 The_MiningCrafter 更新至 1.5.2,接着由 secretdataz 更新至 1.6.x 和 1.7.x,随后由 cubex2 从 1.8.9 维护至 1.12.2。之后 secretdataz 再次将其更新回 1.13 及更高版本。
该模组使用 Java AWT 的文本布局功能来排版文本。为了渲染字形,它会将字形光栅化为位图,因此分辨率相当有限。然而,与下面列出的许多其他模组不同,它正确实现了粗体和斜体样式以及复杂脚本的处理。
Smooth Font
由 bre2el 为 1.7 到 1.12 版本创建。该模组还改进了不同缩放比例下的文本渲染效果,并实现了一些文本渲染优化。
至于它是如何工作的?连 RenderType 自己都不清楚吧。这模组简直是“天书”。
ThaiFixes
由 lion328 为 Forge(最高至 1.12.2 版本)和 Rift(1.13 版本)创建,并由 secretdataz 在 Fabric 上更新至 1.18.2 版本。
该模组专门为泰语实现了自己的字形整形例程。因此,它对于需要复杂渲染的其他语言并无用处。
Modern UI
由 BloCamLimb 为 Forge 上的 1.15 到 1.19 版本创建。
从截图来看,该模组似乎支持复杂的文本渲染以及真正的粗体和斜体样式。它还修复了许多原版文本布局的问题,例如 MC-117311。
根据代码判断,Modern UI 拥有令人惊讶的 sophisticated 布局算法。不过我还没来得及仔细研究它。
然而,该模组无法渲染出边缘清晰的文本。此外,它仍然使用 AWT 来执行文本布局。
Minecraft 1.13 及更高版本
自 1.13 版本起,Minecraft 支持 TrueType 和 OpenType 字体。然而,这种实现方式在本质上与位图字体并无太大区别——游戏将字形转换为位图并以天真(naïve)的方式排列文本。此外,它对字形度量的处理不正确,导致 TTF 文本看起来倾斜错位。
致谢
如果没有以下项目,Caxton 将无法诞生:
- Fabric for Minecraft
- Architectury Loom
- Rust 编程语言
- Gradle Cargo Wrapper (Arc-blroth, Apache-2.0)
- HarfRust (MIT)
- Skrifa (MIT/Apache-2.0)
- 0.8 之前的版本使用了 ttf-parser (RazrFalcon, MIT/Apache-2.0)
- fdsm (本人, MIT)
- 0.5 之前的版本使用了 msdfgen (Chlumsky, MIT) 和 msdfgen-rs 绑定 (Kayo Phoenix, MIT),这两者在 fdsm 的开发过程中都发挥了至关重要的作用。
- 0.2.3 及更早版本使用的是 msdf-rs 绑定 (Penple, MIT)。
- ab-glyph-rasterizer (alexheretic, Apache-2.0)
- JNI bindings for Rust (MIT/Apache-2.0)
- flate2 (MIT/Apache-2.0)
- Rayon (MIT/Apache-2.0)
- Cross (MIT/Apache-2.0)
- Fabric-ASM (Chocohead, MPL-2.0)
- MixinExtras (LlamaLad7, MIT)
- Caffeine (Ben Manes, Apache-2.0)
- Inter (Rasmus Andersson, OFL-1.1)
- Open Sans (OFL-1.1)
以下人员也因翻译工作而获得致谢:
- IcedDog 负责中文翻译
- JustFoxxo 负责波兰语翻译
Caxton
Caxton, named after William Caxton, is a Minecraft mod that adds TrueType and OpenType font support.
Available on Modrinth
and CurseForge!
Features
- Crisp text at any size thanks to MSDF technology
- Real bold and italic fonts
- Complex text rendering
- Does not use AWT
Current limitations
- Arabic shaping in legacy fonts is not currently supported. Making this work in the presence of styling and proper
bidirectional text handling is complicated as we cannot use ICU4J’s API for this. If you want Arabic text to render
properly, then you’ll have to use a font with Arabic support under Caxton.
- Generating MTSDFs from fonts is expensive. For this reason, Caxton will parallelize this process and cache the results
after it is first done.
- Many UI elements, both in Minecraft and in mods, make incorrect assumptions about text rendering. Making them aware of
bidirectional text – let alone matters such as ligatures – will be a major undertaking, and patches in this area
are welcome.
- GUI elements have been patched to account for this, but the displayed text is aligned to the left regardless
of its base direction.
- Font hinting will probably never be supported.
Mod and resource pack compatibility
Compatible with some caveats
Incompatible
Handles layout incorrectly
The following mods are known to handle text layout incorrectly. They should not crash the game, but GUI elements from
these mods might have unexpected behavior and might cause warnings to be shown in the log about unsupported text
handling methods.
Resource packs with custom text-related core shaders
Resource packs that modify core shaders related to text, such as the “Dark UI” and “Transparent UI” packs
from Vanilla Tweaks, will require modification to work with Caxton fonts.
OS support
Caxton uses a native library to assist with text shaping and MSDF generation. The pre-built copy of the mod bundles
versions of this library for x86_64 Windows and Linux platforms. If you are playing on a different platform, then you
will have to build a copy of the mod yourself.
If the mod still does not recognize your platform, then change the rustTarget setting in config/caxton.json
to one of the Rust platform names corresponding to your
platform and report an issue here.
Note that as there is not a single Mac in my house, I cannot build binaries for macOS due to licensing issues.
How to use Caxton
Caxton currently comes with two built-in resource packs for fonts. The first font included is Inter, while the second
is Open Sans.
If neither of these suit your needs, you can use your own font using a resource pack. Before distributing a resource
pack that contains a font file, read the font’s license to make sure that you have the right to distribute that font.
Adding fonts via resource packs
Caxton adds a font provider of type caxton, which supports the keys regular, bold, italic, and bold_italic.
Each of these can be set to an identifier, where <namespace>:<path> resolves
to the font file assets/<namespace>/textures/font/<path>. To specify other options, use an object where the
key file specifies the path:
{
// The only required element.
"file": "<namespace>:<path>",
// The factor by which to scale the font from the default size.
// If this is 1.0, then the font is scaled so that the ascent is scaled to 7
// pixels of the default bitmap font.
// Added in Caxton 0.3.0.
"scale_factor": 1.0,
// The shadow offset, as a multiple of the memefont pixel size.
"shadow_offset": 1.0,
// The amount to shift the rendered text by in the X and Y axes, in memefont pixels.
// Added in Caxton 0.4.4.
"shift": [
0.0,
0.0
],
// A 32-bit integer whose bits are interpreted as a 32-bit floating-point number
// describing the slant to apply to the characters.
// This can be used to emulate italics in fonts that do not have an italic variant,
// but it is always preferable to use a dedicated italic variant if one is
// available.
// Added in Caxton 0.5.6.
// Not supported in Caxton 0.7.0.
"the_font_designer_couldnt_be_assed_to_make_an_italic_variant_so_slant_the_text": 0,
// A list of OpenType feature tags. See below for the syntax:
// https://docs.rs/rustybuzz/0.6.0/rustybuzz/struct.Feature.html#method.from_str
"features": [],
// Only has an effect on raster tech. Interpolation is always enabled for
// MSDF fonts.
// If true, texels in the glyph bitmap will be interpolated.
// Added in Caxton 0.4.0. Replaced by font metadata setting in Caxton 0.7.0.
"blur": false
}
If an object exists at the key caxton_providers in the font JSON file, then it will be used in place of providers if
Caxton is installed. This can be used to load a Caxton font while having a fallback if Caxton is not installed.
If caxton_providers is not specified, then providers will be used instead.
You can also add the file assets/<namespace>/textures/font/<path>.json, which contains settings for
rasterizing the font:
{
// Specifies the actual path of the font file, as it would appear in the Caxton
// font provider.
// This should generally be omitted, but can be useful if you are using a
// variable font.
"path": "<path of font file>",
// All of these options are optional and will default to the provided values.
// The number of font units corresponding to each pixel in the texture atlas.
// This can be set to a high value if using the "msdf" font rendering tech.
// If you’re using "raster", then you should set this to a lower value.
"shrinkage": 32.0,
// The number of pixels to leave around the glyph bounding box on each side.
// This should be larger than `range` and will default to `range` if left blank.
"margin": 4,
// The width of the range around the glyph between the minimum and maximum
// representable signed distances. This is a positive integer no greater
// than 255.
// This also determines the width of the border drawn for glowing sign text.
"range": 4,
// Whether to invert the signed distance field (true or false).
// If this is null, then Caxton will try to determine this automatically,
// but you can override this in case it guesses incorrectly.
"invert": null,
// This option is used to set variation axis coordinates in variable fonts.
// Each element has the following format:
// { "axis": <axis type>, "value": <axis value> }
"variations": [],
// The index of the font face to use in a font collection.
// Leave this as 0 if you’re not sure.
// Added in Caxton 0.3.0.
"face_index": 0,
// Specifies whether to use the MSDF-based rendering method ("msdf") or
// to use glyph bitmaps ("raster" – EXPERIMENTAL).
// "msdf" is recommended for most fonts, but "raster" is more suitable for
// pixel fonts.
// In addition, only "raster" is fully compatible with Iris Shaders – text in
// MSDF fonts will not show up inside the world if a shader is loaded.
// Added in Caxton 0.4.0.
"tech": "msdf",
// The maximum mipmap level (0 – 4).
// This is pointless to set if you’re using the MSDF rendering tech.
// However, it can be useful for non-pixel fonts when you’re using the raster
// rendering tech.
// Added in Caxton 0.4.0.
"max_mipmap": 0,
// Only has an effect on raster tech. Interpolation is always enabled for
// MSDF fonts.
// If true, texels in the glyph bitmap will be interpolated.
// Replaces the font provider setting in Caxton 0.7.0.
"blur": false
}
Make sure to include the extension of the font file. So if your font is located at
assets/example/textures/font/example.otf, then your JSON file should be located at
assets/example/textures/font/example.otf.json (not example.json).
Global configuration
The following options are available in config/caxton.json:
{
// One of the Rust platform names (https://doc.rust-lang.org/nightly/rustc/platform-support.html)
// corresponding to your platform.
// If this is null, then Caxton will determine the correct value for your
// platform, so it is recommended to change this only when necessary.
// Added in Caxton 0.2.1.
"rustTarget": null,
// Use a different method of drawing the level text on the experience bar:
// For Caxton fonts, this draws the text with an outline shader, instead of
// drawing four offset copies in the outline color followed by the main text
// in the fill color.
// This option primarily serves to make the experience level text look better
// in outline fonts. It used to act as a workaround for a misrendering issue
// with ImmediatelyFast but posed issues on some later versions of that mod.
// Starting from Caxton 0.5.0, Caxton will detect if ImmediatelyFast 1.2.0 or
// later is present and use its API to mitigate issues with this setting
// turned on.
// See:
// * https://gitlab.com/Kyarei/caxton/-/issues/31
// * https://github.com/RaphiMC/ImmediatelyFast/issues/49
// Non-Caxton fonts are not affected.
// Added in Caxton 0.4.0.
"tweakExpText": true,
// Sort primitives on Caxton’s text render layers from back to front.
// Disabling this setting may theoretically result in misrendering of text;
// however, ImmediatelyFast expects this setting to be disabled, and
// the developer of ImmediatelyFast has not received any reports of rendering
// issues when this functionality is disabled.
// If you experience rendering issues where some text seems to be drawn in
// the wrong z-order, then try enabling this option (and disabling HUD batching
// in ImmediatelyFast).
// See: https://github.com/RaphiMC/ImmediatelyFast/issues/49
// Added in Caxton 0.4.0.
"sortTextRenderLayers": false,
// Before 0.6.0, Caxton reused the vanilla `TextRenderer.Drawer` class
// but forcibly set its `x` and `y` fields instead of creating a new
// instance for every operation.
// This caused an incompatibility with one of ImmediatelyFast’s mixins,
// so this option was introduced to work around this problem.
// As of 0.6.0-alpha.4, this is no longer needed as Caxton no longer
// uses `TextRenderer.Drawer`.
// See: https://gitlab.com/Kyarei/caxton/-/issues/50
// Added in Caxton 0.4.7.
// Removed in Caxton 0.6.0.
"reuseTextRendererDrawer": true,
// Some text handling methods are inherently broken and unsupported by Caxton.
// Caxton will log a warning whenever these methods are called. If this option
// is set to true, then Caxton will throw an exception instead.
// This option is primarily useful for debugging. If in doubt, set this to false.
// Added in Caxton 0.2.1.
"fatalOnBrokenMethodCall": false,
// Track information about when a Caxton font object has a reference added or
// removed for debugging purposes.
// If in doubt, set this to false.
// Added in Caxton 0.3.0.
"debugRefcountChanges": false,
// Disable splash text easter eggs on certain dates.
// Added in Caxton 0.5.6.
"disableEasterEggs": false
}
Building from source
If you want to build Caxton from source, then you’ll need to install the Rust toolchain and Clang in addition to
Gradle.
By default, the native library will be built for the host platform only. To build it for additional platforms, specify
the additional targets by their target triples (separated by commas) in the
xyz.flirora.caxton.additionalTargets property. For instance, if you want to build the library for x86_64 Windows, then
you can invoke
gradle build -Dxyz.flirora.caxton.additionalTargets=x86_64-pc-windows-gnu
If you get an error about unknown targets, then modify the cargoCrossBuildTasks variable in
caxton-impl/build.gradle.
Comparison with other mods
BetterFonts / TrueType Font Replacement
Originally created by thvortex through 1.4.4, updated to 1.4.7 by bechill, then to 1.5.2 by The_MiningCrafter, then
by secretdataz to 1.6.x and 1.7.x, then by cubex2 from 1.8.9 to 1.12.2. Then updated to 1.13 again by secretdataz.
This mod uses Java AWT’s text layout functionality for laying out text. For rendering the glyphs, it rasterizes them
into bitmaps. The resolution is quite limited. Unlike many of the other mods listed below, however, it implements bold
and italic styles, as well as complex scripts, properly.
Smooth Font
Created by bre2el for versions from 1.7 to 1.12. This mod also improves rendering of text at different scales and
implements some optimizations for text rendering.
As for how it works, who the RenderType knows? This mod is ARR.
ThaiFixes
Created by lion328 for Forge on versions up to 1.12.2 and for Rift on 1.13, and updated through 1.18.2 on Fabric
by secretdataz.
This mod implements its own shaping routines for Thai specifically. Thus, it is not useful for other languages that
require complex rendering.
Modern UI
Created by BloCamLimb for versions 1.15 to 1.19 on Forge.
From the screenshots, it seems that this mod supports complex text rendering and true bold and italic styles. It also
fixes many issues with vanilla text layout such as MC-117311.
Judging by the code, Modern UI has a surprisingly sophisticated layout algorithm. I haven’t had much time to look at it,
though.
However, this mod fails to render text with crisp borders. It also uses AWT for performing text layout.
Minecraft 1.13 and later
Since 1.13, Minecraft supports TrueType and OpenType fonts. However, this implementation is not fundamentally different
from those of bitmap fonts – the game converts the glyphs into bitmaps and lays out text naïvely. In addition, it
handles glyph metrics incorrectly, causing TTF text to appear off-kilter.
Credits
Caxton would not have been possible without the following projects:
- Fabric for Minecraft
- Architectury Loom
- The Rust programming language
- Gradle Cargo Wrapper (Arc-blroth, Apache-2.0)
- HarfRust (MIT)
- Versions before 0.8 used RustyBuzz (RazrFalcon, MIT)
- Skrifa (MIT/Apache-2.0)
- Versions before 0.8 used ttf-parser (RazrFalcon, MIT/Apache-2.0)
- fdsm (me, MIT)
- Versions before 0.5 used msdfgen (Chlumsky, MIT) and the msdfgen-rs bindings (Kayo Phoenix, MIT), both of
which have subsequently been invaluable in the development of fdsm.
- Versions 0.2.3 and earlier used the msdf-rs bindings (Penple, MIT) instead.
- ab-glyph-rasterizer (alexheretic, Apache-2.0)
- JNI bindings for Rust (MIT/Apache-2.0)
- flate2 (MIT/Apache-2.0)
- Rayon (MIT/Apache-2.0)
- Cross (MIT/Apache-2.0)
- Fabric-ASM (Chocohead, MPL-2.0)
- MixinExtras (LlamaLad7, MIT)
- Caffeine (Ben Manes, Apache-2.0)
- Inter (Rasmus Andersson, OFL-1.1)
- Open Sans (OFL-1.1)
The following people are also credited for translations:
- IcedDog for the Chinese translation
- JustFoxxo for the Polish translation
评论 0
登录后参与评分
还没有评论,来抢沙发吧