Loading...
Searching...
No Matches
Public Member Functions | List of all members
FontOptions Class Referencefinal

Options that describe a particular font. More...

#include <juce_FontOptions.h>

Public Member Functions

 FontOptions ()
 Constructs the default set of options.
 
 FontOptions (float fontHeight)
 Constructs the default set of options with a custom height.
 
 FontOptions (float fontHeight, int styleFlags)
 Constructs the default set of options with a custom height and style.
 
 FontOptions (const String &typefaceName, float fontHeight, int styleFlags)
 Constructs the default set of options with a given typeface and parameters.
 
 FontOptions (const String &typefaceName, const String &typefaceStyle, float fontHeight)
 Constructs the default set of options with a given typeface and parameters.
 
 FontOptions (const Typeface::Ptr &typeface)
 Constructs the default set of options with a given typeface.
 
FontOptions withName (String x) const
 Returns a copy of these options with a new typeface name.
 
FontOptions withStyle (String x) const
 Returns a copy of these options with a new typeface style.
 
FontOptions withTypeface (Typeface::Ptr x) const
 Returns a copy of these options with a new typeface.
 
FontOptions withFallbacks (std::vector< String > x) const
 Returns a copy of these options with a new set of preferred fallback family names.
 
FontOptions withFallbackEnabled (bool x=true) const
 Returns a copy of these options with font fallback enabled or disabled.
 
FontOptions withHeight (float x) const
 Returns a copy of these options with the specified height in JUCE units (can be fractional).
 
FontOptions withPointHeight (float x) const
 Returns a copy of these options with the specified height in points (can be fractional).
 
FontOptions withKerningFactor (float x) const
 Returns a copy of these options with the specified extra kerning factor (also called "tracking").
 
FontOptions withHorizontalScale (float x) const
 Returns a copy of these options with the specified horizontal scale factor, defaults to 1.0.
 
FontOptions withUnderline (bool x=true) const
 Returns a copy of these options with underline enabled or disabled, defaults to disabled.
 
FontOptions withMetricsKind (TypefaceMetricsKind x) const
 Returns a copy of these options the specified metrics kind.
 
auto getName () const
 
auto getStyle () const
 
auto getTypeface () const
 
auto getFallbacks () const
 
auto getHeight () const
 
auto getPointHeight () const
 
auto getKerningFactor () const
 
auto getHorizontalScale () const
 
auto getFallbackEnabled () const
 
auto getUnderline () const
 
auto getMetricsKind () const
 
bool operator== (const FontOptions &other) const
 Equality operator.
 
bool operator!= (const FontOptions &other) const
 Inequality operator.
 
bool operator< (const FontOptions &other) const
 Less-than operator.
 
bool operator<= (const FontOptions &other) const
 Less-than-or-equal operator.
 
bool operator> (const FontOptions &other) const
 Greater-than operator.
 
bool operator>= (const FontOptions &other) const
 Greater-than-or-equal operator.
 

Detailed Description

Options that describe a particular font.

Used to construct Font instances in a fluent style.

See also
Typeface, Font

Constructor & Destructor Documentation

◆ FontOptions() [1/6]

FontOptions::FontOptions ( )

Constructs the default set of options.

◆ FontOptions() [2/6]

FontOptions::FontOptions ( float fontHeight)
explicit

Constructs the default set of options with a custom height.

◆ FontOptions() [3/6]

FontOptions::FontOptions ( float fontHeight,
int styleFlags )

Constructs the default set of options with a custom height and style.

Parameters
fontHeightthe height in pixels (can be fractional)
styleFlagsthe 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.
See also
Font::FontStyleFlags, Font::getDefaultSansSerifFontName

◆ FontOptions() [4/6]

FontOptions::FontOptions ( const String & typefaceName,
float fontHeight,
int styleFlags )

Constructs the default set of options with a given typeface and parameters.

Parameters
typefaceNamethe font family of the typeface to use
fontHeightthe height in pixels (can be fractional)
styleFlagsthe 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.
See also
Font::FontStyleFlags, Font::getDefaultSansSerifFontName

◆ FontOptions() [5/6]

FontOptions::FontOptions ( const String & typefaceName,
const String & typefaceStyle,
float fontHeight )

Constructs the default set of options with a given typeface and parameters.

Parameters
typefaceNamethe font family of the typeface to use
typefaceStylethe font style of the typeface to use
fontHeightthe height in pixels (can be fractional)

◆ FontOptions() [6/6]

FontOptions::FontOptions ( const Typeface::Ptr & typeface)

Constructs the default set of options with a given typeface.

