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; } |
halcanary | 4e4e816 | 2015-02-25 08:59:48 -0800 | [diff] [blame^] | 19 | virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 20 | #ifdef SK_DEBUG |
halcanary | 4fc48af | 2015-01-12 10:07:50 -0800 | [diff] [blame] | 21 | virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 22 | #endif |
| 23 | |
| 24 | private: |
| 25 | friend class SkPDFFont; // to access the constructor |
| 26 | #ifdef SK_DEBUG |
| 27 | bool fPopulated; |
| 28 | typedef SkPDFDict INHERITED; |
| 29 | #endif |
| 30 | |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 31 | SkPDFType0Font(SkPDFCanon* canon, |
| 32 | const SkAdvancedTypefaceMetrics* info, |
| 33 | SkTypeface* typeface); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 34 | |
| 35 | bool populate(const SkPDFGlyphSet* subset); |
| 36 | }; |
| 37 | |
| 38 | class SkPDFCIDFont : public SkPDFFont { |
| 39 | public: |
| 40 | virtual ~SkPDFCIDFont(); |
| 41 | virtual bool multiByteGlyphs() const { return true; } |
| 42 | |
| 43 | private: |
| 44 | friend class SkPDFType0Font; // to access the constructor |
| 45 | |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 46 | SkPDFCIDFont(SkPDFCanon* canon, |
| 47 | const SkAdvancedTypefaceMetrics* info, |
| 48 | SkTypeface* typeface, |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 49 | const SkPDFGlyphSet* subset); |
| 50 | |
| 51 | bool populate(const SkPDFGlyphSet* subset); |
vandebo@chromium.org | 37ad8fb | 2011-08-18 02:38:50 +0000 | [diff] [blame] | 52 | bool addFontDescriptor(int16_t defaultWidth, |
| 53 | const SkTDArray<uint32_t>* subset); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | class SkPDFType1Font : public SkPDFFont { |
| 57 | public: |
| 58 | virtual ~SkPDFType1Font(); |
| 59 | virtual bool multiByteGlyphs() const { return false; } |
| 60 | |
| 61 | private: |
| 62 | friend class SkPDFFont; // to access the constructor |
| 63 | |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 64 | SkPDFType1Font(SkPDFCanon* canon, |
| 65 | const SkAdvancedTypefaceMetrics* info, |
| 66 | SkTypeface* typeface, |
| 67 | uint16_t glyphID, |
| 68 | SkPDFDict* relatedFontDescriptor); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 69 | |
| 70 | bool populate(int16_t glyphID); |
| 71 | bool addFontDescriptor(int16_t defaultWidth); |
| 72 | void addWidthInfoFromRange(int16_t defaultWidth, |
| 73 | const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry); |
| 74 | }; |
| 75 | |
| 76 | class SkPDFType3Font : public SkPDFFont { |
| 77 | public: |
| 78 | virtual ~SkPDFType3Font(); |
| 79 | virtual bool multiByteGlyphs() const { return false; } |
| 80 | |
| 81 | private: |
| 82 | friend class SkPDFFont; // to access the constructor |
| 83 | |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 84 | SkPDFType3Font(SkPDFCanon* canon, |
| 85 | const SkAdvancedTypefaceMetrics* info, |
| 86 | SkTypeface* typeface, |
| 87 | uint16_t glyphID); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 88 | |
bungeman | 22edc83 | 2014-10-03 07:55:58 -0700 | [diff] [blame] | 89 | bool populate(uint16_t glyphID); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | #endif |