View on GitHub

CSS-Properties-raku

CSS property-list manipulation library

[Raku CSS Project] / [CSS-Properties Module] / CSS::Font :: Pattern

class CSS::Font::Pattern

Implements CSS Font Patterns and Matching

Synopsis

my CSS::Font $font .= new: :font-props("italic bold condensed 10pt/12pt times-roman);
my CSS::Stylesheet:D $css .= parse('style.css'.IO.slurp);
my CSS::Font::Descriptor @font-face = $css.font-face;
my CSS::Font::Pattern $patt = $font.pattern;
my  CSS::Font::Descriptor @matches = $patt.match(@font-face);
say @matches.first.Str;

Description

Implements CSS font matching for a font against CSS::Font::Descriptor @font-face rules.

See Font Matching Algorithm

Methods

match

method match(CSS::Font::Descriptor @font-face) returns Array[CSS::Font::Descriptor]

Reduces a list of font descriptors to matching fonts, ordered by preference.