2097: def start_new_page(force = false)
2098: page_required = true
2099:
2100: if @columns_on
2101:
2102:
2103: @columns[:current] += 1
2104:
2105: if @columns[:current] <= @columns[:size] and not force
2106: page_required = false
2107: @columns[:bot_y] = @y if @y < @columns[:bot_y]
2108: else
2109: @columns[:current] = 1
2110: @top_margin = @columns[:top]
2111: @columns[:bot_y] = absolute_top_margin
2112: end
2113:
2114: w = @columns[:width]
2115: g = @columns[:gutter]
2116: n = @columns[:current] - 1
2117: @left_margin = @columns[:left] + n * (g + w)
2118: @right_margin = @page_width - (@left_margin + w)
2119: end
2120:
2121: if page_required or force
2122:
2123: @y = absolute_top_margin
2124:
2125: if @insert_mode
2126: id = new_page(true, @insert_page, @insert_position)
2127: @pageset << id
2128:
2129:
2130: @insert_page = id
2131: @insert_position = :after
2132: else
2133: @pageset << new_page
2134: end
2135:
2136: else
2137: @y = absolute_top_margin
2138: end
2139: @pageset
2140: end