Class: Prawn::Blank::TextStyle
- Inherits:
-
Core::LiteralString
- Object
- Core::LiteralString
- Prawn::Blank::TextStyle
- Defined in:
- lib/prawn/blank/text_style.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#font ⇒ Object
readonly
Returns the value of attribute font.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #color_cmd(color) ⇒ Object
-
#initialize(document, font, size, color, font_subset = 0) ⇒ TextStyle
constructor
A new instance of TextStyle.
Constructor Details
#initialize(document, font, size, color, font_subset = 0) ⇒ TextStyle
Returns a new instance of TextStyle.
7 8 9 10 11 12 13 14 |
# File 'lib/prawn/blank/text_style.rb', line 7 def initialize(document, font,size,color,font_subset=0) @font = font @font_subset = font_subset @size = size @color = color @color = [@color] unless color.kind_of? Array super("/#{document.font(font).identifier_for(font_subset)} #{size} Tf #{document.send(:color_to_s,*@color)} #{color_cmd(@color)}") end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
5 6 7 |
# File 'lib/prawn/blank/text_style.rb', line 5 def color @color end |
#font ⇒ Object (readonly)
Returns the value of attribute font.
5 6 7 |
# File 'lib/prawn/blank/text_style.rb', line 5 def font @font end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
5 6 7 |
# File 'lib/prawn/blank/text_style.rb', line 5 def size @size end |
Instance Method Details
#color_cmd(color) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/prawn/blank/text_style.rb', line 16 def color_cmd(color) if color[0].kind_of? String return 'rg' else return 'k' end end |