1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
29859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2011 Google Inc.
49859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
79859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org */
89859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
109859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#ifndef SkPDFFontImpl_DEFINED
119859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#define SkPDFFontImpl_DEFINED
129859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
139859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#include "SkPDFFont.h"
149859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
1570d1554d8ea08ddb887550f98b9cfd0afd395d65halcanaryclass SkPDFType0Font final : public SkPDFFont {
169859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgpublic:
179859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual ~SkPDFType0Font();
183a30cc1cbb2f42bcbd0695cb994a5f1a52754a89mtklein    bool multiByteGlyphs() const override { return true; }
193a30cc1cbb2f42bcbd0695cb994a5f1a52754a89mtklein    SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage) override;
209859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#ifdef SK_DEBUG
21a060eba0836f98902ca078d5f9fc6191ba0c0a52halcanary    void emitObject(SkWStream*,
22a060eba0836f98902ca078d5f9fc6191ba0c0a52halcanary                    const SkPDFObjNumMap&,
23a060eba0836f98902ca078d5f9fc6191ba0c0a52halcanary                    const SkPDFSubstituteMap&) const override;
249859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#endif
259859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
269859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgprivate:
279859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    friend class SkPDFFont;  // to access the constructor
289859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#ifdef SK_DEBUG
299859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    bool fPopulated;
309859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    typedef SkPDFDict INHERITED;
319859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#endif
329859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
332e3f9d8a9309686eeb4c76ccfde5800da87a68b3halcanary    SkPDFType0Font(const SkAdvancedTypefaceMetrics* info,
34792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                   SkTypeface* typeface);
359859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
369859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    bool populate(const SkPDFGlyphSet* subset);
379859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org};
389859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
3970d1554d8ea08ddb887550f98b9cfd0afd395d65halcanaryclass SkPDFCIDFont final : public SkPDFFont {
409859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgpublic:
419859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual ~SkPDFCIDFont();
429859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual bool multiByteGlyphs() const { return true; }
439859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
449859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgprivate:
459859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    friend class SkPDFType0Font;  // to access the constructor
469859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
472e3f9d8a9309686eeb4c76ccfde5800da87a68b3halcanary    SkPDFCIDFont(const SkAdvancedTypefaceMetrics* info,
48792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                 SkTypeface* typeface,
499859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org                 const SkPDFGlyphSet* subset);
509859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
519859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    bool populate(const SkPDFGlyphSet* subset);
5237ad8fb72ff1b3faac93b01ead2c79e1a06fc172vandebo@chromium.org    bool addFontDescriptor(int16_t defaultWidth,
5337ad8fb72ff1b3faac93b01ead2c79e1a06fc172vandebo@chromium.org                           const SkTDArray<uint32_t>* subset);
549859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org};
559859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
5670d1554d8ea08ddb887550f98b9cfd0afd395d65halcanaryclass SkPDFType1Font final : public SkPDFFont {
579859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgpublic:
589859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual ~SkPDFType1Font();
599859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual bool multiByteGlyphs() const { return false; }
609859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
619859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgprivate:
629859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    friend class SkPDFFont;  // to access the constructor
639859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
642e3f9d8a9309686eeb4c76ccfde5800da87a68b3halcanary    SkPDFType1Font(const SkAdvancedTypefaceMetrics* info,
65792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                   SkTypeface* typeface,
66792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                   uint16_t glyphID,
67792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                   SkPDFDict* relatedFontDescriptor);
689859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
699859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    bool populate(int16_t glyphID);
709859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    bool addFontDescriptor(int16_t defaultWidth);
719859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    void addWidthInfoFromRange(int16_t defaultWidth,
729859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org        const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry);
739859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org};
749859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
7570d1554d8ea08ddb887550f98b9cfd0afd395d65halcanaryclass SkPDFType3Font final : public SkPDFFont {
769859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgpublic:
779859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual ~SkPDFType3Font();
789859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    virtual bool multiByteGlyphs() const { return false; }
799859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
809859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.orgprivate:
819859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org    friend class SkPDFFont;  // to access the constructor
829859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
832e3f9d8a9309686eeb4c76ccfde5800da87a68b3halcanary    SkPDFType3Font(const SkAdvancedTypefaceMetrics* info,
84792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                   SkTypeface* typeface,
85792c80f5a7b66e75d42664ccb298f31962c6654chalcanary                   uint16_t glyphID);
869859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
8722edc8310cd57ab02155bfa6b2ddaf830556bcafbungeman    bool populate(uint16_t glyphID);
889859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org};
899859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org
909859428e71c6041928e6dd741ae3284017e78e81vandebo@chromium.org#endif
91