aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-14 15:04:57 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-14 15:04:57 +0000
commitfed86bdb8b9f037439bbfa7cdbd53a581dbc5985 (patch)
treeb03a35f11ee303aed8cd9c3c6210b22ba463c2dc /include
parenta936e37cc76614868f5b489395bceeb340cc04cd (diff)
move most of SkFontHost to private (preceeding making it all private)
In this change, have to accomodate PDF wanting to call openStream and advancedMetrics Review URL: https://codereview.chromium.org/12739006 git-svn-id: http://skia.googlecode.com/svn/trunk@8156 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkFontHost.h171
-rw-r--r--include/core/SkTypeface.h9
2 files changed, 96 insertions, 84 deletions
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index 3c2ed09249..07957da319 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -49,6 +49,92 @@ class SkWStream;
*/
class SK_API SkFontHost {
public:
+ /** LCDs either have their color elements arranged horizontally or
+ vertically. When rendering subpixel glyphs we need to know which way
+ round they are.
+
+ Note, if you change this after startup, you'll need to flush the glyph
+ cache because it'll have the wrong type of masks cached.
+
+ @deprecated use SkPixelGeometry instead.
+ */
+ enum LCDOrientation {
+ kHorizontal_LCDOrientation = 0, //!< this is the default
+ kVertical_LCDOrientation = 1
+ };
+
+ /** @deprecated set on Device creation. */
+ static void SetSubpixelOrientation(LCDOrientation orientation);
+ /** @deprecated get from Device. */
+ static LCDOrientation GetSubpixelOrientation();
+
+ /** LCD color elements can vary in order. For subpixel text we need to know
+ the order which the LCDs uses so that the color fringes are in the
+ correct place.
+
+ Note, if you change this after startup, you'll need to flush the glyph
+ cache because it'll have the wrong type of masks cached.
+
+ kNONE_LCDOrder means that the subpixel elements are not spatially
+ separated in any usable fashion.
+
+ @deprecated use SkPixelGeometry instead.
+ */
+ enum LCDOrder {
+ kRGB_LCDOrder = 0, //!< this is the default
+ kBGR_LCDOrder = 1,
+ kNONE_LCDOrder = 2
+ };
+
+ /** @deprecated set on Device creation. */
+ static void SetSubpixelOrder(LCDOrder order);
+ /** @deprecated get from Device. */
+ static LCDOrder GetSubpixelOrder();
+
+#ifdef SK_BUILD_FOR_ANDROID
+ /**
+ * Return the number of font units per em.
+ *
+ * @param fontID the font to query.
+ * @return the number of font units per em or 0 on error.
+ */
+ static uint32_t GetUnitsPerEm(SkFontID fontID);
+#endif
+
+ /** If Skia is running in a constrained environment and the typeface
+ implementation is handle based, the typeface data may become
+ unavailable asynchronously. If a font host or scaler context method is
+ unable to access font data, it may call this function as a request to
+ make the handle contained in the typeface useable.
+ */
+ static void EnsureTypefaceAccessible(const SkTypeface& typeface);
+
+ /**
+ * Return a subclass of SkScalarContext
+ * DEPRECATED -- will be moved to SkTypeface
+ */
+ static SkScalerContext* CreateScalerContext(const SkDescriptor* desc);
+
+ /**
+ * DEPRECATED -- will be DESTROYED
+ *
+ * Given a "current" fontID, return the next logical fontID to use
+ * when searching fonts for a given unicode value. Typically the caller
+ * will query a given font, and if a unicode value is not supported, they
+ * will call this, and if 0 is not returned, will search that font, and so
+ * on. This process must be finite, and when the fonthost sees a
+ * font with no logical successor, it must return 0.
+ *
+ * The original fontID is also provided. This is the initial font that was
+ * stored in the typeface of the caller. It is provided as an aid to choose
+ * the best next logical font. e.g. If the original font was bold or serif,
+ * but the 2nd in the logical chain was plain, then a subsequent call to
+ * get the 3rd can still inspect the original, and try to match its
+ * stylistic attributes.
+ */
+ static SkFontID NextLogicalFont(SkFontID currFontID, SkFontID origFontID);
+
+private:
/** Return a new, closest matching typeface given either an existing family
(specified by a typeface in that family) or by a familyName and a
requested style.
@@ -135,29 +221,6 @@ public:
///////////////////////////////////////////////////////////////////////////
- /** Return a subclass of SkScalarContext
- */
- static SkScalerContext* CreateScalerContext(const SkDescriptor* desc);
-
- /**
- * Given a "current" fontID, return the next logical fontID to use
- * when searching fonts for a given unicode value. Typically the caller
- * will query a given font, and if a unicode value is not supported, they
- * will call this, and if 0 is not returned, will search that font, and so
- * on. This process must be finite, and when the fonthost sees a
- * font with no logical successor, it must return 0.
- *
- * The original fontID is also provided. This is the initial font that was
- * stored in the typeface of the caller. It is provided as an aid to choose
- * the best next logical font. e.g. If the original font was bold or serif,
- * but the 2nd in the logical chain was plain, then a subsequent call to
- * get the 3rd can still inspect the original, and try to match its
- * stylistic attributes.
- */
- static SkFontID NextLogicalFont(SkFontID currFontID, SkFontID origFontID);
-
- ///////////////////////////////////////////////////////////////////////////
-
/** Given a filled-out rec, the fonthost may decide to modify it to reflect
what the host is actually capable of fulfilling. For example, if the
rec is requesting a level of hinting that, for this host, maps some
@@ -230,67 +293,7 @@ public:
///////////////////////////////////////////////////////////////////////////
- /** LCDs either have their color elements arranged horizontally or
- vertically. When rendering subpixel glyphs we need to know which way
- round they are.
-
- Note, if you change this after startup, you'll need to flush the glyph
- cache because it'll have the wrong type of masks cached.
-
- @deprecated use SkPixelGeometry instead.
- */
- enum LCDOrientation {
- kHorizontal_LCDOrientation = 0, //!< this is the default
- kVertical_LCDOrientation = 1
- };
-
- /** @deprecated set on Device creation. */
- static void SetSubpixelOrientation(LCDOrientation orientation);
- /** @deprecated get from Device. */
- static LCDOrientation GetSubpixelOrientation();
-
- /** LCD color elements can vary in order. For subpixel text we need to know
- the order which the LCDs uses so that the color fringes are in the
- correct place.
-
- Note, if you change this after startup, you'll need to flush the glyph
- cache because it'll have the wrong type of masks cached.
-
- kNONE_LCDOrder means that the subpixel elements are not spatially
- separated in any usable fashion.
-
- @deprecated use SkPixelGeometry instead.
- */
- enum LCDOrder {
- kRGB_LCDOrder = 0, //!< this is the default
- kBGR_LCDOrder = 1,
- kNONE_LCDOrder = 2
- };
-
- /** @deprecated set on Device creation. */
- static void SetSubpixelOrder(LCDOrder order);
- /** @deprecated get from Device. */
- static LCDOrder GetSubpixelOrder();
-
-#ifdef SK_BUILD_FOR_ANDROID
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * Return the number of font units per em.
- *
- * @param fontID the font to query.
- * @return the number of font units per em or 0 on error.
- */
- static uint32_t GetUnitsPerEm(SkFontID fontID);
-#endif
-
- /** If Skia is running in a constrained environment and the typeface
- implementation is handle based, the typeface data may become
- unavailable asynchronously. If a font host or scaler context method is
- unable to access font data, it may call this function as a request to
- make the handle contained in the typeface useable.
- */
- static void EnsureTypefaceAccessible(const SkTypeface& typeface);
+ friend class SkTypeface;
};
#endif
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 79b821f99b..a531cf2c84 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -80,6 +80,12 @@ public:
*/
static bool Equal(const SkTypeface* facea, const SkTypeface* faceb);
+ /**
+ * Returns a ref() to the default typeface. The caller must call unref()
+ * when they are done referencing the object. Never returns NULL.
+ */
+ static SkTypeface* RefDefault();
+
/** Return a new reference to the typeface that most closely matches the
requested familyName and style. Pass null as the familyName to return
the default font for the requested style. Will never return null
@@ -187,6 +193,8 @@ public:
*/
int getUnitsPerEm() const;
+ SkStream* openStream(int* ttcIndex) const;
+
protected:
/** uniqueID must be unique and non-zero
*/
@@ -209,6 +217,7 @@ private:
Style fStyle;
bool fIsFixedWidth;
+ friend class SkPaint;
// just so deprecated fonthost can call protected methods
friend class SkFontHost;