blob: 71f78bd4a67635969b69d1cc5fad646c3684cccb [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
halcanary70d15542015-11-22 12:55:04 -080015class SkPDFType0Font final : public SkPDFFont {
vandebo@chromium.org98594282011-07-25 22:34:12 +000016public:
17 virtual ~SkPDFType0Font();
mtklein3a30cc12015-08-19 14:01:42 -070018 bool multiByteGlyphs() const override { return true; }
19 SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage) override;
vandebo@chromium.org98594282011-07-25 22:34:12 +000020#ifdef SK_DEBUG
halcanarya060eba2015-08-19 12:26:46 -070021 void emitObject(SkWStream*,
22 const SkPDFObjNumMap&,
23 const SkPDFSubstituteMap&) const override;
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
halcanary70d15542015-11-22 12:55:04 -080039class SkPDFCIDFont final : public SkPDFFont {
vandebo@chromium.org98594282011-07-25 22:34:12 +000040public:
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
halcanary70d15542015-11-22 12:55:04 -080056class SkPDFType1Font final : public SkPDFFont {
vandebo@chromium.org98594282011-07-25 22:34:12 +000057public:
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
halcanary70d15542015-11-22 12:55:04 -080075class SkPDFType3Font final : public SkPDFFont {
vandebo@chromium.org98594282011-07-25 22:34:12 +000076public:
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