Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

gfxFont Class Reference

#include <gfxFont.h>

Inheritance diagram for gfxFont:
Collaboration diagram for gfxFont:

List of all members.


struct  Metrics
struct  RunMetrics
 Metrics for a particular string. More...
struct  Spacing
 We let layout specify spacing on either side of any character. More...

Public Types


Public Member Functions

nsrefcnt AddRef (void)
nsrefcnt Release (void)
PRInt32 GetRefCount ()
virtual ~gfxFont ()
PRBool Valid ()
const nsString_externalGetName () const
const gfxFontStyleGetStyle () const
virtual nsString_external GetUniqueName ()=0
virtual const gfxFont::MetricsGetMetrics ()=0
virtual void Draw (gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd, gfxContext *aContext, PRBool aDrawToPath, gfxPoint *aBaselineOrigin, Spacing *aSpacing)
 Draw a series of glyphs to aContext.
virtual RunMetrics Measure (gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd, BoundingBoxType aBoundingBoxType, gfxContext *aContextForTightBoundingBox, Spacing *aSpacing)
 Measure a run of characters.
PRBool NotifyLineBreaksChanged (gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aLength)
 Line breaks have been changed at the beginning and/or end of a substring of the text.
nsExpirationStateGetExpirationState ()
virtual PRUint32 GetSpaceGlyph ()=0
gfxGlyphExtentsGetOrCreateGlyphExtents (PRUint32 aAppUnitsPerDevUnit)
virtual void SetupGlyphExtents (gfxContext *aContext, PRUint32 aGlyphID, PRBool aNeedTight, gfxGlyphExtents *aExtents)
virtual PRBool SetupCairoFont (gfxContext *aContext)=0
PRBool IsSyntheticBold ()
PRUint32 GetSyntheticBoldOffset ()
gfxFontEntryGetFontEntry ()
PRBool HasCharacter (PRUint32 ch)
virtual void InitTextRun (gfxTextRun *aTextRun, const PRUnichar *aString, PRUint32 aRunStart, PRUint32 aRunLength)

Protected Member Functions

void NotifyReleased ()
 gfxFont (gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle)
void SanitizeMetrics (gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)

Protected Attributes

nsAutoRefCnt mRefCnt
nsRefPtr< gfxFontEntrymFontEntry
PRPackedBool mIsValid
nsExpirationState mExpirationState
gfxFontStyle mStyle
nsAutoTArray< gfxGlyphExtents *, 1 > mGlyphExtentsArray
PRUint32 mSyntheticBoldOffset

Member Enumeration Documentation


Constructor & Destructor Documentation

gfxFont::gfxFont ( gfxFontEntry aFontEntry,
const gfxFontStyle aFontStyle 
) [protected]
virtual gfxFont::~gfxFont (  )  [virtual]

Member Function Documentation

nsrefcnt gfxFont::AddRef ( void   )  [inline]
virtual void gfxFont::Draw ( gfxTextRun aTextRun,
PRUint32  aStart,
PRUint32  aEnd,
gfxContext aContext,
PRBool  aDrawToPath,
gfxPoint aBaselineOrigin,
Spacing aSpacing 
) [virtual]

Draw a series of glyphs to aContext.

The direction of aTextRun must be honoured.

aStart the first character to draw
aEnd draw characters up to here
aBaselineOrigin the baseline origin; the left end of the baseline for LTR textruns, the right end of the baseline for RTL textruns. On return, this should be updated to the other end of the baseline. In application units, really!
aSpacing spacing to insert before and after characters (for RTL glyphs, before-spacing is inserted to the right of characters). There are aEnd - aStart elements in this array, unless it's null to indicate that there is no spacing.
aDrawToPath when true, add the glyph outlines to the current path instead of drawing the glyphs

Callers guarantee: -- aStart and aEnd are aligned to cluster and ligature boundaries -- all glyphs use this font

The default implementation builds a cairo glyph array and calls cairo_show_glyphs or cairo_glyph_path.

nsExpirationState* gfxFont::GetExpirationState (  )  [inline]
gfxFontEntry* gfxFont::GetFontEntry (  )  [inline]
virtual const gfxFont::Metrics& gfxFont::GetMetrics (  )  [pure virtual]

Implemented in gfxFT2FontBase.

const nsString_external& gfxFont::GetName (  )  const [inline]
gfxGlyphExtents* gfxFont::GetOrCreateGlyphExtents ( PRUint32  aAppUnitsPerDevUnit  ) 
PRInt32 gfxFont::GetRefCount (  )  [inline]
virtual PRUint32 gfxFont::GetSpaceGlyph (  )  [pure virtual]

Implemented in gfxFT2FontBase.

const gfxFontStyle* gfxFont::GetStyle (  )  const [inline]
PRUint32 gfxFont::GetSyntheticBoldOffset (  )  [inline]
virtual nsString_external gfxFont::GetUniqueName (  )  [pure virtual]

Implemented in gfxFT2FontBase.

PRBool gfxFont::HasCharacter ( PRUint32  ch  )  [inline]
virtual void gfxFont::InitTextRun ( gfxTextRun aTextRun,
const PRUnichar aString,
PRUint32  aRunStart,
PRUint32  aRunLength 
) [inline, virtual]
PRBool gfxFont::IsSyntheticBold (  )  [inline]
virtual RunMetrics gfxFont::Measure ( gfxTextRun aTextRun,
PRUint32  aStart,
PRUint32  aEnd,
BoundingBoxType  aBoundingBoxType,
gfxContext aContextForTightBoundingBox,
Spacing aSpacing 
) [virtual]

Measure a run of characters.

See gfxTextRun::Metrics.

aTight if false, then return the union of the glyph extents with the font-box for the characters (the rectangle with x=0,width= the advance width for the character run,y=-(font ascent), and height= font ascent + font descent). Otherwise, we must return as tight as possible an approximation to the area actually painted by glyphs.
aContextForTightBoundingBox when aTight is true, this must be non-null.
aSpacing spacing to insert before and after glyphs. The bounding box need not include the spacing itself, but the spacing affects the glyph positions. null if there is no spacing.

Callers guarantee: -- aStart and aEnd are aligned to cluster and ligature boundaries -- all glyphs use this font

The default implementation just uses font metrics and aTextRun's advances, and assumes no characters fall outside the font box. In general this is insufficient, because that assumption is not always true.

PRBool gfxFont::NotifyLineBreaksChanged ( gfxTextRun aTextRun,
PRUint32  aStart,
PRUint32  aLength 
) [inline]

Line breaks have been changed at the beginning and/or end of a substring of the text.

Reshaping may be required; glyph updating is permitted.

true if anything was changed, false otherwise
void gfxFont::NotifyReleased (  )  [inline, protected]
nsrefcnt gfxFont::Release ( void   )  [inline]
void gfxFont::SanitizeMetrics ( gfxFont::Metrics aMetrics,
PRBool  aIsBadUnderlineFont 
) [protected]
virtual PRBool gfxFont::SetupCairoFont ( gfxContext aContext  )  [pure virtual]

Implemented in gfxFT2FontBase.

virtual void gfxFont::SetupGlyphExtents ( gfxContext aContext,
PRUint32  aGlyphID,
PRBool  aNeedTight,
gfxGlyphExtents aExtents 
) [virtual]
PRBool gfxFont::Valid (  )  [inline]

Member Data Documentation

nsAutoRefCnt gfxFont::mRefCnt [protected]
PRUint32 gfxFont::mSyntheticBoldOffset [protected]

The documentation for this class was generated from the following file: