Class: Prawn::Blank::TextStyle

Inherits:
Core::LiteralString
  • Object
show all
Defined in:
lib/prawn/blank/text_style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorObject (readonly)

Returns the value of attribute color.



5
6
7
# File 'lib/prawn/blank/text_style.rb', line 5

def color
  @color
end

#fontObject (readonly)

Returns the value of attribute font.



5
6
7
# File 'lib/prawn/blank/text_style.rb', line 5

def font
  @font
end

#sizeObject (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