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.
280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/axlsx/stylesheet/styles.rb', line 280 def (={}) return if (.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty? fonts.first.instance_values.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 |