16 const std::string &name,
23 if (cache && (cache->font() != font)) {
26 std::lock_guard<duds::general::Spinlock> lock(
block);
31 const std::string &name,
38 if (cache && (cache->font() != font)) {
41 std::lock_guard<duds::general::Spinlock> lock(
block);
46 const std::string &name,
52 std::lock_guard<duds::general::Spinlock> lock(
block);
57 const std::string &name,
58 const std::string &fontpath
62 std::lock_guard<duds::general::Spinlock> lock(
block);
67 const std::string &name,
76 std::lock_guard<duds::general::Spinlock> lock(
block);
81 const std::string &name,
82 const std::string &fontpath
87 std::lock_guard<duds::general::Spinlock> lock(
block);
92 const std::string &existing,
93 const std::string &newname
95 std::lock_guard<duds::general::Spinlock> lock(
block);
96 std::unordered_map<std::string, FontAndCache>::const_iterator iter =
98 if (iter ==
fonts.cend()) {
105 std::lock_guard<duds::general::Spinlock> lock(
block);
106 std::unordered_map<std::string, FontAndCache>::const_iterator iter =
108 if (iter ==
fonts.cend()) {
111 return iter->second.fnt;
115 std::lock_guard<duds::general::Spinlock> lock(
block);
116 std::unordered_map<std::string, FontAndCache>::const_iterator iter =
118 if (iter ==
fonts.cend()) {
121 return iter->second.sc;
125 std::lock_guard<duds::general::Spinlock> lock(
block);
126 std::unordered_map<std::string, FontAndCache>::const_iterator iter =
128 if (iter ==
fonts.cend()) {
std::shared_ptr< BppStringCache > BppStringCacheSptr
A std::shared_ptr to a BppStringCache object.
std::shared_ptr< BppFont > BppFontSptr
void addWithoutCache(const std::string &name, const BppFontSptr &font)
Adds an existing font without a corresponding string cache.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
void alias(const std::string &existing, const std::string &newname)
Adds a new name for an already added font.
BppFontSptr getFont(const std::string &font) const
Returns a shared pointer to a stored font, or an empty shared pointer if the font is not present...
A specified font is not present in the font pool.
A given string cache does not correspond to the given font.
void getFc(FontAndCache &fc, const std::string &font) const
An internal function to get a FontAndCache struct for the given font.
std::unordered_map< std::string, FontAndCache > fonts
The glyph images keyed by character.
static std::shared_ptr< BppFont > make()
Returns a shared pointer to a new BppFont object.
void addWithCache(const std::string &name, const BppFontSptr &font)
Adds an existing font along with a newly created corresponding string cache.
duds::general::Spinlock block
Used for thread safety.
Internal struct to hold a font and its string cache.
void add(const std::string &name, const BppFontSptr &font, const BppStringCacheSptr &cache)
Adds an existing font and string cache pair to the pool.
General graphics related code.
boost::error_info< struct Info_FontName, std::string > FontName
The name of the font and is not present in the font pool.
static std::shared_ptr< BppStringCache > make(const BppFontSptr &font, unsigned int maxBytes=256 *1024, unsigned int maxStrings=-1)
Creates a cache of rendered strings made using the given font.
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
BppStringCacheSptr getStringCache(const std::string &font) const
Returns a shared pointer to a string cache, or an empty shared pointer if the font is not present...