Module: SassFontimage::SassExtensions::Functions

Included in:
Sass::Script::Functions
Defined in:
lib/sass_fontimage/sass_extensions/functions.rb

Overview

The actual sass extension

It has two configuration parameters that can be passed with the SASS custom configuration parameters.

:font_image_location is the base path to write the generated images to :font_image_url is the base url for the directory where all font images reside, by default it’s relative to the :css_location path of SASS.

Instance Method Summary collapse

Instance Method Details

#font_image(char, size, color, font) ⇒ Object

Actually generate the font image

Parameters:

  • char (String)

    The character to generate

  • size (Size)

    Size in pixels (can be css value like 16px)

  • color (Color)

    Color in hex, rgba

  • font (String)

    Path to font within configuration root



16
17
18
19
20
21
# File 'lib/sass_fontimage/sass_extensions/functions.rb', line 16

def font_image(char, size, color, font)
  generator = SassFontimage::SassExtensions::FontImageGenerator.get(font, self)
  image_url = generator.generate(char, size, color)
  
  Sass::Script::String.new("url(#{image_url})")
end