blob: 842e1c954711929c259dc7644067b6adbce63cb2 [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; }
19 SK_API virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage);
20#ifdef SK_DEBUG
21 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog,
22 bool indirect);
23#endif
24
25private:
26 friend class SkPDFFont; // to access the constructor
27#ifdef SK_DEBUG
28 bool fPopulated;
29 typedef SkPDFDict INHERITED;
30#endif
31
halcanaryfb747e22014-07-11 19:45:23 -070032 SkPDFType0Font(const SkAdvancedTypefaceMetrics* info, SkTypeface* typeface);
vandebo@chromium.org98594282011-07-25 22:34:12 +000033
34 bool populate(const SkPDFGlyphSet* subset);
35};
36
37class SkPDFCIDFont : public SkPDFFont {
38public:
39 virtual ~SkPDFCIDFont();
40 virtual bool multiByteGlyphs() const { return true; }
41
42private:
43 friend class SkPDFType0Font; // to access the constructor
44
halcanaryfb747e22014-07-11 19:45:23 -070045 SkPDFCIDFont(const SkAdvancedTypefaceMetrics* info, SkTypeface* typeface,
vandebo@chromium.org98594282011-07-25 22:34:12 +000046 const SkPDFGlyphSet* subset);
47
48 bool populate(const SkPDFGlyphSet* subset);
vandebo@chromium.org37ad8fb2011-08-18 02:38:50 +000049 bool addFontDescriptor(int16_t defaultWidth,
50 const SkTDArray<uint32_t>* subset);
vandebo@chromium.org98594282011-07-25 22:34:12 +000051};
52
53class SkPDFType1Font : public SkPDFFont {
54public:
55 virtual ~SkPDFType1Font();
56 virtual bool multiByteGlyphs() const { return false; }
57
58private:
59 friend class SkPDFFont; // to access the constructor
60
halcanaryfb747e22014-07-11 19:45:23 -070061 SkPDFType1Font(const SkAdvancedTypefaceMetrics* info, SkTypeface* typeface,
vandebo@chromium.org98594282011-07-25 22:34:12 +000062 uint16_t glyphID, SkPDFDict* relatedFontDescriptor);
63
64 bool populate(int16_t glyphID);
65 bool addFontDescriptor(int16_t defaultWidth);
66 void addWidthInfoFromRange(int16_t defaultWidth,
67 const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry);
68};
69
70class SkPDFType3Font : public SkPDFFont {
71public:
72 virtual ~SkPDFType3Font();
73 virtual bool multiByteGlyphs() const { return false; }
74
75private:
76 friend class SkPDFFont; // to access the constructor
77
halcanaryfb747e22014-07-11 19:45:23 -070078 SkPDFType3Font(const SkAdvancedTypefaceMetrics* info,
79 SkTypeface* typeface, uint16_t glyphID);
vandebo@chromium.org98594282011-07-25 22:34:12 +000080
bungeman22edc832014-10-03 07:55:58 -070081 bool populate(uint16_t glyphID);
vandebo@chromium.org98594282011-07-25 22:34:12 +000082};
83
84#endif