aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFFontImpl.h
blob: 4b49683a5ab86a495e085f5f81e6e3da7ab4e8bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SkPDFFontImpl_DEFINED
#define SkPDFFontImpl_DEFINED

#include "SkPDFFont.h"

class SkPDFType0Font : public SkPDFFont {
public:
    virtual ~SkPDFType0Font();
    virtual bool multiByteGlyphs() const { return true; }
    SK_API virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage);
#ifdef SK_DEBUG
    virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog,
                            bool indirect);
#endif

private:
    friend class SkPDFFont;  // to access the constructor
#ifdef SK_DEBUG
    bool fPopulated;
    typedef SkPDFDict INHERITED;
#endif

    SkPDFType0Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface);

    bool populate(const SkPDFGlyphSet* subset);
};

class SkPDFCIDFont : public SkPDFFont {
public:
    virtual ~SkPDFCIDFont();
    virtual bool multiByteGlyphs() const { return true; }

private:
    friend class SkPDFType0Font;  // to access the constructor

    SkPDFCIDFont(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface,
                 const SkPDFGlyphSet* subset);

    bool populate(const SkPDFGlyphSet* subset);
    bool addFontDescriptor(int16_t defaultWidth,
                           const SkTDArray<uint32_t>* subset);
};

class SkPDFType1Font : public SkPDFFont {
public:
    virtual ~SkPDFType1Font();
    virtual bool multiByteGlyphs() const { return false; }

private:
    friend class SkPDFFont;  // to access the constructor

    SkPDFType1Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface,
                   uint16_t glyphID, SkPDFDict* relatedFontDescriptor);

    bool populate(int16_t glyphID);
    bool addFontDescriptor(int16_t defaultWidth);
    void addWidthInfoFromRange(int16_t defaultWidth,
        const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry);
};

class SkPDFType3Font : public SkPDFFont {
public:
    virtual ~SkPDFType3Font();
    virtual bool multiByteGlyphs() const { return false; }

private:
    friend class SkPDFFont;  // to access the constructor

    SkPDFType3Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, uint16_t glyphID);

    bool populate(int16_t glyphID);
};

#endif