| Crates.io | kas-text |
| lib.rs | kas-text |
| version | 0.8.1 |
| created_at | 2020-08-11 10:10:56.833473+00 |
| updated_at | 2025-09-17 08:40:18.120291+00 |
| description | Text layout and font management |
| homepage | |
| repository | https://github.com/kas-gui/kas-text |
| max_upload_size | |
| id | 275321 |
| size | 234,494 |
A pure-Rust rich-text processing library suitable for KAS and other GUI tools.
Kas-text is intended to address the needs of common GUI text tasks: fast, able to handle plain text well in common scripts including common effects like bold text and underline, along with support for editing plain texts.
More on what Kas-text does do:
Rich text support is limited to changing font properties (e.g. weight, italic), size, family and underline/strikethrough decorations. A (very limited) Markdown processor is included to facilitate construction of these texts using the lower-level FormattableText trait.
Glyph rastering and painting is not implemented here, though kas-text can provide font references for Swash and (optionally) ab_glyph libraries. Check the kas-wgpu code for an example of rastering and painting.
Text editing is only supported via a low-level API. kas_widgets::edit::EditField is a simple editor built over this API.
Since kas-text only concerns text-layout, all examples here are courtesy of KAS GUI. See the examples directory.

Pure-Rust alternatives for typesetting and rendering text:
Parley provides an API for implementing rich text layout. It is backed by Swash.
COSMIC Text provides advanced text shaping, layout, and rendering wrapped up into a simple abstraction.
glyph_brush is a fast caching text render library using ab_glyph.
Contributions are welcome. For the less straightforward contributions it is advisable to discuss in an issue before creating a pull-request.
Testing is done in an ad-hoc manner using examples. The Layout Demo often proves useful for quick tests. It helps to use a patch like that below in kas/Cargo.toml:
[patch.crates-io.kas-text]
path = "../kas-text"
The COPYRIGHT file includes a list of contributors who claim copyright on this project. This list may be incomplete; new contributors may optionally add themselves to this list.
The KAS library is published under the terms of the Apache License, Version 2.0. You may obtain a copy of this license from the LICENSE file or on the following web page: https://www.apache.org/licenses/LICENSE-2.0