modsmith Войти Войти Рус / Eng

Caxton

caxton · 952654 загрузок · MIT

клиент: required · сервер: unsupported (заявлено автором мода)

Мод, добавляющий улучшенную поддержку шрифтов TrueType/OpenType.

Описание

Кэкстон

Caxton, названный в честь [Уильяма Кэкстона], — это мод Minecraft, который добавляет поддержку шрифтов TrueType и OpenType.

Доступно на Модринт и CurseForge!

Особенности

  • Четкий текст любого размера благодаря технологии [MSDF].
  • Настоящие жирные и курсивные шрифты.
  • Сложный рендеринг текста
  • Не использует AWT

Текущие ограничения

  • Арабское оформление в устаревших шрифтах в настоящее время не поддерживается. Это работает при наличии стиля и правильного оформления. Обработка двунаправленного текста сложна, поскольку мы не можем использовать для этого API ICU4J. Если вы хотите, чтобы арабский текст отображался правильно, то вам придется использовать шрифт с поддержкой арабского языка в Caxton.
  • Генерация MTSDF из шрифтов обходится дорого. По этой причине Caxton распараллелит этот процесс и кэширует результаты. после того, как это будет сделано впервые.
  • Многие элементы пользовательского интерфейса, как в Minecraft, так и в модах, делают неверные предположения относительно рендеринга текста. Информируя их о двунаправленный текст – не говоря уже о таких вещах, как лигатуры – будет серьезной задачей, и исправления в этой области приветствуются.
    • Элементы графического интерфейса были исправлены, чтобы учесть это, но отображаемый текст независимо выравнивается по левому краю. своего базового направления.
  • Хинтинг шрифтов, вероятно, никогда не будет поддерживаться.

Совместимость с модами и пакетами ресурсов

Совместимо с некоторыми оговорками

| Мод | Версия | Заметки | |-------------------|-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Натрий] | Все, кроме Кэкстона <0.6.0 + Sodium 0.5.5 | Outlined text was misrendered with Sodium 0.5.5 and pre-0.6.0 versions of Caxton | | ImmediatelyFast | ≥1.2.0 | Disable Caxton’s sortTextRenderLayers option (plus reuseTextRendererDrawer for Caxton <0.6.0) (done automatically). Make sure ImmediatelyFast’s experimental_sign_text_buffering option is disabled. | | Exordium | Any | Disable Exordium’s sign buffering |

Incompatible

| Mod | Version | Notes | |-----------------------|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Iris Shaders | Any | Custom core shaders not supported by Iris; in-world text using MSDF fonts do not render | | Emojiful | Any | Outright replaces Minecraft’s default text renderer | | MemoryLeakFix | ≤1.1.1 | | | VanillaIcecreamFix | ≤1.2.1-beta+1.20.4 | Conflicts with Caxton’s Fabric ASM dependency on startup – fixed in 1.2.2-beta+1.21 | | Porting Lib | <1.2.1451-beta+1.18.2/2.1.1453+1.19.2 | Conflicts with Fabric API’s core shader registration API | | Advent of Ascension | 1.20.4-3.7.7 | No crash, but outlined text from AoA does not use MSDF fonts, and AoA’s scrollable pane component does not clip text in MSDF fonts (compatibility add-on planned) |

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.

| Mod | Version | Notes | |------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------| | IBE Editor | Any | Uses a custom text field widget that clones most of vanilla Minecraft’s rendering code | | Roughly Enough Items | Any | Uses unsupported methods in some of its widgets |

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>, разрешается. в файл шрифта assets/<namespace>/textures/font/<path>. Чтобы указать другие параметры, используйте объект, в котором клавиша file указывает путь:

{
  // 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
}

Если объект существует по ключу caxton_providers в файле JSON шрифта, то он будет использоваться вместо providers, если Кэкстон установлен. Это можно использовать для загрузки шрифта Caxton при наличии резервного варианта, если Caxton не установлен. Если caxton_providers не указано, вместо него будет использоваться providers.

Вы также можете добавить файл assets/<namespace>/textures/font/<path>.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": "<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
}

Обязательно укажите расширение файла шрифта. Итак, если ваш шрифт находится по адресу 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
}

Сборка из исходников

Если вы хотите собрать Caxton из исходного кода, вам необходимо установить [Rust Toolchain] и [Clang] в дополнение к Градл.

По умолчанию собственная библиотека будет создана только для хост-платформы. Чтобы собрать его для дополнительных платформ, укажите дополнительные цели по их [тройкам целей] (через запятую) в xyz.flirora.caxton.additionalTargets недвижимость. Например, если вы хотите собрать библиотеку для Windows x86_64, то ты можешь вызвать

