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 | |
halcanary | 70d1554 | 2015-11-22 12:55:04 -0800 | [diff] [blame] | 15 | class SkPDFType0Font final : public SkPDFFont { |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 16 | public: |
| 17 | virtual ~SkPDFType0Font(); |
mtklein | 3a30cc1 | 2015-08-19 14:01:42 -0700 | [diff] [blame] | 18 | bool multiByteGlyphs() const override { return true; } |
| 19 | SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage) override; |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 20 | #ifdef SK_DEBUG |
halcanary | a060eba | 2015-08-19 12:26:46 -0700 | [diff] [blame] | 21 | void emitObject(SkWStream*, |
| 22 | const SkPDFObjNumMap&, |
| 23 | const SkPDFSubstituteMap&) const override; |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 24 | #endif |
| 25 | |
| 26 | private: |
| 27 | friend class SkPDFFont; // to access the constructor |
| 28 | #ifdef SK_DEBUG |
| 29 | bool fPopulated; |
| 30 | typedef SkPDFDict INHERITED; |
| 31 | #endif |
| 32 | |
halcanary | 2e3f9d8 | 2015-02-27 12:41:03 -0800 | [diff] [blame] | 33 | SkPDFType0Font(const SkAdvancedTypefaceMetrics* info, |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 34 | SkTypeface* typeface); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 35 | |
| 36 | bool populate(const SkPDFGlyphSet* subset); |
| 37 | }; |
| 38 | |
halcanary | 70d1554 | 2015-11-22 12:55:04 -0800 | [diff] [blame] | 39 | class SkPDFCIDFont final : public SkPDFFont { |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 40 | public: |
| 41 | virtual ~SkPDFCIDFont(); |
| 42 | virtual bool multiByteGlyphs() const { return true; } |
| 43 | |
| 44 | private: |
| 45 | friend class SkPDFType0Font; // to access the constructor |
| 46 | |
halcanary | 2e3f9d8 | 2015-02-27 12:41:03 -0800 | [diff] [blame] | 47 | SkPDFCIDFont(const SkAdvancedTypefaceMetrics* info, |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 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 | |
halcanary | 70d1554 | 2015-11-22 12:55:04 -0800 | [diff] [blame] | 56 | class SkPDFType1Font final : public SkPDFFont { |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 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 | 2e3f9d8 | 2015-02-27 12:41:03 -0800 | [diff] [blame] | 64 | SkPDFType1Font(const SkAdvancedTypefaceMetrics* info, |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 65 | SkTypeface* typeface, |
| 66 | uint16_t glyphID, |
| 67 | SkPDFDict* relatedFontDescriptor); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 68 | |
| 69 | bool populate(int16_t glyphID); |
| 70 | bool addFontDescriptor(int16_t defaultWidth); |
| 71 | void addWidthInfoFromRange(int16_t defaultWidth, |
| 72 | const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry); |
| 73 | }; |
| 74 | |
halcanary | 70d1554 | 2015-11-22 12:55:04 -0800 | [diff] [blame] | 75 | class SkPDFType3Font final : public SkPDFFont { |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 76 | public: |
| 77 | virtual ~SkPDFType3Font(); |
| 78 | virtual bool multiByteGlyphs() const { return false; } |
| 79 | |
| 80 | private: |
| 81 | friend class SkPDFFont; // to access the constructor |
| 82 | |
halcanary | 2e3f9d8 | 2015-02-27 12:41:03 -0800 | [diff] [blame] | 83 | SkPDFType3Font(const SkAdvancedTypefaceMetrics* info, |
halcanary | 792c80f | 2015-02-20 07:21:05 -0800 | [diff] [blame] | 84 | SkTypeface* typeface, |
| 85 | uint16_t glyphID); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 86 | |
bungeman | 22edc83 | 2014-10-03 07:55:58 -0700 | [diff] [blame] | 87 | bool populate(uint16_t glyphID); |
vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | #endif |