From d0e95a524c20932e0f4e68bab43995188a281395 Mon Sep 17 00:00:00 2001 From: halcanary Date: Mon, 25 Jul 2016 07:18:12 -0700 Subject: [PATCH] =?UTF-8?q?typedef=C2=A0uint16=5Ft=20SkGlyphID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/core/SkFont.h | 2 +- include/core/SkPaint.h | 4 ++-- include/core/SkTextBlob.h | 2 +- include/core/SkTypeface.h | 8 ++++---- include/core/SkTypes.h | 4 ++++ 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/core/SkFont.h b/include/core/SkFont.h index 6e8a71501f..e50909aaec 100644 --- a/include/core/SkFont.h +++ b/include/core/SkFont.h @@ -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); diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index caa185608a..ef80b73f21 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -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 diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h index e43ff74a85..c211f85086 100644 --- a/include/core/SkTextBlob.h +++ b/include/core/SkTextBlob.h @@ -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; }; diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index e3a311da43..4f3879c6c2 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -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. diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 279557498e..deb2819740 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -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. */