Index: include/core/SkTypeface.h |
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h |
index eebb1276f7cd535606aa562f55a2606ef6529bde..af76824f47a158d1f806121785e19200c1eeeef9 100644 |
--- a/include/core/SkTypeface.h |
+++ b/include/core/SkTypeface.h |
@@ -225,6 +225,29 @@ public: |
*/ |
int getUnitsPerEm() 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). |
+ */ |
+ bool getKerningPairAdjustments(const uint16_t glyphs[], int count, |
+ int32_t adjustments[]) const; |
+ |
struct LocalizedString { |
SkString fString; |
SkString fLanguage; |
@@ -303,6 +326,7 @@ protected: |
SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, |
const uint32_t* glyphIDs, |
uint32_t glyphIDsCount) const = 0; |
+ |
virtual SkStream* onOpenStream(int* ttcIndex) const = 0; |
virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0; |
@@ -311,6 +335,8 @@ protected: |
virtual int onCountGlyphs() const = 0; |
virtual int onGetUPEM() const = 0; |
+ virtual bool onGetKerningPairAdjustments(const uint16_t glyphs[], int count, |
+ int32_t adjustments[]) const; |
virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; |