Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: include/core/SkTypeface.h

Issue 21149008: refactoring for SK_FONTHOST_USES_FONTMGR option (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkFontHost.h ('k') | include/ports/SkFontMgr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTypeface.h
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 429a24b18ab570bb0be117e3a203dbb30c3a7fd3..fccbe1f62e6499603ff74b5fc26744b84caf438e 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -240,6 +240,17 @@ public:
SkStream* openStream(int* ttcIndex) const;
/**
+ * Search within this typeface's family for a best match to the
+ * specified style, and return a ref to that typeface. Note: the
+ * returned object could be this, if it is the best match, or it
+ * could be a different typeface. Either way, the caller must balance
+ * this call with unref() on the returned object.
+ *
+ * Will never return NULL.
+ */
+ SkTypeface* refMatchingStyle(Style) const;
+
+ /**
* Return a scalercontext for the given descriptor. If this fails, then
* if allowFailure is true, this returns NULL, else it returns a
* dummy scalercontext that will not crash, but will draw nothing.
@@ -287,6 +298,13 @@ protected:
virtual size_t onGetTableData(SkFontTableTag, size_t offset,
size_t length, void* data) const;
+ // TODO: make this pure-virtual when all ports have overridden it
+ virtual SkTypeface* onRefMatchingStyle(Style styleBits) const {
+ SkASSERT(!"unimplemented");
+ this->ref();
+ return const_cast<SkTypeface*>(this);
+ }
+
private:
SkFontID fUniqueID;
Style fStyle;
« no previous file with comments | « include/core/SkFontHost.h ('k') | include/ports/SkFontMgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698