Chromium Code Reviews| Index: include/core/SkTypeface.h |
| diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h |
| index f67623674a3c05823df0a584a2d363ecbf080b6e..4dcb4bdc81d6a7e166467dc27f139f72c1940ee7 100644 |
| --- a/include/core/SkTypeface.h |
| +++ b/include/core/SkTypeface.h |
| @@ -12,6 +12,7 @@ |
| #include "SkAdvancedTypefaceMetrics.h" |
| #include "SkFontStyle.h" |
| +#include "SkLazyPtr.h" |
| #include "SkWeakRefCnt.h" |
| class SkDescriptor; |
| @@ -282,6 +283,13 @@ public: |
| SkScalerContext* createScalerContext(const SkDescriptor*, |
| bool allowFailure = false) const; |
| + /** |
| + * Return a rectangle (scaled to 1-pt) that represents the union of the bounds of all |
| + * of the glyphs, each one positioned at (0,). This may be conservatively large, and |
|
mtklein
2014/10/22 14:46:19
and -> but?
reed1
2014/10/22 20:09:28
Done.
|
| + * will not take into account any hinting or other size-specific adjustments. |
| + */ |
| + SkRect getBounds() const; |
| + |
| // PRIVATE / EXPERIMENTAL -- do not call |
| void filterRec(SkScalerContextRec* rec) const { |
| this->onFilterRec(rec); |
| @@ -333,6 +341,8 @@ protected: |
| virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
| size_t length, void* data) const = 0; |
| + virtual bool onComputeBounds(SkRect*) const; |
| + |
| private: |
| friend class SkGTypeface; |
| friend class SkPDFFont; |
| @@ -359,9 +369,13 @@ private: |
| static SkTypeface* CreateDefault(int style); // SkLazyPtr requires an int, not a Style. |
| static void DeleteDefault(SkTypeface*); |
| - SkFontID fUniqueID; |
| - SkFontStyle fStyle; |
| - bool fIsFixedPitch; |
| + struct BoundsComputer; |
| + friend struct BoundsComputer; |
|
mtklein
2014/10/22 14:46:19
You might be able to get away without this friend
reed1
2014/10/22 20:09:28
Done.
|
| + |
| + SkLazyPtr<SkRect> fLazyBounds; |
| + SkFontID fUniqueID; |
| + SkFontStyle fStyle; |
| + bool fIsFixedPitch; |
| friend class SkPaint; |
| friend class SkGlyphCache; // GetDefaultTypeface |