View on GitHub


CSS `@font-face` driven Font Selection and Loading

[Raku CSS Project] / [CSS-Font-Resources] / CSS::Font :: Resources

class CSS::Font::Resources

Lightweight CSS Font Resource Manager


This is lightweight font resource manager, driven by CSS @font-face font descriptors.


method match

method match(
    @font-face =
) 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,
) returns Mu

Return sources for matching fonts

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.