aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkTypeface.h
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-30 15:07:03 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-30 15:07:03 +0000
commit35fe7372b1b897a77578a220c334e1fb36d144e9 (patch)
treee70d67ac0528ce8a5cb22cec06cf8bd7d547b6c6 /include/core/SkTypeface.h
parentb08c707847be4b0c94adf592912b4e7073f71ecb (diff)
prototype for kerning api
BUG= R=bungeman@google.com Review URL: https://codereview.chromium.org/29363009 git-svn-id: http://skia.googlecode.com/svn/trunk@12018 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkTypeface.h')
-rw-r--r--include/core/SkTypeface.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index eebb1276f7..af76824f47 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;