Caxton,以 [William Caxton] 命名,是一个为 Minecraft 添加 TrueType 和 OpenType 字体支持的模组。
可在 Modrinth
和 CurseForge 上获取!
| 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
最初由 [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
由 [bre2el] 为 1.7 到 1.12 版本制作。这个模组同样改进了不同缩放下的文本渲染,并实现了一些文本渲染优化。
至于它是如何工作的,谁知道 RenderType 呢?这个模组是 ARR。
[bre2el]: https://www.curseforge.com/minecraft/mc-mods/smooth-font
由 [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
由 [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
自 1.13 起,Minecraft 支持 TrueType 和 OpenType 字体。然而,这种实现方式与位图字体并没有根本区别——游戏会将字形转换为位图并以朴素方式进行排版。此外,它还错误处理了字形度量,导致 TTF 文本显示时歪斜不正。
如果没有以下项目,Caxton 将不可能实现:
[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
以下人员也为翻译作出了贡献:
友情链接: 网易我的世界 | 泰拉瑞亚 | 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