|
LMMS
|
#include <juce_Font.h>
Classes | |
| class | SharedFontInternal |
Public Types | |
| enum | FontStyleFlags { plain = 0 , bold = 1 , italic = 2 , underlined = 4 } |
Static Public Member Functions | |
| static const String & | getDefaultSansSerifFontName () |
| static const String & | getDefaultSerifFontName () |
| static const String & | getDefaultMonospacedFontName () |
| static const String & | getDefaultStyle () |
| static Typeface::Ptr | getDefaultTypefaceForFont (const Font &font) |
| static float | getDefaultMinimumHorizontalScaleFactor () noexcept |
| static void | setDefaultMinimumHorizontalScaleFactor (float newMinimumScaleFactor) noexcept |
| static void | findFonts (Array< Font > &results) |
| static StringArray | findAllTypefaceNames () |
| static StringArray | findAllTypefaceStyles (const String &family) |
| static const String & | getFallbackFontName () |
| static void | setFallbackFontName (const String &name) |
| static const String & | getFallbackFontStyle () |
| static void | setFallbackFontStyle (const String &style) |
| static Font | fromString (const String &fontDescription) |
Private Member Functions | |
| void | dupeInternalIfShared () |
| void | checkTypefaceSuitability () |
| float | getHeightToPointsFactor () const |
Static Private Member Functions | |
| static bool | compare (const Font &, const Font &) noexcept |
Private Attributes | |
| ReferenceCountedObjectPtr< SharedFontInternal > | font |
Friends | |
| struct | GraphicsFontHelpers |
Represents a particular font, including its size, style, etc.
Apart from the typeface to be used, a Font object also dictates whether the font is bold, italic, underlined, how big it is, and its kerning and horizontal scale factor.
@tags{Graphics}
| enum juce::Font::FontStyleFlags |
A combination of these values is used by the constructor to specify the style of font to use.
Creates a sans-serif font in a given size.
| fontHeight | the height in pixels (can be fractional) |
| styleFlags | the style to use - this can be a combination of the Font::bold, Font::italic and Font::underlined, or just Font::plain for the normal style. |
Creates a font with a given typeface and parameters.
| typefaceName | the font family of the typeface to use |
| fontHeight | the height in pixels (can be fractional) |
| styleFlags | the style to use - this can be a combination of the Font::bold, Font::italic and Font::underlined, or just Font::plain for the normal style. |
Creates a font with a given typeface and parameters.
| typefaceName | the font family of the typeface to use |
| typefaceStyle | the font style of the typeface to use |
| fontHeight | the height in pixels (can be fractional) |
| juce::Font::Font | ( | const Typeface::Ptr & | typeface | ) |
Creates a font for a typeface.
| juce::Font::Font | ( | ) |
Creates a basic sans-serif font at a default height.
You should use one of the other constructors for creating a font that you're planning on drawing with - this constructor is here to help initialise objects before changing the font's settings later.
|
noexcept |
Move constructor
|
defaultnoexcept |
Destructor.
| Font juce::Font::boldened | ( | ) | const |
Returns a copy of this font with the bold attribute set. If the font does not have a bold version, this will return the default font.
|
private |
|
private |
|
static |
Returns a list of all the available typeface font families.
The names returned can be passed into setTypefaceName().
You can use this instead of findFonts() if you only need their font family names, and not font objects.
|
static |
Returns a list of all the available typeface font styles.
The names returned can be passed into setTypefaceStyle().
You can use this instead of findFonts() if you only need their styles, and not font objects.
Recreates a font from its stringified encoding. This method takes a string that was created by toString(), and recreates the original font.
| float juce::Font::getAscent | ( | ) | const |
Returns the height of the font above its baseline, in pixels. This is the maximum height from the baseline to the top.
| float juce::Font::getAscentInPoints | ( | ) | const |
Returns the height of the font above its baseline, in points. This is the maximum height from the baseline to the top.
| StringArray juce::Font::getAvailableStyles | ( | ) | const |
Returns a list of the styles that this font can use.
|
staticnoexcept |
Returns the minimum horizontal scale to which fonts may be squashed when trying to create a layout.
Returns a typeface font family that represents the default monospaced font.
Note that this method just returns a generic placeholder string that means "the default monospaced font" - it's not the actual font family of this font.
Returns a typeface font family that represents the default sans-serif font.
This is also the typeface that will be used when a font is created without specifying any typeface details.
Note that this method just returns a generic placeholder string that means "the default sans-serif font" - it's not the actual font family of this font.
Returns a typeface font family that represents the default serif font.
Note that this method just returns a generic placeholder string that means "the default serif font" - it's not the actual font family of this font.
Returns a font style name that represents the default style.
Note that this method just returns a generic placeholder string that means "the default font style" - it's not the actual name of the font style of any particular font.
|
static |
Returns the default system typeface for the given font.
| float juce::Font::getDescent | ( | ) | const |
Returns the amount that the font descends below its baseline, in pixels. This is calculated as (getHeight() - getAscent()).
| float juce::Font::getDescentInPoints | ( | ) | const |
Returns the amount that the font descends below its baseline, in points. This is calculated as (getHeight() - getAscent()).
|
noexcept |
Returns the font's kerning.
This is the extra space added between adjacent characters, as a proportion of the font's height.
A value of zero is normal spacing, positive values will spread the letters out more, and negative values make them closer together.
Returns the font family of the typeface to be used for rendering glyphs that aren't found in the requested typeface.
Returns the font style of the typeface to be used for rendering glyphs that aren't found in the requested typeface.
| void juce::Font::getGlyphPositions | ( | const String & | text, |
| Array< int > & | glyphs, | ||
| Array< float > & | xOffsets ) const |
Returns the series of glyph numbers and their x offsets needed to represent a string.
An extra x offset is added at the end of the run, to indicate where the right hand edge of the last character is.
|
noexcept |
Returns the total height of this font, in pixels. This is the maximum height, from the top of the ascent to the bottom of the descenders.
| float juce::Font::getHeightInPoints | ( | ) | const |
Returns the total height of this font, in points. This is the maximum height, from the top of the ascent to the bottom of the descenders.
|
private |
|
noexcept |
Returns the font's horizontal scale. A value of 1.0 is the normal scale, less than this will be narrower, greater than 1.0 will be stretched out.
Returns the total width of a string as it would be drawn using this font. For a more accurate floating-point result, use getStringWidthFloat().
Returns the total width of a string as it would be drawn using this font.
|
noexcept |
Returns the font's style flags. This will return a bitwise-or'ed combination of values from the FontStyleFlags enum, to describe whether the font is bold, italic, etc.
| Typeface * juce::Font::getTypeface | ( | ) | const |
Returns the typeface used by this font.
Note that the object returned may go out of scope if this font is deleted or has its style changed.
|
noexcept |
Returns the font family of the typeface that this font uses.
e.g. "Arial", "Courier", etc.
This may also be set to Font::getDefaultSansSerifFontName(), Font::getDefaultSerifFontName(), or Font::getDefaultMonospacedFontName(), which are not actual platform-specific font family names, but are generic font family names that are used to represent the various default fonts.
If you need to know the exact typeface font family being used, you can call Font::getTypefacePtr()->getName(), which will give you the platform-specific font family.
| Typeface::Ptr juce::Font::getTypefacePtr | ( | ) | const |
Returns the typeface used by this font.
|
noexcept |
Returns the font style of the typeface that this font uses.
|
noexcept |
Returns true if the font is bold.
|
noexcept |
Returns true if the font is italic.
|
noexcept |
Returns true if the font is underlined.
| Font juce::Font::italicised | ( | ) | const |
Returns a copy of this font with the italic attribute set.
| void juce::Font::setBold | ( | bool | shouldBeBold | ) |
Makes the font bold or non-bold.
|
staticnoexcept |
Sets the minimum horizontal scale to which fonts may be squashed when trying to create a text layout.
| void juce::Font::setExtraKerningFactor | ( | float | extraKerning | ) |
Changes the font's kerning.
| extraKerning | a multiple of the font's height that will be added to space between the characters. So a value of zero is normal spacing, positive values spread the letters out, negative values make them closer together. |
Sets the (platform-specific) font family of the typeface to use to find glyphs that aren't available in whatever font you're trying to use.
Sets the (platform-specific) font style of the typeface to use to find glyphs that aren't available in whatever font you're trying to use.
| void juce::Font::setHeight | ( | float | newHeight | ) |
Changes the font's height.
| void juce::Font::setHeightWithoutChangingWidth | ( | float | newHeight | ) |
Changes the font's height without changing its width. This alters the horizontal scale to compensate for the change in height.
| void juce::Font::setHorizontalScale | ( | float | scaleFactor | ) |
Changes the font's horizontal scale factor.
| scaleFactor | a value of 1.0 is the normal scale, less than this will be narrower, greater than 1.0 will be stretched out. |
| void juce::Font::setItalic | ( | bool | shouldBeItalic | ) |
Makes the font italic or non-italic.
| void juce::Font::setSizeAndStyle | ( | float | newHeight, |
| const String & | newStyle, | ||
| float | newHorizontalScale, | ||
| float | newKerningAmount ) |
Changes all the font's characteristics with one call.
| void juce::Font::setSizeAndStyle | ( | float | newHeight, |
| int | newStyleFlags, | ||
| float | newHorizontalScale, | ||
| float | newKerningAmount ) |
Changes all the font's characteristics with one call.
Changes the font's style.
| newFlags | a bitwise-or'ed combination of values from the FontStyleFlags enum. |
Changes the font family of the typeface.
e.g. "Arial", "Courier", etc.
This may also be set to Font::getDefaultSansSerifFontName(), Font::getDefaultSerifFontName(), or Font::getDefaultMonospacedFontName(), which are not actual platform-specific font family names, but are generic font family names that are used to represent the various default fonts. If you need to know the exact typeface font family being used, you can call Font::getTypefacePtr()->getName(), which will give you the platform-specific font family.
If a suitable font isn't found on the machine, it'll just use a default instead.
Changes the font style of the typeface.
| void juce::Font::setUnderline | ( | bool | shouldBeUnderlined | ) |
Makes the font underlined or non-underlined.
| String juce::Font::toString | ( | ) | const |
Creates a string to describe this font. The string will contain information to describe the font's typeface, size, and style. To recreate the font from this string, use fromString().
| Font juce::Font::withExtraKerningFactor | ( | float | extraKerning | ) | const |
Returns a copy of this font with a new kerning factor.
| extraKerning | a multiple of the font's height that will be added to space between the characters. So a value of zero is normal spacing, positive values spread the letters out, negative values make them closer together. |
| Font juce::Font::withHeight | ( | float | height | ) | const |
Returns a copy of this font with a new height.
| Font juce::Font::withHorizontalScale | ( | float | scaleFactor | ) | const |
Returns a copy of this font with a new horizontal scale.
| scaleFactor | a value of 1.0 is the normal scale, less than this will be narrower, greater than 1.0 will be stretched out. |
| Font juce::Font::withPointHeight | ( | float | heightInPoints | ) | const |
Returns a copy of this font with a new height, specified in points.
Returns a copy of this font with the given set of style flags.
| styleFlags | a bitwise-or'ed combination of values from the FontStyleFlags enum. |
Returns a copy of this font with a new typeface style.
|
friend |
|
private |