mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-29 04:46:50 -06:00
- Frame and section name labels follow a rotated frame's top edge as shown (turned with it,
cut to the edge's length; a mirrored frame's label stays upright, a frame turned past 90
degrees takes its label along). Component icons, section pills, eyes and status badges turn too.
- The canvas publishes each label's area to the engine (ToolState::labels): with the Move and
Scale tools, hovering a label highlights its frame and pressing it selects and drags the frame
(one undo step); labels of locked, hidden, deleted or other pages' frames do nothing.
- Right-to-left paragraphs mirror lists and indents: bullets and numbers (".1") on the right,
wrapped lines hanging from the right, the paragraph indent on the right; trailing spaces of a
right-to-left line hang outside it instead of pushing its text out of a right-aligned box.
Canvas, PNG, PDF and SVG all draw the shared layout.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
902 B
Rust
24 lines
902 B
Rust
//! List markers: every bullet of a list takes the paragraph style's font, even when a line starts
|
|
//! with a char only a fallback font draws (Hebrew, Arabic…).
|
|
|
|
use figcraft_doc::{ListStyle, TextData};
|
|
|
|
use crate::layout;
|
|
|
|
#[test]
|
|
fn markers_use_the_paragraph_font() {
|
|
let mut t = TextData::new("First\n\u{05E9}\u{05DC}\u{05D5}\u{05DD}");
|
|
t.list = ListStyle::Bulleted;
|
|
let l = layout(&t, None, None);
|
|
// Markers are the glyphs that cover no char.
|
|
let markers: Vec<_> = l.glyphs.iter().filter(|g| g.char_start == g.char_end).collect();
|
|
if markers.len() != 2 {
|
|
eprintln!("no fonts; skipping");
|
|
return;
|
|
}
|
|
assert_eq!(markers[0].face.id, markers[1].face.id, "both bullets in one font");
|
|
assert_eq!(markers[0].gid, markers[1].gid);
|
|
// The Hebrew paragraph's bullet is on its right (see `rtl_list_tests`).
|
|
assert!(markers[1].x > markers[0].x);
|
|
}
|