Skia
2D Graphics Library
SkTypeface Class Referenceabstract

The SkTypeface class specifies the typeface and intrinsic style of a font. More...

#include <SkTypeface.h>

Inheritance diagram for SkTypeface:

Classes

struct  LocalizedString
 
class  LocalizedStrings
 

Public Types

enum class  SerializeBehavior { kDoIncludeData , kDontIncludeData , kIncludeDataIfLocal }
 A typeface can serialize just a descriptor (names, etc.), or it can also include the actual font data (which can be large). More...
 
using FactoryId = SkFourByteTag
 

Public Member Functions

SkFontStyle fontStyle () const
 Returns the typeface's intrinsic style attributes. More...
 
bool isBold () const
 Returns true if style() has the kBold bit set. More...
 
bool isItalic () const
 Returns true if style() has the kItalic bit set. More...
 
bool isFixedPitch () const
 Returns true if the typeface claims to be fixed-pitch. More...
 
int getVariationDesignPosition (SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const
 Copy into 'coordinates' (allocated by the caller) the design variation coordinates. More...
 
int getVariationDesignParameters (SkFontParameters::Variation::Axis parameters[], int parameterCount) const
 Copy into 'parameters' (allocated by the caller) the design variation parameters. More...
 
SkTypefaceID uniqueID () const
 Return a 32bit value for this typeface, unique for the underlying font data. More...
 
sk_sp< SkTypefacemakeClone (const SkFontArguments &) const
 Return a new typeface based on this typeface but parameterized as specified in the SkFontArguments. More...
 
void serialize (SkWStream *, SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
 Write a unique signature to a stream, sufficient to reconstruct a typeface referencing the same font when Deserialize is called. More...
 
sk_sp< SkDataserialize (SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
 Same as serialize(SkWStream*, ...) but returns the serialized data in SkData, instead of writing it to a stream. More...
 
void unicharsToGlyphs (const SkUnichar uni[], int count, SkGlyphID glyphs[]) const
 Given an array of UTF32 character codes, return their corresponding glyph IDs. More...
 
int textToGlyphs (const void *text, size_t byteLength, SkTextEncoding encoding, SkGlyphID glyphs[], int maxGlyphCount) const
 
SkGlyphID unicharToGlyph (SkUnichar unichar) const
 Return the glyphID that corresponds to the specified unicode code-point (in UTF32 encoding). More...
 
int countGlyphs () const
 Return the number of glyphs in the typeface. More...
 
int countTables () const
 Return the number of tables in the font. More...
 
int getTableTags (SkFontTableTag tags[]) const
 Copy into tags[] (allocated by the caller) the list of table tags in the font, and return the number. More...
 
size_t getTableSize (SkFontTableTag) const
 Given a table tag, return the size of its contents, or 0 if not present. More...
 
size_t getTableData (SkFontTableTag tag, size_t offset, size_t length, void *data) const
 Copy the contents of a table into data (allocated by the caller). More...
 
sk_sp< SkDatacopyTableData (SkFontTableTag tag) const
 Return an immutable copy of the requested font table, or nullptr if that table was not found. More...
 
int getUnitsPerEm () const
 Return the units-per-em value for this typeface, or zero if there is an error. More...
 
bool getKerningPairAdjustments (const SkGlyphID glyphs[], int count, int32_t adjustments[]) const
 Given a run of glyphs, return the associated horizontal adjustments. More...
 
LocalizedStringscreateFamilyNameIterator () const
 Returns an iterator which will attempt to enumerate all of the family names specified by the font. More...
 
void getFamilyName (SkString *name) const
 Return the family name for this typeface. More...
 
bool getPostScriptName (SkString *name) const
 Return the PostScript name for this typeface. More...
 
std::unique_ptr< SkStreamAssetopenStream (int *ttcIndex) const
 Return a stream for the contents of the font data, or NULL on failure. More...
 
std::unique_ptr< SkStreamAssetopenExistingStream (int *ttcIndex) const
 Return a stream for the contents of the font data. More...
 
std::unique_ptr< SkScalerContextcreateScalerContext (const SkScalerContextEffects &, const SkDescriptor *) const
 Return a scalercontext for the given descriptor. More...
 
SkRect getBounds () const
 Return a rectangle (scaled to 1-pt) that represents the union of the bounds of all of the glyphs, but each one positioned at (0,). More...
 
void filterRec (SkScalerContextRec *rec) const
 
void getFontDescriptor (SkFontDescriptor *desc, bool *isLocal) const
 
void * internal_private_getCTFontRef () const
 

Static Public Member Functions

static bool Equal (const SkTypeface *facea, const SkTypeface *faceb)
 Returns true if the two typefaces reference the same underlying font, handling either being null (treating null as not equal to any font). More...
 
static sk_sp< SkTypefaceMakeDefault ()
 Returns the default normal typeface, which is never nullptr. More...
 
static sk_sp< SkTypefaceMakeEmpty ()
 Returns a non-null typeface which contains no glyphs. More...
 
static sk_sp< SkTypefaceMakeFromName (const char familyName[], SkFontStyle fontStyle)
 Creates a new reference to the typeface that most closely matches the requested familyName and fontStyle. More...
 
static sk_sp< SkTypefaceMakeFromFile (const char path[], int index=0)
 Return a new typeface given a file. More...
 
static sk_sp< SkTypefaceMakeFromStream (std::unique_ptr< SkStreamAsset > stream, int index=0)
 Return a new typeface given a stream and TTC index(pass 0 for none). More...
 
static sk_sp< SkTypefaceMakeFromData (sk_sp< SkData >, int index=0)
 Return a new typeface given a SkData and TTC index (pass 0 for none). More...
 
static sk_sp< SkTypefaceMakeDeserialize (SkStream *)
 Given the data previously written by serialize(), return a new instance of a typeface referring to the same font. More...
 
static sk_sp< SkTypefaceMakeDeserialize (SkStream *, sk_sp< SkFontMgr > lastResortMgr)
 
static void Register (FactoryId id, sk_sp< SkTypeface >(*make)(std::unique_ptr< SkStreamAsset >, const SkFontArguments &))
 

Protected Member Functions

 SkTypeface (const SkFontStyle &style, bool isFixedPitch=false)
 
 ~SkTypeface () override
 
virtual sk_sp< SkTypefaceonMakeClone (const SkFontArguments &) const =0
 
void setIsFixedPitch (bool isFixedPitch)
 Sets the fixedPitch bit. More...
 
void setFontStyle (SkFontStyle style)
 Sets the font style. More...
 
virtual std::unique_ptr< SkScalerContextonCreateScalerContext (const SkScalerContextEffects &, const SkDescriptor *) const =0
 
virtual void onFilterRec (SkScalerContextRec *) const =0
 
virtual std::unique_ptr< SkAdvancedTypefaceMetrics > onGetAdvancedMetrics () const =0
 
virtual void getPostScriptGlyphNames (SkString *) const =0
 
virtual void getGlyphToUnicodeMap (SkUnichar *dstArray) const =0
 
virtual std::unique_ptr< SkStreamAssetonOpenStream (int *ttcIndex) const =0
 
virtual std::unique_ptr< SkStreamAssetonOpenExistingStream (int *ttcIndex) const
 
virtual bool onGlyphMaskNeedsCurrentColor () const =0
 
virtual int onGetVariationDesignPosition (SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const =0
 
virtual int onGetVariationDesignParameters (SkFontParameters::Variation::Axis parameters[], int parameterCount) const =0
 
virtual void onGetFontDescriptor (SkFontDescriptor *, bool *isLocal) const =0
 
virtual void onCharsToGlyphs (const SkUnichar *chars, int count, SkGlyphID glyphs[]) const =0
 
virtual int onCountGlyphs () const =0
 
virtual int onGetUPEM () const =0
 
virtual bool onGetKerningPairAdjustments (const SkGlyphID glyphs[], int count, int32_t adjustments[]) const
 
virtual void onGetFamilyName (SkString *familyName) const =0
 Returns the family name of the typeface as known by its font manager. More...
 
virtual bool onGetPostScriptName (SkString *) const =0
 
virtual LocalizedStringsonCreateFamilyNameIterator () const =0
 Returns an iterator over the family names in the font. More...
 
virtual int onGetTableTags (SkFontTableTag tags[]) const =0
 
virtual size_t onGetTableData (SkFontTableTag, size_t offset, size_t length, void *data) const =0
 
virtual sk_sp< SkDataonCopyTableData (SkFontTableTag) const
 
virtual bool onComputeBounds (SkRect *) const
 
virtual void * onGetCTFontRef () const
 

Friends

class SkScalerContext
 
class SkStrikeServerImpl
 
class SkTypefaceProxyPrototype
 
class SkRandomTypeface
 
class SkPDFFont
 
class SkFontPriv
 
class SkPaintPriv
 
class SkFont
 

Detailed Description

The SkTypeface class specifies the typeface and intrinsic style of a font.

This is used in the paint, along with optionally algorithmic settings like textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify how text appears when drawn (and measured).

Typeface objects are immutable, and so they can be shared between threads.

Member Typedef Documentation

◆ FactoryId

Member Enumeration Documentation

◆ SerializeBehavior

A typeface can serialize just a descriptor (names, etc.), or it can also include the actual font data (which can be large).

This enum controls how serialize() decides what to serialize.

Enumerator
kDoIncludeData 
kDontIncludeData 
kIncludeDataIfLocal 

Constructor & Destructor Documentation

◆ SkTypeface()

SkTypeface::SkTypeface ( const SkFontStyle style,
bool  isFixedPitch = false 
)
explicitprotected

◆ ~SkTypeface()

SkTypeface::~SkTypeface ( )
overrideprotected

Member Function Documentation

◆ copyTableData()

sk_sp<SkData> SkTypeface::copyTableData ( SkFontTableTag  tag) const

Return an immutable copy of the requested font table, or nullptr if that table was not found.

This can sometimes be faster than calling getTableData() twice: once to find the length, and then again to copy the data.

Parameters
tagThe table tag whose contents are to be copied
Returns
an immutable copy of the table's data, or nullptr.

◆ countGlyphs()

int SkTypeface::countGlyphs ( ) const

Return the number of glyphs in the typeface.

◆ countTables()

int SkTypeface::countTables ( ) const

Return the number of tables in the font.

◆ createFamilyNameIterator()

LocalizedStrings* SkTypeface::createFamilyNameIterator ( ) const

Returns an iterator which will attempt to enumerate all of the family names specified by the font.

It is the caller's responsibility to unref() the returned pointer.

◆ createScalerContext()

std::unique_ptr<SkScalerContext> SkTypeface::createScalerContext ( const SkScalerContextEffects &  ,
const SkDescriptor *   
) const

Return a scalercontext for the given descriptor.

It may return a stub scalercontext that will not crash, but will draw nothing.

◆ Equal()

static bool SkTypeface::Equal ( const SkTypeface facea,
const SkTypeface faceb 
)
static

Returns true if the two typefaces reference the same underlying font, handling either being null (treating null as not equal to any font).

◆ filterRec()

void SkTypeface::filterRec ( SkScalerContextRec *  rec) const
inline

◆ fontStyle()

SkFontStyle SkTypeface::fontStyle ( ) const
inline

Returns the typeface's intrinsic style attributes.

◆ getBounds()

SkRect SkTypeface::getBounds ( ) const

Return a rectangle (scaled to 1-pt) that represents the union of the bounds of all of the glyphs, but each one positioned at (0,).

This may be conservatively large, and will not take into account any hinting or other size-specific adjustments.

◆ getFamilyName()

void SkTypeface::getFamilyName ( SkString name) const

Return the family name for this typeface.

It will always be returned encoded as UTF8, but the language of the name is whatever the host platform chooses.

◆ getFontDescriptor()

void SkTypeface::getFontDescriptor ( SkFontDescriptor *  desc,
bool *  isLocal 
) const
inline

◆ getGlyphToUnicodeMap()

virtual void SkTypeface::getGlyphToUnicodeMap ( SkUnichar dstArray) const
protectedpure virtual

◆ getKerningPairAdjustments()

bool SkTypeface::getKerningPairAdjustments ( const SkGlyphID  glyphs[],
int  count,
int32_t  adjustments[] 
) const

Given a run of glyphs, return the associated horizontal adjustments.

Adjustments are in "design units", which are integers relative to the typeface's units per em (see getUnitsPerEm).

Some typefaces are known to never support kerning. Calling this method with all zeros (e.g. getKerningPairAdustments(NULL, 0, NULL)) returns a boolean indicating if the typeface might support kerning. If it returns false, then it will always return false (no kerning) for all possible glyph runs. If it returns true, then it may return true for somne glyph runs.

If count is non-zero, then the glyphs parameter must point to at least [count] valid glyph IDs, and the adjustments parameter must be sized to at least [count - 1] entries. If the method returns true, then [count-1] entries in the adjustments array will be set. If the method returns false, then no kerning should be applied, and the adjustments array will be in an undefined state (possibly some values may have been written, but none of them should be interpreted as valid values).

◆ getPostScriptGlyphNames()

virtual void SkTypeface::getPostScriptGlyphNames ( SkString ) const
protectedpure virtual

◆ getPostScriptName()

bool SkTypeface::getPostScriptName ( SkString name) const

Return the PostScript name for this typeface.

Value may change based on variation parameters. Returns false if no PostScript name is available.

◆ getTableData()

size_t SkTypeface::getTableData ( SkFontTableTag  tag,
size_t  offset,
size_t  length,
void *  data 
) const

Copy the contents of a table into data (allocated by the caller).

Note that the contents of the table will be in their native endian order (which for most truetype tables is big endian). If the table tag is not found, or there is an error copying the data, then 0 is returned. If this happens, it is possible that some or all of the memory pointed to by data may have been written to, even though an error has occured.

Parameters
tagThe table tag whose contents are to be copied
offsetThe offset in bytes into the table's contents where the copy should start from.
lengthThe number of bytes, starting at offset, of table data to copy.
datastorage address where the table contents are copied to
Returns
the number of bytes actually copied into data. If offset+length exceeds the table's size, then only the bytes up to the table's size are actually copied, and this is the value returned. If offset > the table's size, or tag is not a valid table, then 0 is returned.

◆ getTableSize()

size_t SkTypeface::getTableSize ( SkFontTableTag  ) const

Given a table tag, return the size of its contents, or 0 if not present.

◆ getTableTags()

int SkTypeface::getTableTags ( SkFontTableTag  tags[]) const

Copy into tags[] (allocated by the caller) the list of table tags in the font, and return the number.

This will be the same as CountTables() or 0 if an error occured. If tags == NULL, this only returns the count (the same as calling countTables()).

◆ getUnitsPerEm()

int SkTypeface::getUnitsPerEm ( ) const

Return the units-per-em value for this typeface, or zero if there is an error.

◆ getVariationDesignParameters()

int SkTypeface::getVariationDesignParameters ( SkFontParameters::Variation::Axis  parameters[],
int  parameterCount 
) const

Copy into 'parameters' (allocated by the caller) the design variation parameters.

Parameters
parametersthe buffer into which to write the design variation parameters.
coordinateCountthe number of entries available through 'parameters'.
Returns
The number of axes, or -1 if there is an error. If 'parameters != nullptr' and 'parameterCount >= numAxes' then 'parameters' will be filled with the variation parameters describing the position of this typeface in design variation space. It is possible the number of axes can be retrieved but actual parameters cannot.

◆ getVariationDesignPosition()

int SkTypeface::getVariationDesignPosition ( SkFontArguments::VariationPosition::Coordinate  coordinates[],
int  coordinateCount 
) const

Copy into 'coordinates' (allocated by the caller) the design variation coordinates.

Parameters
coordinatesthe buffer into which to write the design variation coordinates.
coordinateCountthe number of entries available through 'coordinates'.
Returns
The number of axes, or -1 if there is an error. If 'coordinates != nullptr' and 'coordinateCount >= numAxes' then 'coordinates' will be filled with the variation coordinates describing the position of this typeface in design variation space. It is possible the number of axes can be retrieved but actual position cannot.

◆ internal_private_getCTFontRef()

void* SkTypeface::internal_private_getCTFontRef ( ) const
inline

◆ isBold()

bool SkTypeface::isBold ( ) const
inline

Returns true if style() has the kBold bit set.

◆ isFixedPitch()

bool SkTypeface::isFixedPitch ( ) const
inline

Returns true if the typeface claims to be fixed-pitch.

This is a style bit, advance widths may vary even if this returns true.

◆ isItalic()

bool SkTypeface::isItalic ( ) const
inline

Returns true if style() has the kItalic bit set.

◆ makeClone()

sk_sp<SkTypeface> SkTypeface::makeClone ( const SkFontArguments ) const

Return a new typeface based on this typeface but parameterized as specified in the SkFontArguments.

If the SkFontArguments does not supply an argument for a parameter in the font then the value from this typeface will be used as the value for that argument. If the cloned typeface would be exaclty the same as this typeface then this typeface may be ref'ed and returned. May return nullptr on failure.

◆ MakeDefault()

static sk_sp<SkTypeface> SkTypeface::MakeDefault ( )
static

Returns the default normal typeface, which is never nullptr.

◆ MakeDeserialize() [1/2]

static sk_sp<SkTypeface> SkTypeface::MakeDeserialize ( SkStream )
static

Given the data previously written by serialize(), return a new instance of a typeface referring to the same font.

If that font is not available, return nullptr. Goes through all registered typeface factories and lastResortMgr (if non-null). Does not affect ownership of SkStream.

◆ MakeDeserialize() [2/2]

static sk_sp<SkTypeface> SkTypeface::MakeDeserialize ( SkStream ,
sk_sp< SkFontMgr lastResortMgr 
)
static

◆ MakeEmpty()

static sk_sp<SkTypeface> SkTypeface::MakeEmpty ( )
static

Returns a non-null typeface which contains no glyphs.

◆ MakeFromData()

static sk_sp<SkTypeface> SkTypeface::MakeFromData ( sk_sp< SkData ,
int  index = 0 
)
static

Return a new typeface given a SkData and TTC index (pass 0 for none).

If the data is null, or is not a valid font file, returns nullptr. Deprecated: call SkFontMgr::makeFromData instead

◆ MakeFromFile()

static sk_sp<SkTypeface> SkTypeface::MakeFromFile ( const char  path[],
int  index = 0 
)
static

Return a new typeface given a file.

If the file does not exist, or is not a valid font file, returns nullptr. Deprecated: call SkFontMgr::makeFromFile instead

◆ MakeFromName()

static sk_sp<SkTypeface> SkTypeface::MakeFromName ( const char  familyName[],
SkFontStyle  fontStyle 
)
static

Creates a new reference to the typeface that most closely matches the requested familyName and fontStyle.

This method allows extended font face specifiers as in the SkFontStyle type. Will never return null.

Parameters
familyNameMay be NULL. The name of the font family.
fontStyleThe style of the typeface.
Returns
reference to the closest-matching typeface. Call must call unref() when they are done. Deprecated: call SkFontMgr::matchFamilyStyle or SkFontMgr::legacyMakeTypeface

◆ MakeFromStream()

static sk_sp<SkTypeface> SkTypeface::MakeFromStream ( std::unique_ptr< SkStreamAsset stream,
int  index = 0 
)
static

Return a new typeface given a stream and TTC index(pass 0 for none).

If the stream is not a valid font file, returns nullptr. Ownership of the stream is transferred, so the caller must not reference it again. Deprecated: call SkFontMgr::makeFromStream instead

◆ onCharsToGlyphs()

virtual void SkTypeface::onCharsToGlyphs ( const SkUnichar chars,
int  count,
SkGlyphID  glyphs[] 
) const
protectedpure virtual

◆ onComputeBounds()

virtual bool SkTypeface::onComputeBounds ( SkRect ) const
protectedvirtual

◆ onCopyTableData()

virtual sk_sp<SkData> SkTypeface::onCopyTableData ( SkFontTableTag  ) const
protectedvirtual

◆ onCountGlyphs()

virtual int SkTypeface::onCountGlyphs ( ) const
protectedpure virtual

◆ onCreateFamilyNameIterator()

virtual LocalizedStrings* SkTypeface::onCreateFamilyNameIterator ( ) const
protectedpure virtual

Returns an iterator over the family names in the font.

◆ onCreateScalerContext()

virtual std::unique_ptr<SkScalerContext> SkTypeface::onCreateScalerContext ( const SkScalerContextEffects &  ,
const SkDescriptor *   
) const
protectedpure virtual

◆ onFilterRec()

virtual void SkTypeface::onFilterRec ( SkScalerContextRec *  ) const
protectedpure virtual

◆ onGetAdvancedMetrics()

virtual std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface::onGetAdvancedMetrics ( ) const
protectedpure virtual

◆ onGetCTFontRef()

virtual void* SkTypeface::onGetCTFontRef ( ) const
inlineprotectedvirtual

◆ onGetFamilyName()

virtual void SkTypeface::onGetFamilyName ( SkString familyName) const
protectedpure virtual

Returns the family name of the typeface as known by its font manager.

This name may or may not be produced by the family name iterator.

◆ onGetFontDescriptor()

virtual void SkTypeface::onGetFontDescriptor ( SkFontDescriptor *  ,
bool *  isLocal 
) const
protectedpure virtual

◆ onGetKerningPairAdjustments()

virtual bool SkTypeface::onGetKerningPairAdjustments ( const SkGlyphID  glyphs[],
int  count,
int32_t  adjustments[] 
) const
protectedvirtual

◆ onGetPostScriptName()

virtual bool SkTypeface::onGetPostScriptName ( SkString ) const
protectedpure virtual

◆ onGetTableData()

virtual size_t SkTypeface::onGetTableData ( SkFontTableTag  ,
size_t  offset,
size_t  length,
void *  data 
) const
protectedpure virtual

◆ onGetTableTags()

virtual int SkTypeface::onGetTableTags ( SkFontTableTag  tags[]) const
protectedpure virtual

◆ onGetUPEM()

virtual int SkTypeface::onGetUPEM ( ) const
protectedpure virtual

◆ onGetVariationDesignParameters()

virtual int SkTypeface::onGetVariationDesignParameters ( SkFontParameters::Variation::Axis  parameters[],
int  parameterCount 
) const
protectedpure virtual

◆ onGetVariationDesignPosition()

virtual int SkTypeface::onGetVariationDesignPosition ( SkFontArguments::VariationPosition::Coordinate  coordinates[],
int  coordinateCount 
) const
protectedpure virtual

◆ onGlyphMaskNeedsCurrentColor()

virtual bool SkTypeface::onGlyphMaskNeedsCurrentColor ( ) const
protectedpure virtual

◆ onMakeClone()

virtual sk_sp<SkTypeface> SkTypeface::onMakeClone ( const SkFontArguments ) const
protectedpure virtual

◆ onOpenExistingStream()

virtual std::unique_ptr<SkStreamAsset> SkTypeface::onOpenExistingStream ( int *  ttcIndex) const
protectedvirtual

◆ onOpenStream()

virtual std::unique_ptr<SkStreamAsset> SkTypeface::onOpenStream ( int *  ttcIndex) const
protectedpure virtual

◆ openExistingStream()

std::unique_ptr<SkStreamAsset> SkTypeface::openExistingStream ( int *  ttcIndex) const

Return a stream for the contents of the font data.

Returns nullptr on failure or if the font data isn't already available in stream form. Use when the stream can be used opportunistically but the calling code would prefer to fall back to table access if creating the stream would be expensive. Otherwise acts the same as openStream.

◆ openStream()

std::unique_ptr<SkStreamAsset> SkTypeface::openStream ( int *  ttcIndex) const

Return a stream for the contents of the font data, or NULL on failure.

If ttcIndex is not null, it is set to the TrueTypeCollection index of this typeface within the stream, or 0 if the stream is not a collection. The caller is responsible for deleting the stream.

◆ Register()

static void SkTypeface::Register ( FactoryId  id,
sk_sp< SkTypeface >(*)(std::unique_ptr< SkStreamAsset >, const SkFontArguments &)  make 
)
static

◆ serialize() [1/2]

Same as serialize(SkWStream*, ...) but returns the serialized data in SkData, instead of writing it to a stream.

◆ serialize() [2/2]

void SkTypeface::serialize ( SkWStream ,
SerializeBehavior  = SerializeBehavior::kIncludeDataIfLocal 
) const

Write a unique signature to a stream, sufficient to reconstruct a typeface referencing the same font when Deserialize is called.

◆ setFontStyle()

void SkTypeface::setFontStyle ( SkFontStyle  style)
inlineprotected

Sets the font style.

If used, must be called in the constructor.

◆ setIsFixedPitch()

void SkTypeface::setIsFixedPitch ( bool  isFixedPitch)
inlineprotected

Sets the fixedPitch bit.

If used, must be called in the constructor.

◆ textToGlyphs()

int SkTypeface::textToGlyphs ( const void *  text,
size_t  byteLength,
SkTextEncoding  encoding,
SkGlyphID  glyphs[],
int  maxGlyphCount 
) const

◆ unicharsToGlyphs()

void SkTypeface::unicharsToGlyphs ( const SkUnichar  uni[],
int  count,
SkGlyphID  glyphs[] 
) const

Given an array of UTF32 character codes, return their corresponding glyph IDs.

Parameters
charspointer to the array of UTF32 chars
numberof chars and glyphs
glyphsreturns the corresponding glyph IDs for each character.

◆ unicharToGlyph()

SkGlyphID SkTypeface::unicharToGlyph ( SkUnichar  unichar) const

Return the glyphID that corresponds to the specified unicode code-point (in UTF32 encoding).

If the unichar is not supported, returns 0.

This is a short-cut for calling unicharsToGlyphs().

◆ uniqueID()

SkTypefaceID SkTypeface::uniqueID ( ) const
inline

Return a 32bit value for this typeface, unique for the underlying font data.

Will never return 0.

Friends And Related Function Documentation

◆ SkFont

friend class SkFont
friend

◆ SkFontPriv

friend class SkFontPriv
friend

◆ SkPaintPriv

friend class SkPaintPriv
friend

◆ SkPDFFont

friend class SkPDFFont
friend

◆ SkRandomTypeface

friend class SkRandomTypeface
friend

◆ SkScalerContext

friend class SkScalerContext
friend

◆ SkStrikeServerImpl

friend class SkStrikeServerImpl
friend

◆ SkTypefaceProxyPrototype

friend class SkTypefaceProxyPrototype
friend

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