Skip to content

Commit 735e847

Browse files
committed
empty line-breaks preserve spacing
- addresses the other part of samizdatco#96
1 parent 95c030e commit 735e847

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/typography.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ impl Typesetter{
5050
}
5151
};
5252

53+
if wrap {
54+
// make sure line-breaks use the current leading
55+
let mut strut_style = graf_style.strut_style().clone();
56+
let (leading, size) = if char_style.height() < 1.0 {
57+
( strut_style.leading(), char_style.font_size() * char_style.height() )
58+
}else{
59+
( char_style.height() - 1.0, char_style.font_size() )
60+
};
61+
strut_style
62+
.set_strut_enabled(true)
63+
.set_force_strut_height(true)
64+
.set_font_size(size)
65+
.set_leading(leading);
66+
graf_style.set_strut_style(strut_style);
67+
}
68+
5369
Typesetter{text, width, baseline, typefaces, char_style, graf_style}
5470
}
5571

0 commit comments

Comments
 (0)