COSMIC Text: a pure Rust text shaping and layout layer with a dual licence
Pure Rust multi-line text handling
At a glance
- What is it?
- COSMIC Text wraps HarfBuzz-style shaping, a custom Rust layout engine and swash rendering into one crate. It supports bidirectional text, colour emoji and no_std, and it is what the COSMIC desktop shell uses for text.
- Who is it for?
- COSMIC Text is the right pick when you need real text layout in Rust and do not want to bind a system shaping library, because HarfBuzz, skrifa and swash are already doing the hard parts and the layout engine on top is readable Rust you can debug. What you give up by staying in pure Rust is worth stating plainly, though.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 11 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 11, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What the crate actually does, layer by layer
COSMIC Text describes itself as pure Rust multi-line text handling, advanced text shaping, layout and rendering wrapped into a simple abstraction. The interesting part is how much of that is borrowed from specialised crates and how much is written here.
Shaping comes from HarfBuzz's Rust bindings, HarfRust, and the README credits it with supporting a wide variety of advanced shaping operations. Rendering comes from swash, which handles ligatures and colour emoji. Layout, however, is a custom implementation in safe Rust, and it is the part that supports bidirectional text. Font fallback is also custom, and the README says it reuses static fallback lists from browsers such as Chromium and Firefox.
That split tells you where to look when something renders wrong. If glyphs are shaped incorrectly or a ligature fails, look at HarfRust. If rasterisation is off, look at swash. If line breaks, alignment or bidirectional reordering are wrong, the bug is in this crate's own layout code, which is at least code you can read and instrument.
Platform support is stated as full for Linux, macOS and Windows, with other platforms potentially needing their own font fallback implementation. That caveat is narrower than it sounds, since the fallback work is the custom part.
The dependency list shows exactly which Unicode work you inherit
The `Cargo.toml` is more informative than the README about what this crate depends on. Alongside `harfrust` at 0.5.0 and `fontdb` at 0.24, you get `skrifa` at 0.40.0 for font data, `smol_str` and `hashbrown` for string and map performance, `rangemap` for line range tracking, `self_cell` for self-referencing structures, and a cluster of Unicode crates: `unicode-linebreak`, `unicode-script` and `unicode-segmentation`.
`unicode-bidi` at 0.3.18 appears as its own dependency with the `hardcoded-data` feature enabled, which is the visible commitment to bidirectional text in the manifest rather than only in prose. `syntect` is present as an optional dependency, which is the syntax highlighting path.
The feature flags are worth reading before you add the crate. Default features are `std`, `swash` and `fontconfig`, so a default build includes fontconfig discovery, which is Linux-specific in practice even though the crate supports macOS and Windows. The `no_std` feature pulls in `hashbrown`, `libm`, `skrifa/libm` and `core_maths`, and the optional `swash/libm` linkage is why the 0.19.0 release notes mention making the swash feature compile with `no_std`. There are also `peniko` for vector output and `shape-run-cache` for caching, plus an optional `monospace_fallback`.
The package requires Rust 1.89 and uses edition 2021, and the licence field in the manifest is `MIT OR Apache-2.0`.
The UDHR test is the most convincing thing in the repository
The README describes a correctness test that is unusual enough to be worth reading closely. It takes the entire set of Universal Declaration of Human Rights translations, almost 500 languages, concatenates them into one file that ends up being 8 megabytes, then uses the `editor-test` example to simulate typing that file into cosmic-text character by character, testing backspace and delete per character and per line. The final buffer contents are then compared against the original file. The README reports that all 106746 lines are correct.
That test exercises a genuinely hard set of problems at once: right-to-left scripts, bidirectional ordering across script boundaries, combining marks, scripts with unusual line breaking rules, and emoji. Most text libraries get the easy cases right and fall over somewhere in that list.
The scripts in the tree show the testing culture is broad rather than focused on that one case. There is `ci.sh`, `test.sh`, `editor.sh`, `editor-test.sh`, `terminal.sh`, `rich-text.sh` and `multiview.sh`. Each targets a different example or configuration, and `redoxer.sh` suggests attention to the Redox operating system. There is also a `benches/` directory and a `sample/` directory alongside `examples/`.
For a library that renders text on screens, having those scripts in the repository is a better signal of care than any badge on the README.
The roadmap and the changelog disagree about ellipsizing
The README carries a roadmap titled as the features that must be supported before the crate is ready, with checkboxes. Most are ticked: font loading with preset and system fonts, text styles per buffer and per span, shaping with caching and RTL support, font fallback at per-line and per-character granularity, rendering with hinting, ligatures and colour emoji, and `no_std` support with shaping and layout.
Several are not. Under font layout, wrapping with indentation, no wrapping and ellipsize are all unchecked. Under text editing, copy and paste is unchecked. Under `no_std`, font loading and rendering are unchecked while shaping and layout are ticked.
Now compare that with the release notes. Version 0.18.1, published on 2026-02-20, is a single fix for aggressive ellipsizing, and 0.18.2, published the same day later, lists fixes for ellipsize. So the crate shipped ellipsizing behaviour changes while the roadmap still marks ellipsize as not done.
Both facts are in the repository as published and you should read them together rather than assuming the roadmap is authoritative. The likely reading is that the checkbox refers to a full layout-mode support rather than the absence of any ellipsizing, but the README does not say that. Practically, it means the roadmap is not a reliable feature checklist for this crate, and docs.rs for your pinned version is.
Licensing, features added recently and the shape of recent work
Licensing is the one place where the metadata and the manifest say different things, and both belong in your reading. The repository's licence field on GitHub reads Apache-2.0, and the tree carries both `LICENSE-APACHE` and `LICENSE-MIT`. The README states the crate is licensed under either the Apache License Version 2.0 or the MIT license, at your option, and adds that contributions are dual licensed the same way unless stated otherwise. The `Cargo.toml` manifest field agrees with the README and reads `MIT OR Apache-2.0`.
So the accurate statement is that this is dual licensed, and the single Apache-2.0 identifier is a summary of one half of that. If you are distributing it in a context where the choice matters, the manifest field is the authoritative one.
On features, the newest release is 0.19.0, published on 2026-04-22, and its changelog is a long list of fixes with the pull request number for each. The shape of that list tells you where the work has been going. Several entries are about the scroll and shaping interaction: optimising `shape_until_scroll` for large line counts, and fixing `shape_until_scroll` when a buffer line is modified. Two are about font matching and scaling: matching variable fonts using the `wght` axis, and using normalised coordinates for the swash scaler. Others are small correctness details that say a lot about real-world use, such as empty lines using span metrics, removing a 1px horizontal offset on pixel fonts, falling back to a default font in basic shaping mode, and clamping `scroll.line` to a valid range.
That last group is what you would expect from a crate being hardened against an actual text editor. The 0.19.0 release also added text decoration, and the last push to the repository was on 2026-09-20.
Editorial conclusion
COSMIC Text is the right pick when you need real text layout in Rust and do not want to bind a system shaping library, because HarfBuzz, skrifa and swash are already doing the hard parts and the layout engine on top is readable Rust you can debug. What you give up by staying in pure Rust is worth stating plainly, though. You are bound to the shaping implementations these crates provide, and features such as ellipsizing appear in the release notes while the README roadmap still marks them unchecked, so the README understates what the crate does. The practical advice is to read the docs.rs page for the version you actually depend on rather than the roadmap, to treat `MIT OR Apache-2.0` as the licence rather than the single Apache-2.0 identifier GitHub shows, and to run the UDHR editor test in `tests/` before shipping anything user-facing.
Frequently asked questions
What is cosmic-text used for?
It handles multi-line text shaping, layout and rendering in Rust. The crate is built around HarfRust for shaping, swash for rendering, and a custom safe Rust layout implementation that supports bidirectional text and custom font fallback.
Does cosmic-text support no_std?
Yes, with default-features set to false and the no_std feature enabled. The roadmap shows no_std shaping and layout as complete, while no_std font loading and no_std rendering are still marked as outstanding, so no_std support is partial by the project's own account.
What license is cosmic-text released under?
It is dual licensed at your option, under either the Apache License Version 2.0 or the MIT license. The Cargo.toml manifest field reads MIT OR Apache-2.0 and the repository contains both LICENSE-APACHE and LICENSE-MIT, while GitHub's licence field lists only Apache-2.0.
Which platforms does cosmic-text support?
Linux, macOS and Windows are supported with the full feature set. The README notes that other platforms may need font fallback capabilities implemented, and the default feature set includes fontconfig, which is what drives font discovery on Linux.
Can cosmic-text render colour emoji and bidirectional text?
Both are supported. Rendering through swash handles ligatures and colour emoji, bidirectional rendering is ticked as complete on the shaping roadmap, and the crate depends on unicode-bidi with hardcoded data enabled.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/pop-os-cosmic-text)