aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkAdvancedTypefaceMetrics.h
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-05-04 14:23:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-05 13:53:40 +0000
commit209e4b1b70a5e9c2f504de15f038999ed9ee4ae5 (patch)
tree137e2b6ce3d37f25c0bd20caf1838676d0fc7c0f /src/core/SkAdvancedTypefaceMetrics.h
parent452f92016ba3144f1e58466727074a859d39c072 (diff)
Revert "Revert "SkTypeface::getAdvancedMetrics(): cleanup""
This reverts commit 59ad782b2b05b07aa6eb961aa4d62e934093cbd1. - 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: I91b56e60f7d9de7d46c426c6bd34ce124e0cf00e Reviewed-on: https://skia-review.googlesource.com/15360 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/core/SkAdvancedTypefaceMetrics.h')
-rw-r--r--src/core/SkAdvancedTypefaceMetrics.h46
1 files changed, 16 insertions, 30 deletions
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 61f1f1e9bd..2bc09d8323 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -18,22 +18,12 @@
The SkAdvancedTypefaceMetrics class is used by the PDF backend to correctly
embed typefaces. This class is created and filled in with information by
- SkTypeface::getAdvancedTypefaceMetrics.
+ SkTypeface::getAdvancedMetrics.
*/
-class SkAdvancedTypefaceMetrics : public SkRefCnt {
-public:
-
- SkAdvancedTypefaceMetrics()
- : fType(SkAdvancedTypefaceMetrics::kOther_Font)
- , fFlags((FontFlags)0)
- , fStyle((StyleFlags)0)
- , fItalicAngle(0)
- , fAscent(0)
- , fDescent(0)
- , fStemV(0)
- , fCapHeight(0)
- , fBBox(SkIRect::MakeEmpty()) {}
-
+struct SkAdvancedTypefaceMetrics {
+ SkAdvancedTypefaceMetrics() {}
+ SkAdvancedTypefaceMetrics(const SkAdvancedTypefaceMetrics&) = delete;
+ SkAdvancedTypefaceMetrics& operator=(const SkAdvancedTypefaceMetrics&) = delete;
~SkAdvancedTypefaceMetrics() {}
SkString fFontName;
@@ -48,14 +38,14 @@ public:
// The type of the underlying font program. This field determines which
// of the following fields are valid. If it is kOther_Font the per glyph
// information will never be populated.
- FontType fType;
+ FontType fType = kOther_Font;
enum FontFlags : uint8_t {
kMultiMaster_FontFlag = 0x01, //!<May be true for Type1, CFF, or TrueType fonts.
kNotEmbeddable_FontFlag = 0x02, //!<May not be embedded.
kNotSubsettable_FontFlag = 0x04, //!<May not be subset.
};
- FontFlags fFlags; // Global font flags.
+ FontFlags fFlags = (FontFlags)0; // Global font flags.
// These enum values match the values used in the PDF file format.
enum StyleFlags : uint32_t {
@@ -67,27 +57,23 @@ public:
kSmallCaps_Style = 0x00020000,
kForceBold_Style = 0x00040000
};
- StyleFlags fStyle; // Font style characteristics.
+ StyleFlags fStyle = (StyleFlags)0; // Font style characteristics.
- int16_t fItalicAngle; // Counterclockwise degrees from vertical of the
- // dominant vertical stroke for an Italic face.
+ int16_t fItalicAngle = 0; // Counterclockwise degrees from vertical of the
+ // dominant vertical stroke for an Italic face.
// The following fields are all in font units.
- int16_t fAscent; // Max height above baseline, not including accents.
- int16_t fDescent; // Max depth below baseline (negative).
- int16_t fStemV; // Thickness of dominant vertical stem.
- int16_t fCapHeight; // Height (from baseline) of top of flat capitals.
+ int16_t fAscent = 0; // Max height above baseline, not including accents.
+ int16_t fDescent = 0; // Max depth below baseline (negative).
+ int16_t fStemV = 0; // Thickness of dominant vertical stem.
+ int16_t fCapHeight = 0; // Height (from baseline) of top of flat capitals.
- SkIRect fBBox; // The bounding box of all glyphs (in font units).
+ SkIRect fBBox = {0, 0, 0, 0}; // The bounding box of all glyphs (in font units).
// The names of each glyph, only populated for postscript fonts.
SkTArray<SkString> fGlyphNames;
- // The mapping from glyph to Unicode, only populated if
- // kToUnicode_PerGlyphInfo is passed to GetAdvancedTypefaceMetrics.
+ // The mapping from glyph to Unicode; array indices are glyph ids.
SkTDArray<SkUnichar> fGlyphToUnicode;
-
-private:
- typedef SkRefCnt INHERITED;
};
namespace skstd {