mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-27 03:47:09 -06:00
Text now wraps around a Tight or Through object's shape instead of its bounding box. The outline is the object's wrap polygon (wp:wrapPolygon, in the 21600-unit space of its frame) when it has one; otherwise it is derived: a shape's geometry (ellipse, triangle, star, heart... flattened), the convex hull of a picture's opaque pixels (alpha threshold on a coarse grid, at most 64 points), or the rectangle. The outline turns and flips with the object, keeps the left/right and top/bottom distances from text, and is built once per placed object; each line asks it which stretches of its band it covers. Through also lets text into gaps inside the outline that are wide enough. DOCX reads and writes wp:wrapPolygon (with edited) for wrapTight and wrapThrough; a shape without one gets its outline written, other objects their rectangle, since the schema requires a polygon. Square, top and bottom, behind and in front of text are unchanged. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
27 lines
810 B
TOML
27 lines
810 B
TOML
[package]
|
|
name = "wordcraft-layout"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
description = "WordCraft layout: shaping, line breaking, tabs, lists, tables, pagination, headers/footers, hit testing"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
wordcraft-geom = { workspace = true }
|
|
wordcraft-doc = { workspace = true }
|
|
wordcraft-fonts = { workspace = true }
|
|
wordcraft-proof = { workspace = true }
|
|
unicode-bidi = { workspace = true }
|
|
unicode-linebreak = { workspace = true }
|
|
unicode-segmentation = { workspace = true }
|
|
serde = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
image = { workspace = true }
|
|
log = { workspace = true }
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
# The browser clock (`SystemTime::now()`/`Instant::now()` panic on wasm32).
|
|
js-sys = "0.3"
|