mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-09 21:17:22 +00:00
Thai has no spaces between words, so rewrapping treated a whole Thai run as one word and Add text broke rows at any shaped cluster, splitting words such as ประปา or สะอาด across rows. Find the words with ICU4X's dictionary line segmenter (icu_segmenter 2.3, compiled dictionary data, no LSTM model; Unicode-3.0). linebreak::breaks gives every place a row may end inside a run without spaces: the existing Chinese and Japanese rule plus the dictionary's breaks next to Thai. A row never starts with a following vowel, a tone or other mark, Mai Yamok or Paiyannoi, nor ends with a leading vowel, whatever the dictionary says, and the CJK pair rule now honours the same Thai marks. - text.rs wrap: unchanged; linebreak::pieces now cuts Thai too. - text_regions.rs: breaks are worked out once per run of non-space characters instead of pair by pair, since Thai needs the whole run. - added.rs thai_lines: clusters are grouped into words and whole words wrap; only a word wider than the row breaks between clusters, as before. The spaces where a row ends are dropped, as in the Latin wrapper. Rewriting a paragraph into Thai still needs a source font with the Thai glyphs; there is no Thai fallback face for it yet. The compiled dictionaries (Thai, Lao, Khmer, Burmese) add about 1.8 MB to a stripped release binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018cECVMvRnc9mHNFfVp7nXd
32 lines
1.1 KiB
TOML
32 lines
1.1 KiB
TOML
[package]
|
|
name = "pdfcraft-edit"
|
|
description = "Page content editing: headers and footers, watermarks, backgrounds, Bates numbers (ISO 32000-2 §14.8)"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
pdfcraft-annot = { workspace = true }
|
|
pdfcraft-cos = { workspace = true }
|
|
pdfcraft-content = { workspace = true }
|
|
pdfcraft-fonts = { workspace = true }
|
|
pdfcraft-model = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
# A backdrop copy's tag records a hash of the operators before the fill it turned off (backdrop.rs).
|
|
sha2 = "0.11"
|
|
kurbo = { workspace = true }
|
|
# Display order of right-to-left lines in added text, and reading and writing order in Edit text;
|
|
# already in the tree via the interface.
|
|
unicode-bidi = "0.3"
|
|
# Thai word boundaries for rewrapping and Add text (dictionary data compiled in, no LSTM model);
|
|
# the ICU4X 2.3 crates it builds on are already in the tree.
|
|
icu_segmenter = { version = "2.3", default-features = false, features = ["compiled_data"] }
|
|
|
|
[dev-dependencies]
|
|
hayro-syntax = { workspace = true }
|
|
pdfcraft-render = { workspace = true }
|
|
proptest = { workspace = true }
|