[Raku CSS Project] / [CSS-Font-Resources] / CSS::Font :: Resources
class CSS::Font::Resources
Lightweight CSS Font Resource Manager
Description
This is lightweight font resource manager, driven by CSS @font-face font descriptors.
Methods
method match
method match(
@font-face = Code.new
) returns Mu
Return only matching font-descriptors
These are matched and ordered by preference, using the W3C Font Matching Algorithm.
multi method sources
multi method sources(
Bool :$fallback = Bool::True,
|c
) returns Mu
Return sources for matching fonts
-
Fonts are first matched using the
match()method [above] -
This list is then flattened to CSS::Font::Resources::Source::Local and CSS::Font::Resources::Source::Url for
localandurlfont references in the font descriptor’s list ofsrcreferences. -
Fallback local references are also appended for the font’s font-family list.
These matches are ordered by user preference. The fonts themselves can be fetched using the .IO or .Str or Blob methods on the first matching font.