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.

Classes

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

enum  AntialiasOption { kAntialiasDefault, kAntialiasNone, kAntialiasGrayscale, kAntialiasSubpixel }
enum  BoundingBoxType { LOOSE_INK_EXTENTS, TIGHT_INK_EXTENTS, TIGHT_HINTED_OUTLINE_EXTENTS }

Public Member Functions

nsrefcnt AddRef (void)
nsrefcnt Release (void)
PRInt32 GetRefCount ()
virtual ~gfxFont ()
PRBool Valid () const
const nsString_externalGetName () const
const gfxFontStyleGetStyle () const
virtual nsString_external GetUniqueName ()
virtual gfxFontCopyWithAntialiasOption (AntialiasOption anAAOption)
virtual gfxFloat GetAdjustedSize ()
float FUnitsToDevUnitsFactor () const
PRBool FontCanSupportHarfBuzz ()
virtual hb_blob_tGetFontTable (PRUint32 aTag)
virtual PRBool ProvidesGetGlyph () const
virtual PRUint32 GetGlyph (PRUint32 unicode, PRUint32 variation_selector)
virtual PRBool ProvidesGlyphWidths ()
virtual PRInt32 GetGlyphWidth (gfxContext *aCtx, PRUint16 aGID)
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)
PRUint16 GetUVSGlyph (PRUint32 aCh, PRUint32 aVS)
PRBool SplitAndInitTextRun (gfxContext *aContext, gfxTextRun *aTextRun, const PRUnichar *aString, PRUint32 aRunStart, PRUint32 aRunLength, PRInt32 aRunScript)

Protected Member Functions

void NotifyReleased ()
 gfxFont (gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle, AntialiasOption anAAOption=kAntialiasDefault)
virtual void CreatePlatformShaper ()
PRBool InitMetricsFromSfntTables (Metrics &aMetrics)
void CalculateDerivedMetrics (Metrics &aMetrics)
void SanitizeMetrics (gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
virtual PRBool InitTextRun (gfxContext *aContext, gfxTextRun *aTextRun, const PRUnichar *aString, PRUint32 aRunStart, PRUint32 aRunLength, PRInt32 aRunScript, PRBool aPreferPlatformShaping=0)

Protected Attributes

nsAutoRefCnt mRefCnt
nsRefPtr< gfxFontEntrymFontEntry
PRPackedBool mIsValid
nsExpirationState mExpirationState
gfxFontStyle mStyle
nsAutoTArray< gfxGlyphExtents *, 1 > mGlyphExtentsArray
gfxFloat mAdjustedSize
float mFUnitsConvFactor
PRUint32 mSyntheticBoldOffset
AntialiasOption mAntialiasOption
nsAutoPtr< gfxFontmNonAAFont
nsAutoPtr< gfxFontShapermPlatformShaper
nsAutoPtr< gfxFontShapermHarfBuzzShaper

Member Enumeration Documentation

Enumerator:
kAntialiasDefault 
kAntialiasNone 
kAntialiasGrayscale 
kAntialiasSubpixel 
Enumerator:
LOOSE_INK_EXTENTS 
TIGHT_INK_EXTENTS 
TIGHT_HINTED_OUTLINE_EXTENTS 

Constructor & Destructor Documentation

gfxFont::gfxFont ( gfxFontEntry aFontEntry,
const gfxFontStyle aFontStyle,
AntialiasOption  anAAOption = kAntialiasDefault 
) [protected]
virtual gfxFont::~gfxFont (  )  [virtual]

Member Function Documentation

nsrefcnt gfxFont::AddRef ( void   )  [inline]
void gfxFont::CalculateDerivedMetrics ( Metrics aMetrics  )  [protected]
virtual gfxFont* gfxFont::CopyWithAntialiasOption ( AntialiasOption  anAAOption  )  [inline, virtual]
virtual void gfxFont::CreatePlatformShaper (  )  [inline, protected, virtual]
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.

Parameters:
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.

PRBool gfxFont::FontCanSupportHarfBuzz (  )  [inline]
float gfxFont::FUnitsToDevUnitsFactor (  )  const [inline]
virtual gfxFloat gfxFont::GetAdjustedSize (  )  [inline, virtual]
nsExpirationState* gfxFont::GetExpirationState (  )  [inline]
gfxFontEntry* gfxFont::GetFontEntry (  )  [inline]
virtual hb_blob_t* gfxFont::GetFontTable ( PRUint32  aTag  )  [virtual]

Reimplemented in gfxFT2FontBase.

virtual PRUint32 gfxFont::GetGlyph ( PRUint32  unicode,
PRUint32  variation_selector 
) [inline, virtual]

Reimplemented in gfxFT2FontBase.

virtual PRInt32 gfxFont::GetGlyphWidth ( gfxContext aCtx,
PRUint16  aGID 
) [inline, virtual]

Reimplemented in gfxFT2FontBase.

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 (  )  [inline, virtual]

Reimplemented in gfxFT2FontBase.

PRUint16 gfxFont::GetUVSGlyph ( PRUint32  aCh,
PRUint32  aVS 
) [inline]
PRBool gfxFont::HasCharacter ( PRUint32  ch  )  [inline]
PRBool gfxFont::InitMetricsFromSfntTables ( Metrics aMetrics  )  [protected]
virtual PRBool gfxFont::InitTextRun ( gfxContext aContext,
gfxTextRun aTextRun,
const PRUnichar aString,
PRUint32  aRunStart,
PRUint32  aRunLength,
PRInt32  aRunScript,
PRBool  aPreferPlatformShaping = 0 
) [protected, 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.

Parameters:
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.

Returns:
true if anything was changed, false otherwise
void gfxFont::NotifyReleased (  )  [inline, protected]
virtual PRBool gfxFont::ProvidesGetGlyph (  )  const [inline, virtual]

Reimplemented in gfxFT2FontBase.

virtual PRBool gfxFont::ProvidesGlyphWidths (  )  [inline, virtual]

Reimplemented in gfxFT2FontBase.

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::SplitAndInitTextRun ( gfxContext aContext,
gfxTextRun aTextRun,
const PRUnichar aString,
PRUint32  aRunStart,
PRUint32  aRunLength,
PRInt32  aRunScript 
)
PRBool gfxFont::Valid (  )  const [inline]

Member Data Documentation

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

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