Url

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

class CSS::Font::Resources::Source::Url

URL source references

Description This class is used to represent url source references.

The Str method returns the serialized url.

The IO and Blob methods resolve the font using:

  • The LWP::Simple module for http and https URI schemes

  • Local file system for file and default URI schemes.

Methods This class inherits from CSS::Font::Resources::Source and has its method available, including font-descriptor, format, IO and Blob.

head3 url

use URL
method url returns URI

The source URI. If the src url is relative (doesn't have a scheme), an absolute URI is computed, by calling 'rel2abs()', on the font resource base-url. For example:

use CSS::Font::Descriptor;
use CSS::Font::Resources;
use CSS::Font::Resources::Source;
my CSS::Font::Descriptor @font-face;
@font-face.push: CSS::Font::Descriptor.new: :font-family("Times"), :src<url("fonts/TimesRoman.ttf")>;
my $font = "12pt times";
my CSS::Font::Resources $fonts .= new: :$font, :@font-face, :base-url</myfonts>;
my CSS::Font::Resources::Source @sources = $fonts.sources;
say @sources.head.url; # /myfonts/fonts/TimesRoman.ttf

CSS::Font::Resources v0.0.9

CSS Font Resource selection and loading

Authors

  • David Warring

License

Artistic-2.0

Dependencies

CSS::Properties:ver<0.7.5+>Temp::PathLWP::SimpleURI:ver<0.3.3+>

Test Dependencies

Provides

  • CSS::Font::Resources
  • CSS::Font::Resources::Source
  • CSS::Font::Resources::Source::Local
  • CSS::Font::Resources::Source::Url
  • CSS::URI

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.