gradle build -Dxyz.flirora.caxton.additionalTargets=x86_64-pc-windows-gnu

Если вы получаете сообщение об ошибке о неизвестных целях, измените переменную cargoCrossBuildTasks в caxton-impl/build.gradle.

Сравнение с другими модами

BetterFonts / Замена шрифта TrueType

Первоначально создано [thvortex] до версии 1.4.4, обновлено до версии 1.4.7 компанией bechill, затем до версии 1.5.2 пользователем The_MiningCrafter, затем с помощью [secretdataz] до 1.6.x и 1.7.x, затем с помощью [cubex2] с 1.8.9 до 1.12.2. Затем снова обновился до 1.13 от secretdataz.

Этот мод использует функцию текстового макета Java AWT для размещения текста. Для рендеринга глифов он растрирует их. в растровые изображения. Разрешение весьма ограничено. Однако, в отличие от многих других модов, перечисленных ниже, он реализует жирный шрифт. и курсив, а также сложные шрифты.

Гладкий шрифт

Создан bre2el для версий с 1.7 по 1.12. Этот мод также улучшает рендеринг текста в разных масштабах и реализует некоторые оптимизации для рендеринга текста.

Что касается того, как это работает, кто знает RenderType? Этот мод ARR.

Тайские исправления

Создано [lion328] для Forge в версиях до 1.12.2 и для Rift в 1.13 и обновлено до 1.18.2 на Fabric. автор [secretdataz][secretdataz2].

Этот мод реализует свои собственные процедуры формирования специально для тайского языка. Таким образом, для других языков это бесполезно. требуют сложного рендеринга.

Современный интерфейс

Создано BloCamLimb для версий с 1.15 по 1.19 в Forge.

Судя по скриншотам, этот мод поддерживает сложную визуализацию текста и настоящие полужирный и курсивный стили. Это также исправляет множество проблем с ванильным макетом текста, например MC-117311.

Судя по коду, Modern UI имеет удивительно сложный алгоритм компоновки. У меня не было много времени, чтобы посмотреть на это, хотя.

Однако этот мод не может отображать текст с четкими границами. Он также использует AWT для макетирования текста.

Майнкрафт 1.13 и новее

Начиная с версии 1.13, Minecraft поддерживает шрифты TrueType и OpenType. Однако эта реализация принципиально не отличается от растровых шрифтов — игра преобразует глифы в растровые изображения и наивно размещает текст. Кроме того, это неправильно обрабатывает метрики глифа, в результате чего текст TTF выглядит нестандартным.

Кредиты

Кэкстон был бы невозможен без следующих проектов:

  • Ткань для Майнкрафта
  • Архитектурный станок
  • Язык программирования [Rust]
  • [Gradle Cargo Wrapper] (Arc-blroth, Apache-2.0)
  • [HarfRust] (MIT)
    • В версиях до 0.8 использовалось RustyBuzz (RazrFalcon, MIT)
  • Скрифа (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), обе которые впоследствии сыграли неоценимую роль в развитии ФДСМ.
    • В версиях 0.2.3 и более ранних вместо этого использовались привязки msdf-rs (Penple, MIT).
  • ab-glyph-rasterizer (алексеретик, Apache-2.0)
  • Привязки JNI для Rust (MIT/Apache-2.0)
  • [flate2] (MIT/Apache-2.0)
  • Район (MIT/Apache-2.0)
  • [Крест] (MIT/Apache-2.0)
  • Ткань-ASM (Chocohead, MPL-2.0)
  • MixinExtras (LlamaLad7, MIT)
  • Кофеин (Бен Манес, Apache-2.0)
  • Интер (Расмус Андерссон, ОФЛ-1.1)
  • [Открытый Санс] (ОФЛ-1.1)

Следующие люди также отмечены за переводы:

  • IcedDog за перевод на китайский язык.
  • JustFoxxo для польского перевода

Версии (60)

