McLists一周年快乐
服务器已经添加了详细介绍信息板块
服主可以在管理后台来提交自己服务器介绍信息。
服务器介绍信息提交后,管理人员会进行审核
审核通过后会在服务器详细页面进行显示
提交服务器介绍信息会让新玩家更好的了解你的服务器哦~
添加图片信息,也会让百度等搜索引擎更好的收录您的服务器哦~
管理平台地址:传送门
Caxton

Caxton - Caxton 字体渲染

一个添加了改进的 TrueType/OpenType 字体支持的模组。
fabric / forge / neoforge 作者 flirora 支持版本 1.18.2 - 26.1
下载量
349,975
关注数
161
数据来源
Modrinth
模组详细介绍

Caxton

Caxton,以 [William Caxton] 命名,是一个为 Minecraft 添加 TrueType 和 OpenType 字体支持的模组。

可在 Modrinth

CurseForge 上获取!

功能特性

  • 借助 [MSDF] 技术,可在任意大小下获得清晰文本
  • 真正的粗体与斜体字体
  • 复杂文本渲染
  • 不使用 AWT

当前限制

  • 目前不支持传统字体中的阿拉伯语字形整形。 要在存在样式并正确处理双向文本的情况下实现这一点很复杂,因为我们无法为此使用 ICU4J 的 API。如果你希望阿拉伯语文本被正确渲染,那么你需要在 Caxton 下使用支持阿拉伯语的字体。
  • 从字体生成 MTSDF 的开销较大。因此,Caxton 会并行处理该过程,并在首次完成后缓存结果。
  • Minecraft 和模组中的许多 UI 元素都对文本渲染做了错误假设。让它们理解双向文本——更不用说连字之类的问题——将是一项大工程,欢迎在这方面提交补丁。
  • GUI 元素已为此打过补丁,但显示的文本无论其基础方向如何,都会左对齐。
  • 可能永远不会支持字体微调(hinting)。

模组与资源包兼容性

基本兼容,但有一些注意事项

Mod Version Notes
[Sodium] 任意,但不包括 Caxton :

会解析为字体文件 assets//textures/font/

。若要指定其他选项,请使用对象形式,其中 file` 键用于指定路径:

{
  // The only required element.
  "file": ":
",
  // 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
}

如果字体 JSON 文件中存在 caxton_providers 键对应的对象,那么在安装了 Caxton 时,它将替代 providers 被使用。这可用于在安装了 Caxton 时加载 Caxton 字体,同时在未安装 Caxton 时保留回退方案。

如果未指定 caxton_providers,则会改用 providers

你也可以添加文件 `assets//textures/font/

