1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added method: Font::withTypefaceStyle().

This commit is contained in:
jules 2012-07-03 14:39:00 +01:00
parent 705de64237
commit b6211f01c8
2 changed files with 18 additions and 10 deletions

View file

@ -384,6 +384,13 @@ void Font::setTypefaceStyle (const String& typefaceStyle)
}
}
Font Font::withTypefaceStyle (const String& newStyle) const
{
Font f (*this);
f.setTypefaceStyle (newStyle);
return f;
}
StringArray Font::getAvailableStyles() const
{
return findAllTypefaceStyles (getTypeface()->getName());

View file

@ -149,20 +149,21 @@ public:
const String& getTypefaceName() const noexcept;
//==============================================================================
/** Changes the font style of the typeface
e.g. "Regular", "Italic", etc.
*/
void setTypefaceStyle (const String& typefaceStyle);
/** Returns the font style of the typeface that this font uses.
e.g. "Regular", "Italic", etc.
@see withTypefaceStyle, getAvailableStyles()
*/
const String& getTypefaceStyle() const noexcept;
/** Changes the font style of the typeface.
@see getAvailableStyles()
*/
void setTypefaceStyle (const String& newStyle);
/** Returns a copy of this font with a new typeface style.
@see getAvailableStyles()
*/
Font withTypefaceStyle (const String& newStyle) const;
/** Returns a list of the styles that this font can use. */
StringArray getAvailableStyles() const;