blob: 4c3e525985c55e8b95df49e9b69c0d71ccd238cd [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
vandebo@chromium.org98594282011-07-25 22:34:12 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
vandebo@chromium.org98594282011-07-25 22:34:12 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
vandebo@chromium.org98594282011-07-25 22:34:12 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
vandebo@chromium.org98594282011-07-25 22:34:12 +000010#ifndef SkPDFFontImpl_DEFINED
11#define SkPDFFontImpl_DEFINED
12
13#include "SkPDFFont.h"
14
15class SkPDFType0Font : public SkPDFFont {
16public:
17 virtual ~SkPDFType0Font();
18 virtual bool multiByteGlyphs() const { return true; }
halcanary4e4e8162015-02-25 08:59:48 -080019 virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage);
vandebo@chromium.org98594282011-07-25 22:34:12 +000020#ifdef SK_DEBUG
halcanary4fc48af2015-01-12 10:07:50 -080021 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog);
vandebo@chromium.org98594282011-07-25 22:34:12 +000022#endif
23
24private:
25 friend class SkPDFFont; // to access the constructor
26#ifdef SK_DEBUG
27 bool fPopulated;
28 typedef SkPDFDict INHERITED;
29#endif
30
halcanary792c80f2015-02-20 07:21:05 -080031 SkPDFType0Font(SkPDFCanon* canon,
32 const SkAdvancedTypefaceMetrics* info,
33 SkTypeface* typeface);
vandebo@chromium.org98594282011-07-25 22:34:12 +000034
35 bool populate(const SkPDFGlyphSet* subset);
36};
37
38class SkPDFCIDFont : public SkPDFFont {
39public:
40 virtual ~SkPDFCIDFont();
41 virtual bool multiByteGlyphs() const { return true; }
42
43private:
44 friend class SkPDFType0Font; // to access the constructor
45
halcanary792c80f2015-02-20 07:21:05 -080046 SkPDFCIDFont(SkPDFCanon* canon,
47 const SkAdvancedTypefaceMetrics* info,
48 SkTypeface* typeface,
vandebo@chromium.org98594282011-07-25 22:34:12 +000049 const SkPDFGlyphSet* subset);
50
51 bool populate(const SkPDFGlyphSet* subset);
vandebo@chromium.org37ad8fb2011-08-18 02:38:50 +000052 bool addFontDescriptor(int16_t defaultWidth,
53 const SkTDArray<uint32_t>* subset);
vandebo@chromium.org98594282011-07-25 22:34:12 +000054};
55
56class SkPDFType1Font : public SkPDFFont {
57public:
58 virtual ~SkPDFType1Font();
59 virtual bool multiByteGlyphs() const { return false; }
60
61private:
62 friend class SkPDFFont; // to access the constructor
63
halcanary792c80f2015-02-20 07:21:05 -080064 SkPDFType1Font(SkPDFCanon* canon,
65 const SkAdvancedTypefaceMetrics* info,
66 SkTypeface* typeface,
67 uint16_t glyphID,
68 SkPDFDict* relatedFontDescriptor);
vandebo@chromium.org98594282011-07-25 22:34:12 +000069
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
76class SkPDFType3Font : public SkPDFFont {
77public:
78 virtual ~SkPDFType3Font();
79 virtual bool multiByteGlyphs() const { return false; }
80
81private:
82 friend class SkPDFFont; // to access the constructor
83
halcanary792c80f2015-02-20 07:21:05 -080084 SkPDFType3Font(SkPDFCanon* canon,
85 const SkAdvancedTypefaceMetrics* info,
86 SkTypeface* typeface,
87 uint16_t glyphID);
vandebo@chromium.org98594282011-07-25 22:34:12 +000088
bungeman22edc832014-10-03 07:55:58 -070089 bool populate(uint16_t glyphID);
vandebo@chromium.org98594282011-07-25 22:34:12 +000090};
91
92#endif