File Methods
Custom file methods. Available on all files using Fountain templates.
The value of a font weight, eg. 400 for regular or 600 for semi-bold. Applies to the static-file and ’static-webfont` template.
| Returns |
string |
| Templates |
static-font, static-webfont
|
| Returns |
string |
| Templates |
static-font, static-webfont, variable-font, variable-webfont
|
Returns CSS @font-face {} for webfont. Alternative param for using family name instead of file name.
$file->getFontFace( true );
| Parameter |
Type |
Info |
$familyName |
Bool |
Use family name for webfont |
| Returns |
string |
| Templates |
static-webfont, variable-webfont
|
A full <link rel=“”… for the font.
$file->getLinkRel( [ 'rel' => 'preload' ] );
| Parameter |
Type |
Info |
$attr |
Array |
An associative array with additional attributes for the tag. |
| Returns |
string |
| Templates |
static-webfont, variable-webfont
|
Returns the correct WOFF2 file. Works if it’s a OTF/TFF font as well.
$file->getWebfont();
| Returns |
Kirby\Cms\File |
| Templates |
static-font, variable-font,static-webfont, variable-webfont
|