Index: trunk/include/core/SkFontHost.h |
=================================================================== |
--- trunk/include/core/SkFontHost.h (revision 8138) |
+++ trunk/include/core/SkFontHost.h (working copy) |
@@ -49,6 +49,92 @@ |
*/ |
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 @@ |
/////////////////////////////////////////////////////////////////////////// |
- /** 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 @@ |
/////////////////////////////////////////////////////////////////////////// |
- /** 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 |