typedef uint16_t SkGlyphID

This goes well with our existing `typedef int32_t SkUnichar`.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2095263003

Review-Url: https://codereview.chromium.org/2095263003
This commit is contained in:
halcanary 2016-07-25 07:18:12 -07:00 committed by Commit bot
parent 1d35231e7b
commit d0e95a524c
5 changed files with 12 additions and 8 deletions

View File

@ -146,7 +146,7 @@ public:
bool isDevKern() const { return SkToBool(fFlags & kDevKern_Flag); }
int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding,
uint16_t glyphs[], int maxGlyphCount) const;
SkGlyphID glyphs[], int maxGlyphCount) const;
int countText(const void* text, size_t byteLength, SkTextEncoding encoding) {
return this->textToGlyphs(text, byteLength, encoding, nullptr, 0);

View File

@ -821,7 +821,7 @@ public:
is returned.
*/
int textToGlyphs(const void* text, size_t byteLength,
uint16_t glyphs[]) const;
SkGlyphID glyphs[]) const;
/** Return true if all of the specified text has a corresponding non-zero
glyph ID. If any of the code-points in the text are not supported in
@ -836,7 +836,7 @@ public:
to zero. Note: this does not look at the text-encoding setting in the
paint, only at the typeface.
*/
void glyphsToUnichars(const uint16_t glyphs[], int count, SkUnichar text[]) const;
void glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar text[]) const;
/** Return the number of drawable units in the specified text buffer.
This looks at the current TextEncoding field of the paint. If you also

View File

@ -106,7 +106,7 @@ public:
* A run is a sequence of glyphs sharing the same font metrics and positioning mode.
*/
struct RunBuffer {
uint16_t* glyphs;
SkGlyphID* glyphs;
SkScalar* pos;
};

View File

@ -188,7 +188,7 @@ public:
* from the beginning of chars. This value is valid, even if the
* glyphs parameter is NULL.
*/
int charsToGlyphs(const void* chars, Encoding encoding, uint16_t glyphs[],
int charsToGlyphs(const void* chars, Encoding encoding, SkGlyphID glyphs[],
int glyphCount) const;
/**
@ -262,7 +262,7 @@ public:
* array will be in an undefined state (possibly some values may have been
* written, but none of them should be interpreted as valid values).
*/
bool getKerningPairAdjustments(const uint16_t glyphs[], int count,
bool getKerningPairAdjustments(const SkGlyphID glyphs[], int count,
int32_t adjustments[]) const;
struct LocalizedString {
@ -364,12 +364,12 @@ protected:
virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0;
virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[],
virtual int onCharsToGlyphs(const void* chars, Encoding, SkGlyphID glyphs[],
int glyphCount) const = 0;
virtual int onCountGlyphs() const = 0;
virtual int onGetUPEM() const = 0;
virtual bool onGetKerningPairAdjustments(const uint16_t glyphs[], int count,
virtual bool onGetKerningPairAdjustments(const SkGlyphID glyphs[], int count,
int32_t adjustments[]) const;
/** Returns the family name of the typeface as known by its font manager.

View File

@ -348,6 +348,10 @@ typedef uint32_t SkFourByteTag;
*/
typedef int32_t SkUnichar;
/** 16 bit unsigned integer to hold a glyph index
*/
typedef uint16_t SkGlyphID;
/** 32 bit value to hold a millisecond duration
* Note that SK_MSecMax is about 25 days.
*/