Repository navigation
Layout: an inline picture is as high as its whole twips, as in Word - #8341
2 commits merged into
Conversation
Word keeps a picture's height in whole twips and drops the rest of the EMUs: 2661310 EMU (209.552pt) is drawn 209.55pt high, and at the foot of a page only that has to fit above the bottom margin. Word for Mac: a picture of 14170.998 twips stays where one of 14171 twips moves on, at single and 1.5 spacing. Test: a_picture_is_as_high_as_its_whole_twips_and_fits_by_them_at_the_page_bottom (fails before this change).
# Conflicts: # docs/layout-parity.md
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
e5bc372
A picture's height in EMU rarely falls on a whole twip. WordCraft laid it out at its exact EMU height, so at the foot of a page a picture could move on where Word keeps it.
How Word does it. Word keeps a picture's height in whole twips and drops the rest of the EMUs: 2661310 EMU (209.552 pt) is drawn 209.55 pt high, and at the foot of a page only that has to fit above the bottom margin. Measured in Word for Mac with a synthetic document: a picture of 14170.998 twips stays on the page where one of 14171 twips moves on, at single and at 1.5 spacing.
What changes. The inline picture's height is cut to whole twips before the line is measured (
crates/layout/src/para/paragraph.rs).Tests.
a_picture_is_as_high_as_its_whole_twips_and_fits_by_them_at_the_page_bottomfails onmainwithout the change.cargo test -p wordcraft-layout --libpasses except the three hyphenation and hidden-text tests that fail onmainhere too without the dictionaries;cargo fmt --all -- --checkandcargo clippy -p wordcraft-layout --all-targets -- -D warningsare clean. A row indocs/layout-parity.md.Summary by CodeRabbit