NAME

Text::Amuse::Compile::Webfonts - Class to parse and validate webfonts for Text::Amuse::Compile

SYNOPSIS

This class only takes a single parameter, with the directory where to find the fonts. Anyway, the content of the directory is very specific.

The class expects to find 4 fonts, a regular, an italic, a bold and a bold italic one. Given that the names are arbitrary, we need an hint. For this you have to provide a file, in the very same directory, with the specifications. The file must be named spec.txt and need the following content:

E.g., for Droid fonts:

  family Droid Serif
  regular DroidSerif-Regular.ttf
  italic DroidSerif-Italic.ttf
  bold DroidSerif-Bold.ttf
  bolditalic DroidSerif-Bold.ttf
  size 10

The four TTF files must be placed in this directory as well. The formats supported are TTF, OTF and WOFF.

The family and size specs are optional.

CONSTRUCTOR OPTIONS

new (webfontsdir => "./webfonts")

webfontsdir

The directory where to find the files and the specification file. If the class can't find valid data, the new method will return nothing and emit warnings.

ACCESSORS

Every accessor here is read only.

srcdir

The absolute path to the fonts.

regular

The filename of the regular font.

bold

The filename of the bold font.

italic

The filename of the italic font.

bolditalic

The filename of the bolditalic font.

family

The family name.

mimetype

The mimetype of the fonts.

size

The size of the fonts in pt to be used on display.

format

The format to feed the src description in the CSS.

files

Return an hash with where the keys are the filenames without the path, and the value the full absolute path to the files.