vandebo@chromium.org | 9859428 | 2011-07-25 22:34:12 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2011 Google Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef SkPDFFontImpl_DEFINED |
| 18 | #define SkPDFFontImpl_DEFINED |
| 19 | |
| 20 | #include "SkPDFFont.h" |
| 21 | |
| 22 | class SkPDFType0Font : public SkPDFFont { |
| 23 | public: |
| 24 | virtual ~SkPDFType0Font(); |
| 25 | virtual bool multiByteGlyphs() const { return true; } |
| 26 | SK_API virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); |
| 27 | #ifdef SK_DEBUG |
| 28 | virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, |
| 29 | bool indirect); |
| 30 | #endif |
| 31 | |
| 32 | private: |
| 33 | friend class SkPDFFont; // to access the constructor |
| 34 | #ifdef SK_DEBUG |
| 35 | bool fPopulated; |
| 36 | typedef SkPDFDict INHERITED; |
| 37 | #endif |
| 38 | |
| 39 | SkPDFType0Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface); |
| 40 | |
| 41 | bool populate(const SkPDFGlyphSet* subset); |
| 42 | }; |
| 43 | |
| 44 | class SkPDFCIDFont : public SkPDFFont { |
| 45 | public: |
| 46 | virtual ~SkPDFCIDFont(); |
| 47 | virtual bool multiByteGlyphs() const { return true; } |
| 48 | |
| 49 | private: |
| 50 | friend class SkPDFType0Font; // to access the constructor |
| 51 | |
| 52 | SkPDFCIDFont(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, |
| 53 | const SkPDFGlyphSet* subset); |
| 54 | |
| 55 | bool populate(const SkPDFGlyphSet* subset); |
| 56 | bool addFontDescriptor(int16_t defaultWidth, const SkPDFGlyphSet* subset); |
| 57 | }; |
| 58 | |
| 59 | class SkPDFType1Font : public SkPDFFont { |
| 60 | public: |
| 61 | virtual ~SkPDFType1Font(); |
| 62 | virtual bool multiByteGlyphs() const { return false; } |
| 63 | |
| 64 | private: |
| 65 | friend class SkPDFFont; // to access the constructor |
| 66 | |
| 67 | SkPDFType1Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, |
| 68 | uint16_t glyphID, SkPDFDict* relatedFontDescriptor); |
| 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 | |
| 84 | SkPDFType3Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, |
| 85 | uint16_t glyphID, SkPDFDict* relatedFontDescriptor); |
| 86 | |
| 87 | bool populate(int16_t glyphID); |
| 88 | }; |
| 89 | |
| 90 | #endif |