SkPDFFontImpl.h revision 9859428e71c6041928e6dd741ae3284017e78e81
10dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar/* 20dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * Copyright (C) 2011 Google Inc. 30dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * 40dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * Licensed under the Apache License, Version 2.0 (the "License"); 50dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * you may not use this file except in compliance with the License. 60dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * You may obtain a copy of the License at 70dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * 80dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * http://www.apache.org/licenses/LICENSE-2.0 90dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * 100dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * Unless required by applicable law or agreed to in writing, software 110dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * distributed under the License is distributed on an "AS IS" BASIS, 120dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * See the License for the specific language governing permissions and 140dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar * limitations under the License. 150dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar */ 160dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar 170dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar#ifndef SkPDFFontImpl_DEFINED 1840a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar#define SkPDFFontImpl_DEFINED 190dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar 200dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar#include "SkPDFFont.h" 2146f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbar 2246f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbarclass SkPDFType0Font : public SkPDFFont { 2388c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarpublic: 2488c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar virtual ~SkPDFType0Font(); 2588c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar virtual bool multiByteGlyphs() const { return true; } 260dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar SK_API virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); 27761d7f78e2dac7ea5f35828c2271e60d91e106ceDevang Patel#ifdef SK_DEBUG 2888c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, 2988c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar bool indirect); 300dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar#endif 310dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar 320dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbarprivate: 330dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar friend class SkPDFFont; // to access the constructor 340dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar#ifdef SK_DEBUG 350dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar bool fPopulated; 360dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar typedef SkPDFDict INHERITED; 370dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar#endif 380dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar 390dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar SkPDFType0Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface); 407c086516f3cc9fba2733b1919973206c6ba4b171Daniel Dunbar 410dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar bool populate(const SkPDFGlyphSet* subset); 420dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar}; 43761d7f78e2dac7ea5f35828c2271e60d91e106ceDevang Patel 440dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbarclass SkPDFCIDFont : public SkPDFFont { 450dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbarpublic: 460dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar virtual ~SkPDFCIDFont(); 4746f45b9bec4a265ad8400a538e5ec3a5683617f1Daniel Dunbar virtual bool multiByteGlyphs() const { return true; } 480dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar 497c086516f3cc9fba2733b1919973206c6ba4b171Daniel Dunbarprivate: 507c086516f3cc9fba2733b1919973206c6ba4b171Daniel Dunbar friend class SkPDFType0Font; // to access the constructor 517c086516f3cc9fba2733b1919973206c6ba4b171Daniel Dunbar 527c086516f3cc9fba2733b1919973206c6ba4b171Daniel Dunbar SkPDFCIDFont(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, 537c086516f3cc9fba2733b1919973206c6ba4b171Daniel Dunbar const SkPDFGlyphSet* subset); 545323a4b0a1c248fa2ffdf886bb41a5d8fba71d2dDaniel Dunbar 550dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar bool populate(const SkPDFGlyphSet* subset); 560dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar bool addFontDescriptor(int16_t defaultWidth, const SkPDFGlyphSet* subset); 5740a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar}; 5888c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar 5988c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarclass SkPDFType1Font : public SkPDFFont { 6088c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarpublic: 6188c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar virtual ~SkPDFType1Font(); 6288c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar virtual bool multiByteGlyphs() const { return false; } 6388c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar 6488c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarprivate: 650dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar friend class SkPDFFont; // to access the constructor 660dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar 6788c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar SkPDFType1Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, 6888c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar uint16_t glyphID, SkPDFDict* relatedFontDescriptor); 69a0a99e02f5b2de3817706071077298ef040634feDaniel Dunbar 70541b63b1a9db77e4a8670e9823711c2c12e58afbDaniel Dunbar bool populate(int16_t glyphID); 71541b63b1a9db77e4a8670e9823711c2c12e58afbDaniel Dunbar bool addFontDescriptor(int16_t defaultWidth); 7288c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar void addWidthInfoFromRange(int16_t defaultWidth, 7388c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar const SkAdvancedTypefaceMetrics::WidthRange* widthRangeEntry); 7488c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar}; 7588c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar 7688c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarclass SkPDFType3Font : public SkPDFFont { 7788c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarpublic: 780dbe227feccf6a8dbadfff8ca3f80416b7bf2f28Daniel Dunbar virtual ~SkPDFType3Font(); 7988c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar virtual bool multiByteGlyphs() const { return false; } 80bb36d331f439f49859efcfb4435c61762fbba6f9Daniel Dunbar 8188c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbarprivate: 8288c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar friend class SkPDFFont; // to access the constructor 8340a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar 8440a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar SkPDFType3Font(SkAdvancedTypefaceMetrics* info, SkTypeface* typeface, 8588c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar uint16_t glyphID, SkPDFDict* relatedFontDescriptor); 8688c2fa96be989571b4afb6229f0ef5a3ef4450cbDaniel Dunbar 8740a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar bool populate(int16_t glyphID); 8840a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar}; 8940a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar 9040a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar#endif 9140a6be686e5d5bb4198f1affda574e8a4b3a7710Daniel Dunbar