epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 Google Inc. |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 10 | #ifndef SkPDFFontImpl_DEFINED |
| 11 | #define SkPDFFontImpl_DEFINED |
| 12 | |
| 13 | #include "SkPDFFont.h" |
| 14 | |
| 15 | class SkPDFType0Font : public SkPDFFont { |
| 16 | public: |
| 17 | virtual ~SkPDFType0Font(); |
| 18 | virtual bool multiByteGlyphs() const { return true; } |
| 19 | SK_API virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); |
| 20 | #ifdef SK_DEBUG |
| 21 | virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, |
| 22 | bool indirect); |
| 23 | #endif |
| 24 | |
| 25 | private: |
| 26 | friend class SkPDFFont; // to access the constructor |
| 27 | #ifdef SK_DEBUG |
| 28 | bool fPopulated; |
| 29 | typedef SkPDFDict INHERITED; |
| 30 | #endif |
| 31 | |
| 32 | SkPDFType0Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface); |
| 33 | |
| 34 | bool populate(const SkPDFGlyphSet* subset); |
| 35 | }; |
| 36 | |
| 37 | class SkPDFCIDFont : public SkPDFFont { |
| 38 | public: |
| 39 | virtual ~SkPDFCIDFont(); |
| 40 | virtual bool multiByteGlyphs() const { return true; } |
| 41 | |
| 42 | private: |
| 43 | friend class SkPDFType0Font; // to access the constructor |
| 44 | |
| 45 | SkPDFCIDFont(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, |
| 46 | const SkPDFGlyphSet* subset); |
| 47 | |
| 48 | bool populate(const SkPDFGlyphSet* subset); |
vandebo@chromium.org | 37ad8fb | 2011-08-18 02:38:50 +0000 | [diff] [blame^] | 49 | bool addFontDescriptor(int16_t defaultWidth, |
| 50 | const SkTDArray<uint32_t>* subset); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | class SkPDFType1Font : public SkPDFFont { |
| 54 | public: |
| 55 | virtual ~SkPDFType1Font(); |
| 56 | virtual bool multiByteGlyphs() const { return false; } |
| 57 | |
| 58 | private: |
| 59 | friend class SkPDFFont; // to access the constructor |
| 60 | |
| 61 | SkPDFType1Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, |
| 62 | uint16_t glyphID, SkPDFDict* relatedFontDescriptor); |
| 63 | |
| 64 | bool populate(int16_t glyphID); |
| 65 | bool addFontDescriptor(int16_t defaultWidth); |
| 66 | void addWidthInfoFromRange(int16_t defaultWidth, |
| 67 | const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry); |
| 68 | }; |
| 69 | |
| 70 | class SkPDFType3Font : public SkPDFFont { |
| 71 | public: |
| 72 | virtual ~SkPDFType3Font(); |
| 73 | virtual bool multiByteGlyphs() const { return false; } |
| 74 | |
| 75 | private: |
| 76 | friend class SkPDFFont; // to access the constructor |
| 77 | |
| 78 | SkPDFType3Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, |
| 79 | uint16_t glyphID, SkPDFDict* relatedFontDescriptor); |
| 80 | |
| 81 | bool populate(int16_t glyphID); |
| 82 | }; |
| 83 | |
| 84 | #endif |