| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPDFFont_DEFINED | 10 #ifndef SkPDFFont_DEFINED |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 attached to it in order to embed the font. SkPDFFonts are canonicalized | 75 attached to it in order to embed the font. SkPDFFonts are canonicalized |
| 76 so that resource deduplication will only include one copy of a font. | 76 so that resource deduplication will only include one copy of a font. |
| 77 This class uses the same pattern as SkPDFGraphicState, a static weak | 77 This class uses the same pattern as SkPDFGraphicState, a static weak |
| 78 reference to each instantiated class. | 78 reference to each instantiated class. |
| 79 */ | 79 */ |
| 80 class SkPDFFont : public SkPDFDict { | 80 class SkPDFFont : public SkPDFDict { |
| 81 SK_DECLARE_INST_COUNT(SkPDFFont) | 81 SK_DECLARE_INST_COUNT(SkPDFFont) |
| 82 public: | 82 public: |
| 83 virtual ~SkPDFFont(); | 83 virtual ~SkPDFFont(); |
| 84 | 84 |
| 85 virtual void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects, | |
| 86 SkTSet<SkPDFObject*>* newResourceObjects); | |
| 87 | |
| 88 /** Returns the typeface represented by this class. Returns NULL for the | 85 /** Returns the typeface represented by this class. Returns NULL for the |
| 89 * default typeface. | 86 * default typeface. |
| 90 */ | 87 */ |
| 91 SkTypeface* typeface(); | 88 SkTypeface* typeface(); |
| 92 | 89 |
| 93 /** Returns the font type represented in this font. For Type0 fonts, | 90 /** Returns the font type represented in this font. For Type0 fonts, |
| 94 * returns the type of the decendant font. | 91 * returns the type of the decendant font. |
| 95 */ | 92 */ |
| 96 virtual SkAdvancedTypefaceMetrics::FontType getType(); | 93 virtual SkAdvancedTypefaceMetrics::FontType getType(); |
| 97 | 94 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 SkPDFFont(const SkAdvancedTypefaceMetrics* fontInfo, SkTypeface* typeface, | 152 SkPDFFont(const SkAdvancedTypefaceMetrics* fontInfo, SkTypeface* typeface, |
| 156 SkPDFDict* relatedFontDescriptor); | 153 SkPDFDict* relatedFontDescriptor); |
| 157 | 154 |
| 158 // Accessors for subclass. | 155 // Accessors for subclass. |
| 159 const SkAdvancedTypefaceMetrics* fontInfo(); | 156 const SkAdvancedTypefaceMetrics* fontInfo(); |
| 160 void setFontInfo(const SkAdvancedTypefaceMetrics* info); | 157 void setFontInfo(const SkAdvancedTypefaceMetrics* info); |
| 161 uint16_t firstGlyphID() const; | 158 uint16_t firstGlyphID() const; |
| 162 uint16_t lastGlyphID() const; | 159 uint16_t lastGlyphID() const; |
| 163 void setLastGlyphID(uint16_t glyphID); | 160 void setLastGlyphID(uint16_t glyphID); |
| 164 | 161 |
| 165 // Add object to resource list. | |
| 166 void addResource(SkPDFObject* object); | |
| 167 | |
| 168 // Accessors for FontDescriptor associated with this object. | 162 // Accessors for FontDescriptor associated with this object. |
| 169 SkPDFDict* getFontDescriptor(); | 163 SkPDFDict* getFontDescriptor(); |
| 170 void setFontDescriptor(SkPDFDict* descriptor); | 164 void setFontDescriptor(SkPDFDict* descriptor); |
| 171 | 165 |
| 172 // Add common entries to FontDescriptor. | 166 // Add common entries to FontDescriptor. |
| 173 bool addCommonFontDescriptorEntries(int16_t defaultWidth); | 167 bool addCommonFontDescriptorEntries(int16_t defaultWidth); |
| 174 | 168 |
| 175 /** Set fFirstGlyphID and fLastGlyphID to span at most 255 glyphs, | 169 /** Set fFirstGlyphID and fLastGlyphID to span at most 255 glyphs, |
| 176 * including the passed glyphID. | 170 * including the passed glyphID. |
| 177 */ | 171 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 189 static bool Find(uint32_t fontID, uint16_t glyphID, int* index); | 183 static bool Find(uint32_t fontID, uint16_t glyphID, int* index); |
| 190 | 184 |
| 191 private: | 185 private: |
| 192 SkAutoTUnref<SkTypeface> fTypeface; | 186 SkAutoTUnref<SkTypeface> fTypeface; |
| 193 | 187 |
| 194 // The glyph IDs accessible with this font. For Type1 (non CID) fonts, | 188 // The glyph IDs accessible with this font. For Type1 (non CID) fonts, |
| 195 // this will be a subset if the font has more than 255 glyphs. | 189 // this will be a subset if the font has more than 255 glyphs. |
| 196 uint16_t fFirstGlyphID; | 190 uint16_t fFirstGlyphID; |
| 197 uint16_t fLastGlyphID; | 191 uint16_t fLastGlyphID; |
| 198 SkAutoTUnref<const SkAdvancedTypefaceMetrics> fFontInfo; | 192 SkAutoTUnref<const SkAdvancedTypefaceMetrics> fFontInfo; |
| 199 SkTDArray<SkPDFObject*> fResources; | |
| 200 SkAutoTUnref<SkPDFDict> fDescriptor; | 193 SkAutoTUnref<SkPDFDict> fDescriptor; |
| 201 | 194 |
| 202 SkAdvancedTypefaceMetrics::FontType fFontType; | 195 SkAdvancedTypefaceMetrics::FontType fFontType; |
| 203 | 196 |
| 204 typedef SkPDFDict INHERITED; | 197 typedef SkPDFDict INHERITED; |
| 205 }; | 198 }; |
| 206 | 199 |
| 207 #endif | 200 #endif |
| OLD | NEW |