diff --git a/lib/prawn/table/cell/text.rb b/lib/prawn/table/cell/text.rb index ff287898..59254e76 100644 --- a/lib/prawn/table/cell/text.rb +++ b/lib/prawn/table/cell/text.rb @@ -44,6 +44,11 @@ def font_style=(style) @text_options[:style] = style end + # Set the font size + def font_size=(size) + @text_options[:size] = size + end + # Returns the width of this text with no wrapping. This will be far off # from the final width if the text is long. # diff --git a/spec/table/cell/text_spec.rb b/spec/table/cell/text_spec.rb new file mode 100644 index 00000000..814e674e --- /dev/null +++ b/spec/table/cell/text_spec.rb @@ -0,0 +1,19 @@ +# encoding: utf-8 + +require File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "spec_helper") +require 'set' + +describe Prawn::Table::Cell::Text do + let(:pdf) { Prawn::Document.new } + let(:data) { "Text data" } + let(:options) { { :font_size => 12 } } + let(:cell) { Prawn::Table::Cell::Text.new(pdf, [0, 0], :content => data, :text_options => options) } + + describe "#font_size=" do + it "sets the font size in the text options" do + new_font_size = 10 + cell.font_size = new_font_size + expect(cell.instance_variable_get("@text_options")[:size]).to eq(new_font_size) + end + end +end