cosmic-text/Cargo.toml

88 lines
2.3 KiB
TOML
Raw Normal View History

2022-10-18 12:07:22 -06:00
[package]
name = "cosmic-text"
2022-10-25 12:54:21 -06:00
description = "Pure Rust multi-line text handling"
2026-02-20 15:46:09 -07:00
version = "0.18.2"
2022-10-18 12:07:22 -06:00
authors = ["Jeremy Soller <jeremy@system76.com>"]
edition = "2021"
2022-10-24 08:56:48 -06:00
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/cosmic-text/latest/cosmic_text/"
repository = "https://github.com/pop-os/cosmic-text"
rust-version = "1.89"
2022-10-18 12:07:22 -06:00
[dependencies]
2026-01-29 09:48:18 -07:00
bitflags = "2.10.0"
core_maths = { version = "0.1.1", optional = true }
cosmic_undo_2 = { version = "0.2.0", optional = true }
fontdb = { version = "0.23", default-features = false }
harfrust = { version = "0.5.0", default-features = false }
hashbrown = { version = "0.16", optional = true, default-features = false }
2026-01-29 09:48:18 -07:00
libm = { version = "0.2.16", optional = true }
linebender_resource_handle = { version = "0.1.1", default-features = false }
2026-01-29 09:48:18 -07:00
log = "0.4.29"
modit = { version = "0.1.5", optional = true }
rangemap = "1.7.1"
2026-01-29 09:48:18 -07:00
rustc-hash = { version = "2.1.1", default-features = false }
self_cell = "1.2.2"
skrifa = { version = "0.40.0", default-features = false }
2026-01-29 09:48:18 -07:00
smol_str = { version = "0.3.2", default-features = false }
syntect = { version = "5.3.0", optional = true }
sys-locale = { version = "0.3.2", optional = true }
2023-09-18 08:57:01 -06:00
unicode-linebreak = "0.1.5"
2026-01-29 09:48:18 -07:00
unicode-script = "0.5.8"
unicode-segmentation = "1.12.0"
2022-10-18 12:07:22 -06:00
[dependencies.swash]
2026-01-29 09:48:18 -07:00
version = "0.2.6"
default-features = false
features = ["render", "scale"]
optional = true
2022-11-08 08:43:27 -07:00
[dependencies.unicode-bidi]
2026-01-29 09:48:18 -07:00
version = "0.3.18"
2022-11-08 08:43:27 -07:00
default-features = false
features = ["hardcoded-data"]
[features]
default = ["std", "swash", "fontconfig"]
fontconfig = ["fontdb/fontconfig", "std"]
monospace_fallback = []
no_std = ["hashbrown", "dep:libm", "skrifa/libm", "core_maths", "swash?/libm"]
peniko = []
shape-run-cache = []
2022-11-08 08:43:27 -07:00
std = [
"fontdb/memmap",
"fontdb/std",
"harfrust/std",
"linebender_resource_handle/std",
"skrifa/std",
"swash?/std",
"sys-locale",
"unicode-bidi/std",
2022-11-08 08:43:27 -07:00
]
vi = ["modit", "syntect", "cosmic_undo_2"]
wasm-web = ["sys-locale?/js"]
2023-07-22 08:24:28 -07:00
warn_on_missing_glyphs = []
[[bench]]
name = "layout"
harness = false
[[bench]]
name = "text_shaping_benchmarks"
harness = false
2022-10-18 12:07:22 -06:00
[workspace]
members = ["examples/*"]
[dev-dependencies]
2026-01-29 09:48:18 -07:00
tiny-skia = "0.11.4"
criterion = { version = "0.8.1", default-features = false, features = [
"cargo_bench_support",
] }
Fix #134 and include a test for it. Try to ensure that using "the width computed during an unconstrained layout" as the width constraint during a relayout produces the same layout. This is useful for certain UI layout algorithms. See https://github.com/pop-os/cosmic-text/issues/134 * Instead of computing the LayoutLine width from the positioned and aligned glyphs, we pass through width computed during line wrapping (unless justified alignment is used, in this case we use the old approach because the use case for measuring the width isn't really applicable to justified text since that will just expand to the provided width). For the produced width to later give the same wrapping results when passed in as the `line_width` it needs to use the same exact float arithmatic that was used to compute the width that is compared against `line_width` when making line wrapping choices. Passing this width through as the LayoutLine width is the most covenient option without making more major changse to the API. Nevertheless, I am imagining that if we get a dedicated measurement method (i.e. that doesn't do the final positioning and alignment of glyphs and which caches `Vec<VisualLine>`), then this width can just be exposed there instead of preservering it in LayoutLine. * Incidentally, this fixes https://github.com/pop-os/cosmic-text/issues/169. * Switch substraction from `fit_x` to checking whether potential addition to the current line width would exceed the `line_width`. This avoids the float error being dependent on the provided `line_width` value. * When eliminating trailing space from the line width, we avoid backtracking with subtraction (which would not give the same exact value due to float error) and instead save the previous width and use that. * If the previous word did not exceed the line_width, we now include a single blank word even if it would cross the width limit since its width won't be counted. This is necessary to get the same wrapping behavior when re-using the measured width (which doesn't count a single trailing blank word). Note, this whitespace logic may be reworked anyway if <https://github.com/pop-os/cosmic-text/issues/155> is addressed. * Change tests to use `opt-level=1` to keep test runtime down. * Add `fonts` folder for fonts used in tests. * Fix an issue where a non-breaking whitespace was assumed to be the start of a section of spaces which included characters that weren't even whitespace. * Add some TODOs about incongruencies between `is_whitespace`, justification, and line breaks.
2023-08-24 22:37:32 -04:00
[profile.test]
opt-level = 1
2024-03-01 15:02:44 +13:00
[package.metadata.docs.rs]
features = ["vi"]