.json`,其中包含字体栅格化设置:

{
  // 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": "
",
  // 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": , "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
}

请务必包含字体文件的扩展名。 例如,如果你的字体位于

assets/example/textures/font/example.otf,那么你的 JSON 文件应位于

assets/example/textures/font/example.otf.json(而不是 example.json)。

全局配置

以下选项可在 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
}

[William Caxton]: https://en.wikipedia.org/wiki/William_Caxton

[MSDF]: https://github.com/Chlumsky/msdfgen

[Inter]: https://github.com/rsms/inter

[Open Sans]: https://github.com/googlefonts/opensans

从源码构建

如果你想从源码构建 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 变量。

[Rust toolchain]: https://www.rust-lang.org/tools/install

[Clang]: https://rust-lang.github.io/rust-bindgen/requirements.html

[cross]: https://github.com/cross-rs/cross/

[target triples]: https://doc.rust-lang.org/nightly/rustc/platform-support.html

与其他模组的比较

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 的文本布局功能来进行文本排版。对于字形渲染,它会将其栅格化为位图,因此分辨率相当有限。不过,与下面列出的许多其他模组不同的是,它能够正确实现粗体、斜体样式以及复杂文字脚本。

[thvortex]: https://github.com/thvortex/BetterFonts

[The_MiningCrafter]: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/1287298-1-5-1-betterfonts-make-your-minecraft-chat-text

[secretdataz]: https://github.com/secretdataz/BetterFonts

[cubex2]: https://github.com/cubex2/BetterFonts

Smooth Font

由 [bre2el] 为 1.7 到 1.12 版本制作。这个模组同样改进了不同缩放下的文本渲染,并实现了一些文本渲染优化。

至于它是如何工作的,谁知道 RenderType 呢?这个模组是 ARR。

[bre2el]: https://www.curseforge.com/minecraft/mc-mods/smooth-font

ThaiFixes

由 [lion328] 为 Forge 平台制作,支持到 1.12.2,并为 Rift 制作了 1.13 版本;之后由 [secretdataz][secretdataz2] 在 Fabric 上继续更新至 1.18.2。

这个模组专门为泰语实现了自己的整形流程,因此对其他需要复杂渲染的语言没有帮助。

[lion328]: https://github.com/lion328/thaifixes

[secretdataz2]: https://github.com/secretdataz/ThaiFixes-Fabric

Modern UI

由 [BloCamLimb] 为 Forge 平台上的 1.15 到 1.19 版本制作。

从截图来看,这个模组似乎支持复杂文本渲染以及真正的粗体和斜体样式。它还修复了许多原版文本布局问题,例如 [MC-117311]。

从代码来看,Modern UI 有一个出人意料地复杂的布局算法。不过,我还没有太多时间深入研究它。

然而,这个模组无法将文本边缘渲染得足够清晰。它还使用 AWT 进行文本布局。

[BloCamLimb]: https://github.com/BloCamLimb/ModernUI

[MC-117311]: https://bugs.mojang.com/browse/MC-117311

Minecraft 1.13 及更高版本

自 1.13 起,Minecraft 支持 TrueType 和 OpenType 字体。然而,这种实现方式与位图字体并没有根本区别——游戏会将字形转换为位图并以朴素方式进行排版。此外,它还错误处理了字形度量,导致 TTF 文本显示时歪斜不正。

致谢

如果没有以下项目,Caxton 将不可能实现:

  • [Fabric] for Minecraft
  • [Architectury Loom]
  • [Rust] 编程语言
  • [Gradle Cargo Wrapper](Arc-blroth,Apache-2.0)
  • [HarfRust](MIT)
  • 0.8 之前的版本使用 [RustyBuzz](RazrFalcon,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)

[Fabric]: https://fabricmc.net/

[Architectury Loom]: https://github.com/architectury/architectury-loom

[Rust]: https://www.rust-lang.org/

[Gradle Cargo Wrapper]: https://github.com/Arc-blroth/gradle-cargo-wrapper

[HarfRust]: https://github.com/harfbuzz/harfrust

[RustyBuzz]: https://github.com/RazrFalcon/rustybuzz

[Skrifa]: https://github.com/googlefonts/fontations/tree/main/skrifa

[ttf-parser]: https://github.com/RazrFalcon/ttf-parser

[fdsm]: https://gitlab.com/Kyarei/fdsm

[msdfgen]: https://github.com/Chlumsky/msdfgen

[msdf-rs]: https://github.com/Penple/msdf-rs

[msdfgen-rs]: https://github.com/katyo/msdfgen-rs

[ab-glyph-rasterizer]: https://github.com/alexheretic/ab-glyph

[JNI bindings for Rust]: https://github.com/jni-rs/jni-rs

[flate2]: https://github.com/rust-lang/flate2-rs

[Rayon]: https://github.com/rayon-rs/rayon

[Fabric-ASM]: https://github.com/Chocohead/Fabric-ASM

[MixinExtras]: https://github.com/LlamaLad7/MixinExtras

[Caffeine]: https://github.com/ben-manes/caffeine

以下人员也为翻译作出了贡献:

  • IcedDog:中文翻译
  • JustFoxxo:波兰语翻译
基本信息
模组名称Caxton
作者flirora
下载量349,975
关注数161
支持版本1.18.2 - 26.1
加载器fabric / forge / neoforge
客户端required
服务端unsupported

友情链接: 网易我的世界 | 泰拉瑞亚 | ocent云计算 | 米饭Minecraft插件文档 | 友链合作

历史访问人数:1,380,446  |  历史访问人次:1,707,057

今日访问人数:12,853  |  今日访问人次:14,869

昨日访问人数:28,790  |  昨日访问人次:35,076

Copyright © 2019-2026 我的世界服务器列表站. All rights reserved.

Powered by GermMC 京ICP备17023959号-6