Member Function Documentation

◆ withName()

FontOptions FontOptions::withName ( String x) const

Returns a copy of these options with a new typeface name.

If the options include a non-null Typeface::Ptr, this will be ignored. Otherwise, a suitable typeface will be located based on the typeface name and style strings.

References jassertfalse, withMember(), and x.

◆ withStyle()

FontOptions FontOptions::withStyle ( String x) const

Returns a copy of these options with a new typeface style.

If the options include a non-null Typeface::Ptr, this will be ignored. Otherwise, a suitable typeface will be located based on the typeface name and style strings.

References jassertfalse, withMember(), and x.

◆ withTypeface()

FontOptions FontOptions::withTypeface ( Typeface::Ptr x) const

Returns a copy of these options with a new typeface.

If the typeface is non-null, it takes precedence over the name and style strings.

References jassert, name, withMember(), and x.

◆ withFallbacks()

FontOptions FontOptions::withFallbacks ( std::vector< String > x) const

Returns a copy of these options with a new set of preferred fallback family names.

References withMember(), and x.

◆ withFallbackEnabled()

FontOptions FontOptions::withFallbackEnabled ( bool x = true) const

Returns a copy of these options with font fallback enabled or disabled.

References withMember(), and x.

◆ withHeight()

FontOptions FontOptions::withHeight ( float x) const

Returns a copy of these options with the specified height in JUCE units (can be fractional).

FontOptions can hold either a JUCE height, set via withHeight(), or a point height, set via withPointHeight(). After calling withHeight(), the result of getPointHeight() will be -1.0f to indicate that the point height is unset.

For more information about how JUCE font heights work, see Font::setHeight().

References jassert, and x.

◆ withPointHeight()

FontOptions FontOptions::withPointHeight ( float x) const

Returns a copy of these options with the specified height in points (can be fractional).

After calling withPointHeight(), the result of getHeight() will be -1.0f to indicate that the JUCE height is unset.

For more information about how point heights work, see Font::setPointHeight().

References jassert, and x.

◆ withKerningFactor()

FontOptions FontOptions::withKerningFactor ( float x) const

Returns a copy of these options with the specified extra kerning factor (also called "tracking").

References withMember(), and x.

◆ withHorizontalScale()

FontOptions FontOptions::withHorizontalScale ( float x) const

Returns a copy of these options with the specified horizontal scale factor, defaults to 1.0.

References withMember(), and x.

◆ withUnderline()

FontOptions FontOptions::withUnderline ( bool x = true) const

Returns a copy of these options with underline enabled or disabled, defaults to disabled.

References withMember(), and x.

◆ withMetricsKind()

FontOptions FontOptions::withMetricsKind ( TypefaceMetricsKind x) const

Returns a copy of these options the specified metrics kind.

References withMember(), and x.

Referenced by LookAndFeel::withDefaultMetrics().

◆ getName()

auto FontOptions::getName ( ) const
See also
withName()

References name.

◆ getStyle()

auto FontOptions::getStyle ( ) const
See also
withStyle()

◆ getTypeface()

auto FontOptions::getTypeface ( ) const
See also
withTypeface()

◆ getFallbacks()

auto FontOptions::getFallbacks ( ) const
See also
withFallbacks()

◆ getHeight()

auto FontOptions::getHeight ( ) const
See also
withHeight()

◆ getPointHeight()

auto FontOptions::getPointHeight ( ) const

◆ getKerningFactor()

auto FontOptions::getKerningFactor ( ) const

◆ getHorizontalScale()

auto FontOptions::getHorizontalScale ( ) const

◆ getFallbackEnabled()

auto FontOptions::getFallbackEnabled ( ) const

◆ getUnderline()

auto FontOptions::getUnderline ( ) const
See also
withUnderline()

◆ getMetricsKind()

auto FontOptions::getMetricsKind ( ) const

◆ operator==()

bool FontOptions::operator== ( const FontOptions & other) const

Equality operator.

◆ operator!=()

bool FontOptions::operator!= ( const FontOptions & other) const

Inequality operator.

◆ operator<()

bool FontOptions::operator< ( const FontOptions & other) const

Less-than operator.

Allows FontOptions to be used as keys in a map.

◆ operator<=()

bool FontOptions::operator<= ( const FontOptions & other) const

Less-than-or-equal operator.

◆ operator>()

bool FontOptions::operator> ( const FontOptions & other) const

Greater-than operator.

◆ operator>=()

bool FontOptions::operator>= ( const FontOptions & other) const

Greater-than-or-equal operator.


The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram