    # File lib/prawn/table/cell.rb, line 128
          def draw
            margin = @border_width / 2.0

            if @background_color
              @document.mask(:fill_color) do
                @document.fill_color @background_color
                h  = borders.include?(:bottom) ?
                  height - ( 2 * margin ) : height + margin
                @document.fill_rectangle [x, y ], width, h
              end
            end

            if @border_width > 0
              @document.mask(:line_width) do
                @document.line_width = @border_width

                @document.mask(:stroke_color) do
                  @document.stroke_color @border_color if @border_color

                  if borders.include?(:left)
                    @document.stroke_line [x, y + margin],
                      [x, y - height - margin ]
                  end

                  if borders.include?(:right)
                    @document.stroke_line(
                      [x + width, y + margin],
                      [x + width, y - height - margin] )
                  end

                  if borders.include?(:top)
                    @document.stroke_line(
                      [ x, y ],
                      [ x + width, y ])
                  end

                  if borders.include?(:bottom)
                    @document.stroke_line [x, y - height ],
                                        [x + width, y - height]
                  end
                end

              end

              borders

            end

            @document.bounding_box( [x + @horizontal_padding,
                                     y - @vertical_padding],
                                    :width   => text_area_width,
                                    :height  => height - @vertical_padding) do
              @document.move_down((@document.font.line_gap - @document.font.descender)/2)

              options = {:align => @align, :final_gap => false}

              options[:size] = @font_size if @font_size
              options[:style] = @font_style if @font_style

              @document.mask(:fill_color) do
                @document.fill_color @text_color if @text_color
                @document.text @text, options
              end
            end
          end