ВерсияMinecraftЗагрузчикиФайл
1.2.0-alpha.3+26.3-NEOFORGE 26.3 neoforge скачать
1.2.0-alpha.3+26.3-FABRIC 26.3 fabric скачать
1.2.0-alpha.2+26.3-NEOFORGE 26.3 neoforge скачать
1.2.0-alpha.2+26.3-FABRIC 26.3 fabric скачать
1.1.0-alpha.3+26.2-FABRIC 26.2 fabric скачать
1.1.0-alpha.3+26.2-NEOFORGE 26.2 neoforge скачать
1.0.0-beta.2+26.1.2-NEOFORGE 26.1.2 neoforge скачать
1.0.0-beta.2+26.1.2-FABRIC 26.1.2 fabric скачать
1.1.0-alpha.2+26.2-NEOFORGE 26.2 neoforge скачать
1.1.0-alpha.2+26.2-FABRIC 26.2 fabric скачать
1.0.0-beta.1+26.1.2-FABRIC 26.1.2 fabric скачать
1.0.0-beta.1+26.1.2-NEOFORGE 26.1.2 neoforge скачать
0.9.0-beta.3+1.21.11-FABRIC 1.21.11 fabric скачать
0.9.0-beta.3+1.21.11-NEOFORGE 1.21.11 neoforge скачать
0.9.0-beta.2+1.21.11-FABRIC 1.21.11 fabric скачать
0.9.0-beta.2+1.21.11-NEOFORGE 1.21.11 neoforge скачать
1.0.0-alpha.6+26.1.2-NEOFORGE 26.1.2 neoforge скачать
1.0.0-alpha.6+26.1.2-FABRIC 26.1.2 fabric скачать
1.0.0-alpha.5+26.1.2-NEOFORGE 26.1.2 neoforge скачать
1.0.0-alpha.5+26.1.2-FABRIC 26.1.2 fabric скачать
0.9.0-beta.1+1.21.11-NEOFORGE 1.21.11 neoforge скачать
0.9.0-beta.1+1.21.11-FABRIC 1.21.11 fabric скачать
1.0.0-alpha.4+26.1.2-NEOFORGE 26.1.2 neoforge скачать
1.0.0-alpha.4+26.1.2-FABRIC 26.1.2 fabric скачать
0.9.0-alpha.6+1.21.11-NEOFORGE 1.21.11 neoforge скачать
0.9.0-alpha.6+1.21.11-FABRIC 1.21.11 fabric скачать
0.6.4+1.21.5-NEOFORGE 1.21.5 neoforge скачать
0.6.4+1.21.5-FABRIC 1.21.5 fabric скачать
0.6.4+1.21.1-FABRIC 1.21, 1.21.1 fabric скачать
0.6.4+1.21.1-NEOFORGE 1.21, 1.21.1 neoforge скачать
0.6.4+1.20.4-FORGE 1.20.4 forge скачать
0.6.4+1.20.4-FABRIC 1.20.4 fabric скачать
0.6.4+1.20.4-NEOFORGE 1.20.4 neoforge скачать
0.6.4+1.20.1-FABRIC 1.20, 1.20.1 fabric скачать
0.6.4+1.20.1-FORGE 1.20, 1.20.1 forge скачать
0.6.4+1.19.2-FABRIC 1.19.2 fabric скачать
0.6.4+1.19.2-FORGE 1.19.2 forge скачать
0.6.4+1.18.2-FORGE 1.18.2 forge скачать
0.6.4+1.18.2-FABRIC 1.18.2 fabric скачать
1.0.0-alpha.3+26.1.2-NEOFORGE 26.1.2 neoforge скачать
1.0.0-alpha.3+26.1.2-FABRIC 26.1.2 fabric скачать
1.0.0-alpha.2+26.1-NEOFORGE 26.1 neoforge скачать
1.0.0-alpha.2+26.1-FABRIC 26.1 fabric скачать
1.0.0-alpha.1+26.1-NEOFORGE 26.1 neoforge скачать
1.0.0-alpha.1+26.1-FABRIC 26.1 fabric скачать
0.10.0-beta.1+26.1-NEOFORGE 26.1 neoforge скачать
0.10.0-beta.1+26.1-FABRIC 26.1 fabric скачать
0.9.0-alpha.5+1.21.11-NEOFORGE 1.21.11 neoforge скачать
0.9.0-alpha.5+1.21.11-FABRIC 1.21.11 fabric скачать
0.6.3+1.21.5-NEOFORGE 1.21.5 neoforge скачать
0.6.3+1.21.5-FABRIC 1.21.5 fabric скачать
0.6.3+1.21.1-NEOFORGE 1.21, 1.21.1 neoforge скачать
0.6.3+1.21.1-FABRIC 1.21, 1.21.1 fabric скачать
0.6.3+1.20.4-NEOFORGE 1.20.4 neoforge скачать
0.6.3+1.20.4-FORGE 1.20.4 forge скачать
0.6.3+1.20.4-FABRIC 1.20.4 fabric скачать
0.6.3+1.20.1-FORGE 1.20, 1.20.1 forge скачать
0.6.3+1.20.1-FABRIC 1.20, 1.20.1 fabric скачать
0.6.3+1.19.2-FORGE 1.19.2 forge скачать
0.6.3+1.19.2-FABRIC 1.19.2 fabric скачать

Страница на Modrinth →