This is a major update to Caxton.
Lazy glyph uploading
This release changes the way glyphs are uploaded to the GPU. Previously, all glyphs would be put in a texture atlas and uploaded to VRAM eagerly during loading, which was wasteful for large fonts. This version uploads each glyph if and when it is needed.
Note that MTSDF calculation is still done eagerly, as it takes about 50 ms per glyph.
Cached glyph storage
MTSDF calculations are now done in parallel, using all available CPUs. The file format for this information has also been changed.
Other additions
/caxtondumpatlas
command to dump the dynamic texture atlasdebugRefcountChanges
global optionfont_scale
option to font provider- This sets the scale at which the font should be drawn relative to the default
caxton_providers
key in font JSON- Acts like
providers
but will be ignored when Caxton is not installed.
- Acts like
Changes and fixes
margin
now defaults torange
in font metadatarange
now has a hard limit of 255- Underlines and strikethroughs now draw with at least 1 pixel of thickness
- Text fields now draw placeholder text in the 1.19.3 version
- Add fixes for multi-line edit boxes (1.19.2 and later)
- Fix compatibility with TweakerMore’s
disableSignTextLengthLimit
feature - Fix a bug where line-wrapping certain text containing RTL scripts would return the text in the wrong order
- Fix various layout-related crashes
- Add
font_scale
option to font provider - Add support for
caxton_providers
key in font JSON- This can be used instead of
providers
but will be ignored when Caxton is not present
- This can be used instead of
- Fix a bug where line-wrapping certain text containing RTL scripts would return the text in the wrong order
- Fix wrong position of text on the sign editing screen
- Make underlines and strikethroughs draw with at least 1 pixel of thickness
- Additionally, the 1.18.2 and 1.19.2 versions fix a few crashes.
This is a backport of all the changes from 0.2.3 to 0.3.0-beta.2.
- Text area widgets (used in the chat report screen, as well as at least one other mod) now work properly
- Revise fixes to the sign edit screen to be finer grained
- Add
debugRefcountChanges
option to global config - Add
face_index
option in font face metadata - Text fields now draw their placeholder text
- Fix crash when trying to wrap text with pathologically narrow columns
- This affects mods such as IBE Editor that initially set text area widgets to have a negative width.
- Compress cached distance fields so they take up less disk space.
- Parallelize distance field calculations.
- Loading a font for the first time should now be faster on multi-core systems.
- In the font metadata,
margin
now defaults torange
when omitted.
- Replace the atlas implementation with a bucketed shelf allocation algorithm that wastes much less space than the previous one
- Add the
/caxtondumpatlas
command to dump the current Caxton glyph atlas for debugging - Validate indices into pixel data associated glyphs when loading cached font data from the disk
Some caveats:
- Due to the new atlas implementation, this release imposes a hard limit of 255 on the
range
parameter in the*.ttf.json
or*.otf.json
file.
As usual, feel free to report bugs or performance regressions on the issue tracker.
This is a test of a major revision in how glyphs are stored to evaluate its viability.
Previously, Caxton created texture atlases for all of the glyphs of a font during resource loading and uploaded them as textures onto the GPU.
This version still computes the MSDF images of each glyph at load time but maintains a dynamic atlas and uploads the glyph textures to the GPU when the respective glyphs are first used. This can save GPU memory for large fonts but might otherwise increase overhead. In addition, the atlas implementation has less information to work with (for instance, it can no longer reorder all of the glyphs by descending height).
Depending on your hardware, the font you use, and the other mods you have installed, Caxton 0.3.0-alpha.1 might perform better or worse than 0.2.3. Feedback on this, as well as any bug reports, are welcome on the issue tracker, but remember to mention the version you’re using.
Limitations
- This version overhauls how cached distance fields are stored, so any fonts you load will need their caches regenerated.
- In particular, cached glyph textures are no longer stored as a .png file. In fact, they’re not compressed at all! This means that cache files will be huge. This will be resolved later.
- Cache files now depend on the endianness of your platform.
- When copying glyph bitmaps from CPU to GPU memory, Caxton does not currently validate the offset to the source data. This will be fixed in a later update, but you might want to avoid loading untrusted cache files for now.
- Only 1.19.3 is currently supported.
The source for this version is available in the feature/lazy-vramming
branch of the repository.
- Fix crash with Iris Shaders
- Fix some text fields not being focused properly on mouse clicks