blob: cc7a4a1fd5143bc4715bb036d4c774a44aba676f [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
halcanary37c46ca2015-03-31 12:30:20 -070021 virtual void emitObject(SkWStream*,
22 const SkPDFObjNumMap&,
23 const SkPDFSubstituteMap&);
vandebo@chromium.org98594282011-07-25 22:34:12 +000024#endif
25
26private:
27 friend class SkPDFFont; // to access the constructor
28#ifdef SK_DEBUG
29 bool fPopulated;
30 typedef SkPDFDict INHERITED;
31#endif
32
halcanary2e3f9d82015-02-27 12:41:03 -080033 SkPDFType0Font(const SkAdvancedTypefaceMetrics* info,
halcanary792c80f2015-02-20 07:21:05 -080034 SkTypeface* typeface);
vandebo@chromium.org98594282011-07-25 22:34:12 +000035
36 bool populate(const SkPDFGlyphSet* subset);
37};
38
39class SkPDFCIDFont : public SkPDFFont {
40public:
41 virtual ~SkPDFCIDFont();
42 virtual bool multiByteGlyphs() const { return true; }
43
44private:
45 friend class SkPDFType0Font; // to access the constructor
46
halcanary2e3f9d82015-02-27 12:41:03 -080047 SkPDFCIDFont(const SkAdvancedTypefaceMetrics* info,
halcanary792c80f2015-02-20 07:21:05 -080048 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
halcanary2e3f9d82015-02-27 12:41:03 -080064 SkPDFType1Font(const SkAdvancedTypefaceMetrics* info,
halcanary792c80f2015-02-20 07:21:05 -080065 SkTypeface* typeface,
66 uint16_t glyphID,
67 SkPDFDict* relatedFontDescriptor);
vandebo@chromium.org98594282011-07-25 22:34:12 +000068
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
75class SkPDFType3Font : public SkPDFFont {
76public:
77 virtual ~SkPDFType3Font();
78 virtual bool multiByteGlyphs() const { return false; }
79
80private:
81 friend class SkPDFFont; // to access the constructor
82
halcanary2e3f9d82015-02-27 12:41:03 -080083 SkPDFType3Font(const SkAdvancedTypefaceMetrics* info,
halcanary792c80f2015-02-20 07:21:05 -080084 SkTypeface* typeface,
85 uint16_t glyphID);
vandebo@chromium.org98594282011-07-25 22:34:12 +000086
bungeman22edc832014-10-03 07:55:58 -070087 bool populate(uint16_t glyphID);
vandebo@chromium.org98594282011-07-25 22:34:12 +000088};
89
90#endif