Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: src/pdf/SkPDFFont.h

Issue 2246903002: SkPDF: SkPDFFont class changes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-08-15 (Monday) 21:25:47 EDT Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFFont.h
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index acf9bf87ee453606c0e246bdfd7569a35a5aac61..9e5ec80bdb71054806a1dd1adfca6ee4b2a4ed3a 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -75,16 +75,16 @@ public:
/** Returns the typeface represented by this class. Returns nullptr for the
* default typeface.
*/
- SkTypeface* typeface();
+ SkTypeface* typeface() { return fTypeface.get(); }
/** Returns the font type represented in this font. For Type0 fonts,
* returns the type of the decendant font.
*/
- virtual SkAdvancedTypefaceMetrics::FontType getType();
+ SkAdvancedTypefaceMetrics::FontType getType() { return fFontType; }
/** Returns true if this font encoding supports glyph IDs above 255.
*/
- virtual bool multiByteGlyphs() const = 0;
+ bool multiByteGlyphs() const { return fMultiByteGlyphs; }
/** Returns true if the machine readable licensing bits allow embedding.
*/
@@ -153,20 +153,27 @@ public:
protected:
// Common constructor to handle common members.
- SkPDFFont(const SkAdvancedTypefaceMetrics* fontInfo,
- SkTypeface* typeface,
- SkPDFDict* relatedFontDescriptor);
+ SkPDFFont(sk_sp<const SkAdvancedTypefaceMetrics> fontInfo,
+ sk_sp<SkTypeface> typeface,
+ sk_sp<SkPDFDict> relatedFontDescriptor,
+ SkAdvancedTypefaceMetrics::FontType fontType,
+ bool multiByteGlyphs);
// Accessors for subclass.
- const SkAdvancedTypefaceMetrics* fontInfo();
- void setFontInfo(const SkAdvancedTypefaceMetrics* info);
- uint16_t firstGlyphID() const;
- uint16_t lastGlyphID() const;
+ const SkAdvancedTypefaceMetrics* getFontInfo() const { return fFontInfo.get(); }
+ sk_sp<const SkAdvancedTypefaceMetrics> refFontInfo() const { return fFontInfo; }
+
+ void setFontInfo(sk_sp<const SkAdvancedTypefaceMetrics> info);
+ SkGlyphID firstGlyphID() const { return fFirstGlyphID; }
+ SkGlyphID lastGlyphID() const { return fLastGlyphID; }
void setLastGlyphID(uint16_t glyphID);
// Accessors for FontDescriptor associated with this object.
- SkPDFDict* getFontDescriptor();
- void setFontDescriptor(SkPDFDict* descriptor);
+ SkPDFDict* getFontDescriptor() const { return fDescriptor.get(); }
+ sk_sp<SkPDFDict> refFontDescriptor() const { return fDescriptor; }
+ void setFontDescriptor(sk_sp<SkPDFDict> descriptor);
+
+ sk_sp<SkTypeface> refTypeface() const { return fTypeface; }
// Add common entries to FontDescriptor.
bool addCommonFontDescriptorEntries(int16_t defaultWidth);
@@ -180,28 +187,21 @@ protected:
// If subset is nullptr, all available glyph ids will be used.
void populateToUnicodeTable(const SkPDFGlyphSet* subset);
- // Create instances of derived types based on fontInfo.
- static SkPDFFont* Create(SkPDFCanon* canon,
- const SkAdvancedTypefaceMetrics* fontInfo,
- SkTypeface* typeface,
- uint16_t glyphID,
- SkPDFDict* relatedFontDescriptor);
-
static bool Find(uint32_t fontID, uint16_t glyphID, int* index);
void drop() override;
private:
sk_sp<SkTypeface> fTypeface;
-
- // The glyph IDs accessible with this font. For Type1 (non CID) fonts,
- // this will be a subset if the font has more than 255 glyphs.
- uint16_t fFirstGlyphID;
- uint16_t fLastGlyphID;
sk_sp<const SkAdvancedTypefaceMetrics> fFontInfo;
sk_sp<SkPDFDict> fDescriptor;
+ // The glyph IDs accessible with this font. For Type1 (non CID) fonts,
+ // this will be a subset if the font has more than 255 glyphs.
+ SkGlyphID fFirstGlyphID;
+ SkGlyphID fLastGlyphID;
SkAdvancedTypefaceMetrics::FontType fFontType;
+ bool fMultiByteGlyphs;
typedef SkPDFDict INHERITED;
};
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698