Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge footnote-spacing: Footnotes: notes stack baseline to baseline (#582)

aiongg72aacb5858ef
diff --cc crates/compose/src/notes.rs
index 12f1b574f,e2614adab..1dd37d52f
--- a/crates/compose/src/notes.rs
+++ b/crates/compose/src/notes.rs
@@@ -171,12 -201,20 +203,21 @@@ impl Notes
rect: Rect::new(x0, y, (x0 + o.rule.width).min(col.x1), y + o.rule.weight),
color: o.rule.color.clone(),
tint: o.rule.tint,
+ ..Deco::default()
});
}
- let mut y = top;
+ // Previous footnote's last baseline and bottom.
+ let mut prev: Option<(f64, f64)> = None;
for p in here {
- let note = &story.notes[p.k];
+ let Some(note) = story.notes.get(p.k) else { continue };
+ let (y, y0) = match prev {
+ None => (top, top),
+ Some((last, bottom)) => {
+ let first = last + o.space_between + p.m.lead;
+ (first - p.m.first, (bottom + o.space_between).min(first))
+ }
+ };
+ let y1 = y + p.m.last + p.m.descent;
ft.notes.push(PlacedNote {
id: note.id,
index: p.k,