Method: Axlsx::Styles#parse_font_options
- Defined in:
- lib/axlsx/stylesheet/styles.rb
#parse_font_options(options = {}) ⇒ Font|Integer
Note:
noop if none of the options described here are set on the options parameter.
parses add_style options for fonts. If the options hash contains :type => :dxf we return a new Font object. if not, we return the index of the newly created font object in the styles.fonts collection.
325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/axlsx/stylesheet/styles.rb', line 325 def ( = {}) return if (.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty? Axlsx.instance_values_for(fonts.first).each do |key, value| # Thanks for that 1.8.7 - cant do a simple merge... [key.to_sym] = value unless .keys.include?(key.to_sym) end font = Font.new() font.color = Color.new(:rgb => [:fg_color]) if [:fg_color] font.name = [:font_name] if [:font_name] [:type] == :dxf ? font : fonts << font end |