aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-05-04 18:20:35 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-04 18:20:45 +0000
commit59ad782b2b05b07aa6eb961aa4d62e934093cbd1 (patch)
treecc6445f595afe8117786aa94f0d9a25e0be31c99 /include
parenta4677b5db51fca9f2d1077a4d09dd8f7c80df3d1 (diff)
Revert "SkTypeface::getAdvancedMetrics(): cleanup"
This reverts commit cef018896e5cad8eb46a536b60cdf79ebe2b0191. Reason for revert: broke chromium roll (windows). Original change's description: > SkTypeface::getAdvancedMetrics(): cleanup > > - SkAdvancedTypefaceMetrics is a struct not a class > - SkTypeface::PerGlyphInfo is gone > - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g > - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g > - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. > - [on]getAdvancedMetrics no longer has parameters. (Only caller always > used same arguments.) > - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. > - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt > > Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582 > Reviewed-on: https://skia-review.googlesource.com/15311 > Reviewed-by: Ben Wagner <bungeman@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> > TBR=halcanary@google.com,bungeman@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I84c7d53df566aaf83427e3368edaa02b7b5a9cb8 Reviewed-on: https://skia-review.googlesource.com/15319 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkTypeface.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 2d066d90f2..3e7f447f9f 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -20,12 +20,12 @@ class SkDescriptor;
class SkFontData;
class SkFontDescriptor;
class SkScalerContext;
+struct SkScalerContextRec;
+struct SkScalerContextEffects;
class SkStream;
class SkStreamAsset;
+class SkAdvancedTypefaceMetrics;
class SkWStream;
-struct SkAdvancedTypefaceMetrics;
-struct SkScalerContextEffects;
-struct SkScalerContextRec;
typedef uint32_t SkFontID;
/** Machine endian. */
@@ -327,6 +327,14 @@ public:
}
protected:
+ // The type of advance data wanted.
+ enum PerGlyphInfo {
+ kNo_PerGlyphInfo = 0x0, // Don't populate any per glyph info.
+ kGlyphNames_PerGlyphInfo = 0x1, // Populate glyph names (Type 1 only).
+ kToUnicode_PerGlyphInfo = 0x2 // Populate ToUnicode table, ignored
+ // for Type 1 fonts
+ };
+
/** uniqueID must be unique and non-zero
*/
SkTypeface(const SkFontStyle& style, bool isFixedPitch = false);
@@ -343,7 +351,10 @@ protected:
virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
const SkDescriptor*) const = 0;
virtual void onFilterRec(SkScalerContextRec*) const = 0;
- virtual std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const = 0;
+ virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
+ PerGlyphInfo,
+ const uint32_t* glyphIDs,
+ uint32_t glyphIDsCount) const = 0;
virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0;
// TODO: make pure virtual.
@@ -385,8 +396,20 @@ private:
friend class GrPathRendering;
friend class GrGLPathRendering;
- /** Retrieve detailed typeface metrics. Used by the PDF backend. */
- std::unique_ptr<SkAdvancedTypefaceMetrics> getAdvancedMetrics() const;
+ /** Retrieve detailed typeface metrics. Used by the PDF backend.
+ @param perGlyphInfo Indicate what glyph specific information (advances,
+ names, etc.) should be populated.
+ @param glyphIDs For per-glyph info, specify subset of the font by
+ giving glyph ids. Each integer represents a glyph
+ id. Passing NULL means all glyphs in the font.
+ @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if
+ glyphIDs is NULL.
+ @return The returned object has already been referenced.
+ */
+ SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics(
+ PerGlyphInfo,
+ const uint32_t* glyphIDs = NULL,
+ uint32_t glyphIDsCount = 0) const;
private:
SkFontID fUniqueID;
@@ -400,4 +423,9 @@ private:
typedef SkWeakRefCnt INHERITED;
};
+
+namespace skstd {
+template <> struct is_bitmask_enum<SkTypeface::PerGlyphInfo> : std::true_type {};
+}
+
#endif