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_external & | GetName () const |
| const gfxFontStyle * | GetStyle () const |
| virtual nsString_external | GetUniqueName () |
| virtual gfxFont * | CopyWithAntialiasOption (AntialiasOption anAAOption) |
| virtual gfxFloat | GetAdjustedSize () |
| float | FUnitsToDevUnitsFactor () const |
| PRBool | FontCanSupportHarfBuzz () |
| virtual hb_blob_t * | GetFontTable (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::Metrics & | GetMetrics ()=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.
|
| nsExpirationState * | GetExpirationState () |
| virtual PRUint32 | GetSpaceGlyph ()=0 |
| gfxGlyphExtents * | GetOrCreateGlyphExtents (PRUint32 aAppUnitsPerDevUnit) |
| virtual void | SetupGlyphExtents (gfxContext *aContext, PRUint32 aGlyphID, PRBool aNeedTight, gfxGlyphExtents *aExtents) |
| virtual PRBool | SetupCairoFont (gfxContext *aContext)=0 |
| PRBool | IsSyntheticBold () |
| PRUint32 | GetSyntheticBoldOffset () |
| gfxFontEntry * | GetFontEntry () |
| 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< gfxFontEntry > | mFontEntry |
| PRPackedBool | mIsValid |
| nsExpirationState | mExpirationState |
| gfxFontStyle | mStyle |
| nsAutoTArray< gfxGlyphExtents *, 1 > | mGlyphExtentsArray |
| gfxFloat | mAdjustedSize |
| float | mFUnitsConvFactor |
| PRUint32 | mSyntheticBoldOffset |
| AntialiasOption | mAntialiasOption |
| nsAutoPtr< gfxFont > | mNonAAFont |
| nsAutoPtr< gfxFontShaper > | mPlatformShaper |
| nsAutoPtr< gfxFontShaper > | mHarfBuzzShaper |
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.
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.