mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-01 03:10:06 +00:00
Added a Typeface::clearTypefaceCache() method.
This commit is contained in:
parent
25303b158a
commit
eeeaf832d5
3 changed files with 18 additions and 1 deletions
|
|
@ -61,6 +61,11 @@ public:
|
|||
faces.insertMultiple (-1, CachedFace(), numToCache);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
setSize (faces.size());
|
||||
}
|
||||
|
||||
Typeface::Ptr findTypefaceFor (const Font& font)
|
||||
{
|
||||
const String faceName (font.getTypefaceName());
|
||||
|
|
@ -151,6 +156,11 @@ void Typeface::setTypefaceCacheSize (int numFontsToCache)
|
|||
TypefaceCache::getInstance()->setSize (numFontsToCache);
|
||||
}
|
||||
|
||||
void Typeface::clearTypefaceCache()
|
||||
{
|
||||
TypefaceCache::getInstance()->clear();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class Font::SharedFontInternal : public ReferenceCountedObject
|
||||
{
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ public:
|
|||
/** Changes the number of fonts that are cached in memory. */
|
||||
static void setTypefaceCacheSize (int numFontsToCache);
|
||||
|
||||
/** Clears any fonts that are currently cached in memory. */
|
||||
static void clearTypefaceCache();
|
||||
|
||||
protected:
|
||||
//==============================================================================
|
||||
String name, style;
|
||||
|
|
|
|||
|
|
@ -322,7 +322,11 @@ const Typeface::Ptr LookAndFeel::getTypefaceForFont (const Font& font)
|
|||
|
||||
void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
|
||||
{
|
||||
defaultSans = newName;
|
||||
if (defaultSans != newName)
|
||||
{
|
||||
Typeface::clearTypefaceCache()
|
||||
defaultSans = newName;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue