Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

Typeface Class Reference

A typeface represents a size-independent font. More...

Inherits SingleThreadedReferenceCountedObject.

Inherited by CustomTypeface.

List of all members.

Public Types

typedef
ReferenceCountedObjectPtr
< Typeface
Ptr
 A handy typedef for a pointer to a typeface.

Public Member Functions

const StringgetName () const noexcept
 Returns the name of the typeface.
virtual ~Typeface ()
 Destructor.
virtual bool isSuitableForFont (const Font &) const
 Returns true if this typeface can be used to render the specified font.
virtual float getAscent () const =0
 Returns the ascent of the font, as a proportion of its height.
virtual float getDescent () const =0
 Returns the descent of the font, as a proportion of its height.
virtual float getStringWidth (const String &text)=0
 Measures the width of a line of text.
virtual void getGlyphPositions (const String &text, Array< int > &glyphs, Array< float > &xOffsets)=0
 Converts a line of text into its glyph numbers and their positions.
virtual bool getOutlineForGlyph (int glyphNumber, Path &path)=0
 Returns the outline for a glyph.
virtual EdgeTablegetEdgeTableForGlyph (int glyphNumber, const AffineTransform &transform)
 Returns a new EdgeTable that contains the path for the givem glyph, with the specified transform applied.
virtual bool isHinted () const
 Returns true if the typeface uses hinting.

Static Public Member Functions

static Ptr createSystemTypefaceFor (const Font &font)
 Creates a new system typeface.
static void setTypefaceCacheSize (int numFontsToCache)
 Changes the number of fonts that are cached in memory.

Protected Member Functions

 Typeface (const String &name) noexcept

Static Protected Member Functions

static Ptr getFallbackTypeface ()

Protected Attributes

String name

Detailed Description

A typeface represents a size-independent font.

This base class is abstract, but calling createSystemTypefaceFor() will return a platform-specific subclass that can be used.

The CustomTypeface subclass allow you to build your own typeface, and to load and save it in the Juce typeface format.

Normally you should never need to deal directly with Typeface objects - the Font class does everything you typically need for rendering text.

See also:
CustomTypeface, Font

Member Typedef Documentation

A handy typedef for a pointer to a typeface.


Constructor & Destructor Documentation

virtual Typeface::~Typeface (  ) [virtual]

Destructor.

Typeface::Typeface ( const String name ) [explicit, protected]

Member Function Documentation

const String& Typeface::getName (  ) const

Returns the name of the typeface.

See also:
Font::getTypefaceName
static Ptr Typeface::createSystemTypefaceFor ( const Font font ) [static]

Creates a new system typeface.

virtual bool Typeface::isSuitableForFont ( const Font  ) const [virtual]

Returns true if this typeface can be used to render the specified font.

When called, the font will already have been checked to make sure that its name and style flags match the typeface.

virtual float Typeface::getAscent (  ) const [pure virtual]

Returns the ascent of the font, as a proportion of its height.

The height is considered to always be normalised as 1.0, so this will be a value less that 1.0, indicating the proportion of the font that lies above its baseline.

Implemented in CustomTypeface.

virtual float Typeface::getDescent (  ) const [pure virtual]

Returns the descent of the font, as a proportion of its height.

The height is considered to always be normalised as 1.0, so this will be a value less that 1.0, indicating the proportion of the font that lies below its baseline.

Implemented in CustomTypeface.

virtual float Typeface::getStringWidth ( const String text ) [pure virtual]

Measures the width of a line of text.

The distance returned is based on the font having an normalised height of 1.0.

You should never need to call this directly! Use Font::getStringWidth() instead!

Implemented in CustomTypeface.

virtual void Typeface::getGlyphPositions ( const String text,
Array< int > &  glyphs,
Array< float > &  xOffsets 
) [pure virtual]

Converts a line of text into its glyph numbers and their positions.

The distances returned are based on the font having an normalised height of 1.0.

You should never need to call this directly! Use Font::getGlyphPositions() instead!

Implemented in CustomTypeface.

virtual bool Typeface::getOutlineForGlyph ( int  glyphNumber,
Path path 
) [pure virtual]

Returns the outline for a glyph.

The path returned will be normalised to a font height of 1.0.

Implemented in CustomTypeface.

virtual EdgeTable* Typeface::getEdgeTableForGlyph ( int  glyphNumber,
const AffineTransform transform 
) [virtual]

Returns a new EdgeTable that contains the path for the givem glyph, with the specified transform applied.

Reimplemented in CustomTypeface.

virtual bool Typeface::isHinted (  ) const [virtual]

Returns true if the typeface uses hinting.

static void Typeface::setTypefaceCacheSize ( int  numFontsToCache ) [static]

Changes the number of fonts that are cached in memory.

static Ptr Typeface::getFallbackTypeface (  ) [static, protected]

Member Data Documentation

String Typeface::name [protected]

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines