Class: EideticRML::Styles::BulletStyle
- Includes:
- HasWidth
- Defined in:
- lib/erml_styles.rb
Instance Method Summary collapse
- #apply(writer) ⇒ Object
- #font(value = nil) ⇒ Object
-
#initialize(styles, attrs = {}) ⇒ BulletStyle
constructor
A new instance of BulletStyle.
- #text(value = nil) ⇒ Object
Methods included from HasWidth
Methods inherited from Style
for_name, #from_points, #id, #initialize_copy, register
Methods included from EideticRML::Support
#from_units, parse_measurement, parse_measurement_pts, #to_units
Constructor Details
#initialize(styles, attrs = {}) ⇒ BulletStyle
Returns a new instance of BulletStyle.
184 185 186 187 |
# File 'lib/erml_styles.rb', line 184 def initialize(styles, attrs={}) @width, @units = 36, :pt super(styles, attrs) end |
Instance Method Details
#apply(writer) ⇒ Object
189 190 191 192 193 194 195 196 197 |
# File 'lib/erml_styles.rb', line 189 def apply(writer) unless writer.bullet(id) writer.bullet(id, :width => width) do |w| prev_font = w.font(@font.name, @font.size, :style => @font.style, :encoding => @font.encoding, :sub_type => @font.sub_type) w.print(text) w.font(prev_font) end end end |
#font(value = nil) ⇒ Object
199 200 201 202 203 204 |
# File 'lib/erml_styles.rb', line 199 def font(value=nil) return @font if value.nil? f = @styles.for_id(value) raise ArgumentError, "Font Style #{value} not found." unless f.is_a?(Styles::FontStyle) @font = f end |
#text(value = nil) ⇒ Object
206 207 208 209 |
# File 'lib/erml_styles.rb', line 206 def text(value=nil) return @text if value.nil? @text = value end |