Method: PSD::TypeTool#to_css

Defined in:
lib/psd/layer_info/typetool.rb

#to_cssObject

Creates the CSS string and returns it. Each property is newline separated and not all properties may be present depending on the document.

Colors are returned in rgba() format and fonts may include some internal Photoshop fonts.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/psd/layer_info/typetool.rb', line 124

def to_css      
  definition = {
    'font-family' => fonts.join(', '),
    'font-size' => "#{sizes.first}pt",
    'color' => "rgba(#{colors.first.join(', ')})"
  }

  css = []
  definition.each do |k, v|
    css << "#{k}: #{v};"
  end

  css.join("\n")
end