Method: Writeexcel::Format#get_font_key

Defined in:
lib/writeexcel/format.rb

#get_font_keyObject

Returns a unique hash key for a font. Used by Workbook->_store_all_fonts()



405
406
407
408
409
410
411
412
413
# File 'lib/writeexcel/format.rb', line 405

def get_font_key  # :nodoc:
  # The following elements are arranged to increase the probability of
  # generating a unique key. Elements that hold a large range of numbers
  # e.g. _color are placed between two binary elements such as _italic

  key  = "#{@font}#{@size}#{@font_script}#{@underline}#{@font_strikeout}#{@bold}#{@font_outline}"
  key += "#{@font_family}#{@font_charset}#{@font_shadow}#{@color}#{@italic}#{@font_encoding}"
  key.gsub(' ', '_') # Convert the key to a single word
end