aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-31 17:24:44 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-31 17:24:44 +0000
commit4b2af9c91d39c2176a32e7ba42a0276dca68034a (patch)
treee8173fa9f93220566ee18ea0fcd395e548652585 /src/core
parent777e7890935b831174bcd64a86391d166a505ab4 (diff)
add getUnitsPerEm() to SkTypeface
git-svn-id: http://skia.googlecode.com/svn/trunk@4863 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkTypeface.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 66e7904cd2..3a40e0130b 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -117,3 +117,21 @@ size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length
return SkFontHost::GetTableData(fUniqueID, tag, offset, length, data);
}
+int SkTypeface::getUnitsPerEm() const {
+ int upem = 0;
+
+#ifdef SK_BUILD_FOR_ANDROID
+ upem = SkFontHost::GetUnitsPerEm(fUniqueID);
+#else
+ SkAdvancedTypefaceMetrics* metrics;
+ metrics = SkFontHost::GetAdvancedTypefaceMetrics(fUniqueID,
+ SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo,
+ NULL, 0);
+ if (metrics) {
+ upem = metrics->fEmSize;
+ metrics->unref();
+ }
+#endif
+ return upem;
+}
+