pub struct FontManager {
cache_dir: PathBuf,
client: Client,
}Expand description
Manages downloading and caching of custom TTF/OTF fonts.
Fields§
§cache_dir: PathBuf§client: ClientImplementations§
Source§impl FontManager
impl FontManager
pub fn new(cache_dir: Option<&Path>) -> Result<Self>
Sourcepub async fn prepare_fonts(&self, urls: &[String]) -> Result<PathBuf>
pub async fn prepare_fonts(&self, urls: &[String]) -> Result<PathBuf>
Takes a list of URLs (or local paths) and ensures they are available in the cache directory. Returns the path to the font cache directory.
fn is_remote(url: &str) -> bool
fn safe_file_name(source: &str) -> String
fn validate_font_size(content_length: Option<u64>, actual: usize) -> Result<()>
Auto Trait Implementations§
impl Freeze for FontManager
impl !RefUnwindSafe for FontManager
impl Send for FontManager
impl Sync for FontManager
impl Unpin for FontManager
impl !UnwindSafe for FontManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more