From 0d11ae87774bcd9a4f89a403c06c03408795b7af Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Fri, 22 Jul 2011 13:12:06 -0400 Subject: [PATCH] Make sure that the first line of a paragraph is never by itself at the bottom of a page --- lib/mixins/text.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mixins/text.coffee b/lib/mixins/text.coffee index 0aa3029..6f3b360 100644 --- a/lib/mixins/text.coffee +++ b/lib/mixins/text.coffee @@ -221,8 +221,10 @@ module.exports = # we're no longer on the first line... wrap.firstLine = false - # if we've reached the maximum height provided - if @y > maxY + # if we've reached the maximum height and make sure + # that the first line of a paragraph is never by itself + # at the bottom of a page + if @y > maxY or (wrap.lastLine and @y + @currentLineHeight(true) > maxY) return unless @y >= @page.maxY() # if we've reached the edge of the page,