This module is mixed into classes that can have styles.
# File lib/rvg/stylable.rb, line 69 def initialize super @styles = Styles.new end
This method can be used with any RVG, Group, Use, Text, or shape object. The argument is a hash. The style names are the hash keys. The style names and values are:
modify the text baseline
clipping path defined by clip_path
'evenodd' or 'nozero'
color name
the fill opacity, 0.0<=N<=1.0
'evenodd' or 'nozero'
font name or font file name
font family name, ex. 'serif'
font size in points
'normal','ultra_condensed','extra_condensed', 'condensed','semi_condensed','semi_expanded', 'expanded','extra_expanded','ultra_expanded'
'normal','italic','oblique'
'normal','bold','bolder','lighter', or a multiple of 100 between 100 and 900.
0, 90, 180, 270
0, 90, 180, 270
modify the spacing between letters
both fill and stroke opacity, 0.0<=N<=1.0
color name
dash pattern (Array)
initial distance into dash pattern
'butt', 'round', 'square'
'miter', 'round', 'bevel'
miter length constraint
the stroke opacity, 0.0<=N<=1.0
stroke width
'start','middle','end'
'none','underline','overline','line_through'
modify the spacing between words
'lr-tb', 'lr', 'rt-tb', 'rl', 'tb-rl', 'tb'
# File lib/rvg/stylable.rb, line 110 def styles(styles) @styles.set(styles) yield(self) if block_given? self end
For each style that has a value, add a style primitive to the gc. Use splat to splat out Array arguments such as stroke_dasharray.
# File lib/rvg/stylable.rb, line 59 def add_style_primitives(gc) @styles.each_value do |style, value| if value.respond_to? :add_primitives value.add_primitives(gc, style) else gc.__send__(style, *value) end end end