Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: src/pdf/SkPDFFont.h

Issue 111893002: Revert "[PDF] Fix font embedding restrictions." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPDFFont_DEFINED 10 #ifndef SkPDFFont_DEFINED
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 /** Returns the font type represented in this font. For Type0 fonts, 93 /** Returns the font type represented in this font. For Type0 fonts,
94 * returns the type of the decendant font. 94 * returns the type of the decendant font.
95 */ 95 */
96 virtual SkAdvancedTypefaceMetrics::FontType getType(); 96 virtual SkAdvancedTypefaceMetrics::FontType getType();
97 97
98 /** Returns true if this font encoding supports glyph IDs above 255. 98 /** Returns true if this font encoding supports glyph IDs above 255.
99 */ 99 */
100 virtual bool multiByteGlyphs() const = 0; 100 virtual bool multiByteGlyphs() const = 0;
101 101
102 /** Returns true if the machine readable licensing bits allow embedding.
103 */
104 bool canEmbed() const;
105
106 /** Returns true if the machine readable licensing bits allow subsetting.
107 */
108 bool canSubset() const;
109
110 /** Return true if this font has an encoding for the passed glyph id. 102 /** Return true if this font has an encoding for the passed glyph id.
111 */ 103 */
112 bool hasGlyph(uint16_t glyphID); 104 bool hasGlyph(uint16_t glyphID);
113 105
114 /** Convert (in place) the input glyph IDs into the font encoding. If the 106 /** Convert (in place) the input glyph IDs into the font encoding. If the
115 * font has more glyphs than can be encoded (like a type 1 font with more 107 * font has more glyphs than can be encoded (like a type 1 font with more
116 * than 255 glyphs) this method only converts up to the first out of range 108 * than 255 glyphs) this method only converts up to the first out of range
117 * glyph ID. 109 * glyph ID.
118 * @param glyphIDs The input text as glyph IDs. 110 * @param glyphIDs The input text as glyph IDs.
119 * @param numGlyphs The number of input glyphs. 111 * @param numGlyphs The number of input glyphs.
120 * @return Returns the number of glyphs consumed. 112 * @return Returns the number of glyphs consumed.
121 */ 113 */
122 size_t glyphsToPDFFontEncoding(uint16_t* glyphIDs, size_t numGlyphs); 114 size_t glyphsToPDFFontEncoding(uint16_t* glyphIDs, size_t numGlyphs);
123 115
124 /** Get the font resource for the passed typeface and glyphID. The 116 /** Get the font resource for the passed typeface and glyphID. The
125 * reference count of the object is incremented and it is the caller's 117 * reference count of the object is incremented and it is the caller's
126 * responsibility to unreference it when done. This is needed to 118 * responsibility to unreference it when done. This is needed to
127 * accommodate the weak reference pattern used when the returned object 119 * accommodate the weak reference pattern used when the returned object
128 * is new and has no other references. 120 * is new and has no other references.
129 * @param typeface The typeface to find. 121 * @param typeface The typeface to find.
130 * @param glyphID Specify which section of a large font is of interest. 122 * @param glyphID Specify which section of a large font is of interest.
131 */ 123 */
132 static SkPDFFont* GetFontResource(SkTypeface* typeface, uint16_t glyphID); 124 static SkPDFFont* GetFontResource(SkTypeface* typeface,
125 uint16_t glyphID);
133 126
134 /** Subset the font based on usage set. Returns a SkPDFFont instance with 127 /** Subset the font based on usage set. Returns a SkPDFFont instance with
135 * subset. 128 * subset.
136 * @param usage Glyph subset requested. 129 * @param usage Glyph subset requested.
137 * @return NULL if font does not support subsetting, a new instance 130 * @return NULL if font does not support subsetting, a new instance
138 * of SkPDFFont otherwise. 131 * of SkPDFFont otherwise.
139 */ 132 */
140 virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); 133 virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage);
141 134
142 protected: 135 protected:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool operator==(const FontRec& b) const; 181 bool operator==(const FontRec& b) const;
189 FontRec(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID); 182 FontRec(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID);
190 }; 183 };
191 184
192 SkAutoTUnref<SkTypeface> fTypeface; 185 SkAutoTUnref<SkTypeface> fTypeface;
193 186
194 // The glyph IDs accessible with this font. For Type1 (non CID) fonts, 187 // The glyph IDs accessible with this font. For Type1 (non CID) fonts,
195 // this will be a subset if the font has more than 255 glyphs. 188 // this will be a subset if the font has more than 255 glyphs.
196 uint16_t fFirstGlyphID; 189 uint16_t fFirstGlyphID;
197 uint16_t fLastGlyphID; 190 uint16_t fLastGlyphID;
191 // The font info is only kept around after construction for large
192 // Type1 (non CID) fonts that need multiple "fonts" to access all glyphs.
198 SkAutoTUnref<SkAdvancedTypefaceMetrics> fFontInfo; 193 SkAutoTUnref<SkAdvancedTypefaceMetrics> fFontInfo;
199 SkTDArray<SkPDFObject*> fResources; 194 SkTDArray<SkPDFObject*> fResources;
200 SkAutoTUnref<SkPDFDict> fDescriptor; 195 SkAutoTUnref<SkPDFDict> fDescriptor;
201 196
202 SkAdvancedTypefaceMetrics::FontType fFontType; 197 SkAdvancedTypefaceMetrics::FontType fFontType;
203 198
204 // This should be made a hash table if performance is a problem. 199 // This should be made a hash table if performance is a problem.
205 static SkTDArray<FontRec>& CanonicalFonts(); 200 static SkTDArray<FontRec>& CanonicalFonts();
206 static SkBaseMutex& CanonicalFontsMutex(); 201 static SkBaseMutex& CanonicalFontsMutex();
207 typedef SkPDFDict INHERITED; 202 typedef SkPDFDict INHERITED;
208 }; 203 };
209 204
210 #endif 205 #endif
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698