aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkAdvancedTypefaceMetrics.h8
-rw-r--r--include/core/SkFontHost.h8
-rw-r--r--include/core/SkTypeface.h9
-rw-r--r--include/core/SkTypes.h7
4 files changed, 26 insertions, 6 deletions
diff --git a/include/core/SkAdvancedTypefaceMetrics.h b/include/core/SkAdvancedTypefaceMetrics.h
index 033e738c8a..f536a5603f 100644
--- a/include/core/SkAdvancedTypefaceMetrics.h
+++ b/include/core/SkAdvancedTypefaceMetrics.h
@@ -76,6 +76,14 @@ public:
SkIRect fBBox; // The bounding box of all glyphs (in font units).
+ // The type of advance data wanted.
+ enum PerGlyphInfo {
+ kNo_PerGlyphInfo = 0x0, // Don't populate any per glyph info.
+ kHAdvance_PerGlyphInfo = 0x1, // Populate horizontal advance data.
+ kVAdvance_PerGlyphInfo = 0x2, // Populate vertical advance data.
+ kGlyphNames_PerGlyphInfo = 0x4, // Populate glyph names (Type 1 only).
+ };
+
template <typename Data>
struct AdvanceMetric {
enum MetricType {
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index 3c6925130b..72faed76c7 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -177,14 +177,14 @@ public:
///////////////////////////////////////////////////////////////////////////
/** Retrieve detailed typeface metrics. Used by the PDF backend.
- @param perGlyphInfo Indicate if the glyph specific information.
- @param perGlyphInfo Indicate if the glyph specific information (advances
- and names) should be populated.
+ @param perGlyphInfo Indicate what glyph specific information (advances,
+ names, etc.) should be populated.
@return The returned object has already been referenced. NULL is
returned if the font is not found.
*/
static SkAdvancedTypefaceMetrics* GetAdvancedTypefaceMetrics(
- SkFontID fontID, bool perGlyphInfo);
+ SkFontID fontID,
+ SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo);
/** Return the number of tables in the font
*/
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index c3b0f50d18..abbde04a17 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -17,6 +17,7 @@
#ifndef SkTypeface_DEFINED
#define SkTypeface_DEFINED
+#include "SkAdvancedTypefaceMetrics.h"
#include "SkRefCnt.h"
class SkStream;
@@ -136,11 +137,15 @@ public:
static SkTypeface* Deserialize(SkStream*);
/** Retrieve detailed typeface metrics. Used by the PDF backend.
- @param perGlyphInfo Indicate if the glyph specific information (advances
- and names) should be populated.
+ @param perGlyphInfo Indicate what glyph specific information (advances,
+ names, etc.) should be populated.
@return The returned object has already been referenced.
*/
SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics(
+ SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo) const;
+
+ // Temporary: for transition purposes.
+ SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics(
bool perGlyphInfo) const;
protected:
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 1290935dee..1a3a2e5099 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -318,6 +318,13 @@ static inline uint32_t SkSetClearMask(uint32_t bits, bool cond,
///////////////////////////////////////////////////////////////////////////////
+/** Use to combine multiple bits in a bitmask in a type safe way.
+ */
+template <typename T>
+T SkTBitOr(T a, T b) {
+ return (T)(a | b);
+}
+
/**
* Use to cast a pointer to a different type, and maintaining strict-aliasing
*/