Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::svg::FontLoader Class Reference

Helper to load a font from a URI, using a ResourceLoaderInterface to fetch the raw data and then parsing it as a WOFF file. More...

#include "donner/svg/resources/FontLoader.h"

Public Member Functions

 FontLoader (ResourceLoaderInterface &loader)
 
std::variant< components::FontResource, UrlLoaderErrorfromUri (const RcString &uri)
 Load a font from a URI.
 
std::variant< components::FontResource, UrlLoaderErrorfromData (std::span< const uint8_t > data)
 Load a font from raw data.
 

Detailed Description

Helper to load a font from a URI, using a ResourceLoaderInterface to fetch the raw data and then parsing it as a WOFF file.

Constructor & Destructor Documentation

◆ FontLoader()

donner::svg::FontLoader::FontLoader ( ResourceLoaderInterface & loader)
explicit
Parameters
loaderThe user-provided resource loader to fetch the URI.

Member Function Documentation

◆ fromData()

std::variant< components::FontResource, UrlLoaderError > donner::svg::FontLoader::fromData ( std::span< const uint8_t > data)

Load a font from raw data.

Parameters
dataThe raw data to load.
Returns
The loaded font resource, or an error if loading failed.

◆ fromUri()

std::variant< components::FontResource, UrlLoaderError > donner::svg::FontLoader::fromUri ( const RcString & uri)

Load a font from a URI.

Parameters
uriThe URI to load, which can be a file path or a data URI.
Returns
The loaded font resource, or an error if loading failed.

The documentation for this class was generated from the following files: