v0.6.0 BigUpdate
This commit is contained in:
@@ -142,9 +142,13 @@ class Image(Renderable, RequiresNumbering):
|
||||
need = Length(int(height) + int(caption_reserve))
|
||||
remaining = layout_state.remaining_page_height
|
||||
if remaining < need:
|
||||
if self.landscape:
|
||||
# Already on a fresh landscape section — shrink instead of soft page-break
|
||||
# (soft break + section break = empty landscape page before the figure).
|
||||
at_top_of_landscape = (
|
||||
self.landscape and layout_state.current_page_height == 0
|
||||
)
|
||||
if at_top_of_landscape:
|
||||
# Too tall for a whole landscape page. Shrink here: a soft break
|
||||
# on this fresh section used to stack with the section break and
|
||||
# leave an empty page before the figure.
|
||||
avail = Length(max(0, int(remaining) - int(caption_reserve)))
|
||||
if avail > 0 and self._image.height > avail:
|
||||
ratio = int(avail) / int(self._image.height)
|
||||
@@ -152,6 +156,9 @@ class Image(Renderable, RequiresNumbering):
|
||||
self._image.width = Length(int(self._image.width * ratio))
|
||||
height = self._image.height
|
||||
else:
|
||||
# Does not fit the leftover of the current page (including a
|
||||
# second landscape figure after the first). Keep the fitted size
|
||||
# and let Word move it; do not squash it into the gap.
|
||||
height = Length(int(height) + int(remaining))
|
||||
|
||||
yield (rendered_image := RenderedInfo(self._docx_paragraph, Length(height)))
|
||||
|
||||
Reference in New Issue
Block a user