Rose
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
rose::FontCache Class Reference

Cache storage for requested fonts. More...

#include <Font.h>

Public Member Functions

template<typename StringType >
std::optional< std::filesystem::path > locateFont (const std::filesystem::path &path, StringType fontName)
 Locate a font file. More...
 
template<typename StringType >
std::optional< std::filesystem::path > getFontPath (StringType fontName)
 Find a font name in the font name cache. More...
 
template<typename StringType >
FontPointer getFont (StringType fontName, int ptSize)
 Get a FontPointer to a named Font of a specific point size. More...
 

Static Public Member Functions

static FontCachegetFontCache ()
 

Protected Attributes

std::vector< std::filesystem::path > mFontPathList {}
 
std::map< std::string, std::filesystem::path > mFontPathMap
 The font file path cache.
 
std::map< FontCacheKey, FontPointermFontCache
 The font cache.
 

Detailed Description

Cache storage for requested fonts.

Member Function Documentation

◆ getFont()

template<typename StringType >
FontPointer rose::FontCache::getFont ( StringType  fontName,
int  ptSize 
)
inline

Get a FontPointer to a named Font of a specific point size.

Template Parameters
StringTypethe type of the Font name passed in.
Parameters
fontNameThe requested font name.
ptSizeThe requested point size
Returns
a std::optional<FontPointer>

◆ getFontPath()

template<typename StringType >
std::optional<std::filesystem::path> rose::FontCache::getFontPath ( StringType  fontName)
inline

Find a font name in the font name cache.

Template Parameters
StringTypethe type of fontName
Parameters
fontNamethe Font name
Returns
a std::optional<std::filesystem::path> of the font file for the Font.

◆ locateFont()

template<typename StringType >
std::optional<std::filesystem::path> rose::FontCache::locateFont ( const std::filesystem::path &  path,
StringType  fontName 
)
inline

Locate a font file.

Template Parameters
StringTypethe type of fontName
Parameters
pathThe path to start search from
fontNamethe Font name.
Returns
a std::optional<std::filesystem::path> of the font file.

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