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

Side by Side Diff: experimental/PdfViewer/SkPdfFont.cpp

Issue 18323019: work on the native parser, in progress, uploaded to have a backup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months 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 | « experimental/PdfViewer/SkPdfFont.h ('k') | experimental/PdfViewer/SkPdfParser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkPdfFont.h" 1 #include "SkPdfFont.h"
2 #include "SkPdfParser.h" 2 #include "SkPdfParser.h"
3 3
4 #include "SkStream.h" 4 #include "SkStream.h"
5 #include "SkTypeface.h" 5 #include "SkTypeface.h"
6 #include "SkPdfPodofoTokenizer.h" 6 #include "SkPdfNativeTokenizer.h"
7 7
8 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts() { 8 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts() {
9 static std::map<std::string, SkPdfStandardFontEntry> gPdfStandardFonts; 9 static std::map<std::string, SkPdfStandardFontEntry> gPdfStandardFonts;
10 10
11 // TODO (edisonn): , vs - ? what does it mean? 11 // TODO (edisonn): , vs - ? what does it mean?
12 // TODO (edisonn): MT, PS, Oblique=italic?, ... what does it mean? 12 // TODO (edisonn): MT, PS, Oblique=italic?, ... what does it mean?
13 if (gPdfStandardFonts.empty()) { 13 if (gPdfStandardFonts.empty()) {
14 gPdfStandardFonts["Arial"] = {"Arial", false, false}; 14 gPdfStandardFonts["Arial"] = {"Arial", false, false};
15 gPdfStandardFonts["Arial,Bold"] = {"Arial", true, false}; 15 gPdfStandardFonts["Arial,Bold"] = {"Arial", true, false};
16 gPdfStandardFonts["Arial,BoldItalic"] = {"Arial", true, true}; 16 gPdfStandardFonts["Arial,BoldItalic"] = {"Arial", true, true};
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 fontName, 142 fontName,
143 SkTypeface::kNormal); 143 SkTypeface::kNormal);
144 } 144 }
145 145
146 if (typeface) { 146 if (typeface) {
147 typeface->ref(); 147 typeface->ref();
148 } 148 }
149 return typeface; 149 return typeface;
150 } 150 }
151 151
152 SkPdfFont* SkPdfFont::fontFromFontDescriptor(SkPdfFontDescriptorDictionary* fd, bool loadFromName) { 152 SkPdfFont* SkPdfFont::fontFromFontDescriptor(SkNativeParsedPDF* doc, SkPdfFontDe scriptorDictionary* fd, bool loadFromName) {
153 // TODO(edisonn): partial implementation 153 // TODO(edisonn): partial implementation ... also const handling ...
154 // Only one, at most be available 154 // Only one, at most be available
155 SkPdfStream* pdfStream = NULL; 155 SkPdfStream* pdfStream = NULL;
156 if (fd->has_FontFile()) { 156 if (fd->has_FontFile()) {
157 pdfStream = fd->FontFile(); 157 pdfStream = fd->FontFile(doc);
158 } else if (fd->has_FontFile2()) { 158 } else if (fd->has_FontFile2()) {
159 pdfStream = fd->FontFile2(); 159 pdfStream = fd->FontFile2(doc);
160 } if (fd->has_FontFile3()) { 160 } if (fd->has_FontFile3()) {
161 pdfStream = fd->FontFile3(); 161 pdfStream = fd->FontFile3(doc);
162 } else { 162 } else {
163 if (loadFromName) { 163 if (loadFromName) {
164 return fontFromName(fd, fd->FontName().c_str()); 164 return fontFromName(doc, fd, fd->FontName(doc).c_str());
165 } 165 }
166 } 166 }
167 167
168 char* uncompressedStream = NULL; 168 unsigned char* uncompressedStream = NULL;
169 long uncompressedStreamLength = 0; 169 size_t uncompressedStreamLength = 0;
170 170
171 // TODO(edisonn): report warning to be used in testing. 171 // TODO(edisonn): report warning to be used in testing.
172 if (!pdfStream || 172 if (!pdfStream ||
173 !pdfStream->GetFilteredCopy(&uncompressedStream, &uncompressedStream Length) || 173 !pdfStream->GetFilteredStreamRef(&uncompressedStream, &uncompressedS treamLength, doc->allocator()) ||
174 !uncompressedStream || 174 !uncompressedStream ||
175 !uncompressedStreamLength) { 175 !uncompressedStreamLength) {
176 return NULL; 176 return NULL;
177 } 177 }
178 178
179 SkMemoryStream* skStream = new SkMemoryStream(uncompressedStream, uncompress edStreamLength); 179 SkMemoryStream* skStream = new SkMemoryStream(uncompressedStream, uncompress edStreamLength);
180 SkTypeface* face = SkTypeface::CreateFromStream(skStream); 180 SkTypeface* face = SkTypeface::CreateFromStream(skStream);
181 181
182 if (face == NULL) { 182 if (face == NULL) {
183 // TODO(edisonn): report warning to be used in testing. 183 // TODO(edisonn): report warning to be used in testing.
184 return NULL; 184 return NULL;
185 } 185 }
186 186
187 face->ref(); 187 face->ref();
188 188
189 return new SkPdfStandardFont(face); 189 return new SkPdfStandardFont(face);
190 } 190 }
191 191
192 SkPdfFont* fontFromName(SkPdfObject* obj, const char* fontName) { 192 SkPdfFont* fontFromName(SkNativeParsedPDF* doc, SkPdfObject* obj, const char* fo ntName) {
193 SkTypeface* typeface = SkTypefaceFromPdfStandardFont(fontName, false, false) ; 193 SkTypeface* typeface = SkTypefaceFromPdfStandardFont(fontName, false, false) ;
194 if (typeface != NULL) { 194 if (typeface != NULL) {
195 return new SkPdfStandardFont(typeface); 195 return new SkPdfStandardFont(typeface);
196 } 196 }
197 197
198 // TODO(edisonn): perf - make a map 198 // TODO(edisonn): perf - make a map
199 for (int i = 0 ; i < obj->doc()->objects(); i++) { 199 for (unsigned int i = 0 ; i < doc->objects(); i++) {
200 const SkPdfObject* podofoFont = obj->doc()->object(i); 200 SkPdfObject* obj = doc->object(i);
201 SkPdfFontDescriptorDictionary* fd = NULL; 201 if (!obj->isDictionary()) {
202 continue;
203 }
202 204
203 if (obj->doc()->mapper()->mapFontDescriptorDictionary(podofoFont, &fd)) { 205 SkPdfFontDescriptorDictionary* fd = obj->asDictionary()->asFontDescripto rDictionary();
204 if (fd->has_FontName() && fd->FontName() == fontName) { 206
205 SkPdfFont* font = SkPdfFont::fontFromFontDescriptor(fd, false); 207 if (!fd->valid()) {
206 if (font) { 208 continue;
207 return font; 209 }
208 } else { 210
209 // failed to load font descriptor 211 if (fd->has_FontName() && fd->FontName(doc) == fontName) {
210 break; 212 SkPdfFont* font = SkPdfFont::fontFromFontDescriptor(doc, fd, false);
211 } 213 if (font) {
214 return font;
215 } else {
216 // failed to load font descriptor
217 break;
212 } 218 }
213 } 219 }
214 } 220 }
215 221
216 // TODO(edisonn): warning/report issue 222 // TODO(edisonn): warning/report issue
217 return SkPdfFont::Default(); 223 return SkPdfFont::Default();
218 } 224 }
219 225
220 SkPdfFont* SkPdfFont::fontFromPdfDictionary(SkPdfFontDictionary* dict) { 226 SkPdfFont* SkPdfFont::fontFromPdfDictionaryOnce(SkNativeParsedPDF* doc, SkPdfFon tDictionary* dict) {
227 // TODO(edisonn): keep the type in a smart way in the SkPdfObject
228 // 1) flag, isResolved (1bit): reset at reset, add/remove/update (array) and set(dict)
229 // in a tree like structure, 3-4 bits for all the datatypes inheriting from obj (int, real, ...)
230 // if is a dict, reserveve a few bytes to encode type of dict, and so on lik e in a tree
231 // issue: type can be determined from context! atribute night be missing/wro ng
232 switch (doc->mapper()->mapFontDictionary(dict)) {
233 case kType0FontDictionary_SkPdfObjectType:
234 return fontFromType0FontDictionary(doc, dict->asType0FontDictionary( ));
235
236 case kTrueTypeFontDictionary_SkPdfObjectType:
237 return fontFromTrueTypeFontDictionary(doc, dict->asTrueTypeFontDicti onary());
238
239 case kType1FontDictionary_SkPdfObjectType:
240 return fontFromType1FontDictionary(doc, dict->asType1FontDictionary( ));
241
242 case kMultiMasterFontDictionary_SkPdfObjectType:
243 return fontFromMultiMasterFontDictionary(doc, dict->asMultiMasterFon tDictionary());
244
245 case kType3FontDictionary_SkPdfObjectType:
246 return fontFromType3FontDictionary(doc, dict->asType3FontDictionary( ));
247
248 default:
249 // TODO(edisonn): report error?
250 return NULL;
251 }
252 }
253
254 SkPdfFont* SkPdfFont::fontFromPdfDictionary(SkNativeParsedPDF* doc, SkPdfFontDic tionary* dict) {
221 if (dict == NULL) { 255 if (dict == NULL) {
222 return NULL; // TODO(edisonn): report default one? 256 return NULL; // TODO(edisonn): report default one?
223 } 257 }
224 258
225 switch (dict->getType()) { 259 if (dict->data() == NULL) {
226 case kType0FontDictionary_SkPdfObjectType: 260 dict->setData(fontFromPdfDictionaryOnce(doc, dict));
227 return fontFromType0FontDictionary(dict->asType0FontDictionary());
228
229 case kTrueTypeFontDictionary_SkPdfObjectType:
230 return fontFromTrueTypeFontDictionary(dict->asTrueTypeFontDictionary ());
231
232 case kType1FontDictionary_SkPdfObjectType:
233 return fontFromType1FontDictionary(dict->asType1FontDictionary());
234
235 case kMultiMasterFontDictionary_SkPdfObjectType:
236 return fontFromMultiMasterFontDictionary(dict->asMultiMasterFontDict ionary());
237
238 case kType3FontDictionary_SkPdfObjectType:
239 return fontFromType3FontDictionary(dict->asType3FontDictionary());
240 } 261 }
241 return NULL; // TODO(edisonn): report error? 262 return (SkPdfFont*)dict->data();
242 } 263 }
243 264
244 SkPdfType0Font* SkPdfFont::fontFromType0FontDictionary(SkPdfType0FontDictionary* dict) { 265
266
267 SkPdfType0Font* SkPdfFont::fontFromType0FontDictionary(SkNativeParsedPDF* doc, S kPdfType0FontDictionary* dict) {
245 if (dict == NULL) { 268 if (dict == NULL) {
246 return NULL; // default one? 269 return NULL; // default one?
247 } 270 }
248 271
249 return new SkPdfType0Font(dict); 272 return new SkPdfType0Font(doc, dict);
250 } 273 }
251 274
252 SkPdfType1Font* SkPdfFont:: fontFromType1FontDictionary(SkPdfType1FontDictionary * dict) { 275 SkPdfType1Font* SkPdfFont:: fontFromType1FontDictionary(SkNativeParsedPDF* doc, SkPdfType1FontDictionary* dict) {
253 if (dict == NULL) { 276 if (dict == NULL) {
254 return NULL; // default one? 277 return NULL; // default one?
255 } 278 }
256 279
257 return new SkPdfType1Font(dict); 280 return new SkPdfType1Font(doc, dict);
258 } 281 }
259 282
260 SkPdfType3Font* SkPdfFont::fontFromType3FontDictionary(SkPdfType3FontDictionary* dict) { 283 SkPdfType3Font* SkPdfFont::fontFromType3FontDictionary(SkNativeParsedPDF* doc, S kPdfType3FontDictionary* dict) {
261 if (dict == NULL) { 284 if (dict == NULL) {
262 return NULL; // default one? 285 return NULL; // default one?
263 } 286 }
264 287
265 288
266 289
267 return new SkPdfType3Font(dict); 290 return new SkPdfType3Font(doc, dict);
268 } 291 }
269 292
270 SkPdfTrueTypeFont* SkPdfFont::fontFromTrueTypeFontDictionary(SkPdfTrueTypeFontDi ctionary* dict) { 293 SkPdfTrueTypeFont* SkPdfFont::fontFromTrueTypeFontDictionary(SkNativeParsedPDF* doc, SkPdfTrueTypeFontDictionary* dict) {
271 if (dict == NULL) { 294 if (dict == NULL) {
272 return NULL; // default one? 295 return NULL; // default one?
273 } 296 }
274 297
275 return new SkPdfTrueTypeFont(dict); 298 return new SkPdfTrueTypeFont(doc, dict);
276 } 299 }
277 300
278 SkPdfMultiMasterFont* SkPdfFont::fontFromMultiMasterFontDictionary(SkPdfMultiMas terFontDictionary* dict) { 301 SkPdfMultiMasterFont* SkPdfFont::fontFromMultiMasterFontDictionary(SkNativeParse dPDF* doc, SkPdfMultiMasterFontDictionary* dict) {
279 if (dict == NULL) { 302 if (dict == NULL) {
280 return NULL; // default one? 303 return NULL; // default one?
281 } 304 }
282 305
283 return new SkPdfMultiMasterFont(dict); 306 return new SkPdfMultiMasterFont(doc, dict);
284 } 307 }
285 308
286 static int skstoi(const SkPdfString* str) { 309 static int skstoi(const SkPdfObject* str) {
310 // TODO(edisonn): report err of it is not a (hex) string
287 int ret = 0; 311 int ret = 0;
288 for (int i = 0 ; i < str->len(); i++) { 312 for (unsigned int i = 0 ; i < str->len(); i++) {
289 ret = (ret << 8) + ((unsigned char*)str->c_str())[i]; 313 ret = (ret << 8) + ((unsigned char*)str->c_str())[i];
290 } 314 }
291 return ret; 315 return ret;
292 } 316 }
293 317
294 SkPdfToUnicode::SkPdfToUnicode(const SkPdfStream* stream) { 318 #define tokenIsKeyword(token,keyword) (token.fType == kKeyword_TokenType && toke n.fKeywordLength==sizeof(keyword)-1 && strncmp(token.fKeyword, keyword, sizeof(k eyword)-1) == 0)
319
320 SkPdfToUnicode::SkPdfToUnicode(SkNativeParsedPDF* parsed, SkPdfStream* stream) : fParsed(parsed) {
295 fCMapEncoding = NULL; 321 fCMapEncoding = NULL;
296 fCMapEncodingFlag = NULL; 322 fCMapEncodingFlag = NULL;
297 323
298 if (stream) { 324 if (stream) {
299 SkPdfPodofoTokenizer* tokenizer = stream->doc()->tokenizerOfStream(strea m); 325 SkPdfNativeTokenizer* tokenizer = fParsed->tokenizerOfStream(stream);
300 PdfToken token; 326 PdfToken token;
301 327
302 fCMapEncoding = new unsigned short[256 * 256]; 328 fCMapEncoding = new unsigned short[256 * 256];
303 fCMapEncodingFlag = new unsigned char[256 * 256]; 329 fCMapEncodingFlag = new unsigned char[256 * 256];
304 for (int i = 0 ; i < 256 * 256; i++) { 330 for (int i = 0 ; i < 256 * 256; i++) {
305 fCMapEncoding[i] = i; 331 fCMapEncoding[i] = i;
306 fCMapEncodingFlag[i] = 0; 332 fCMapEncodingFlag[i] = 0;
307 } 333 }
308 334
309 // TODO(edisonn): deal with multibyte character, or longer strings. 335 // TODO(edisonn): deal with multibyte character, or longer strings.
310 // Ritght now we deal with up 2 characters, e.g. <0020> but not longer l ike <00660066006C> 336 // Ritght now we deal with up 2 characters, e.g. <0020> but not longer l ike <00660066006C>
311 //2 beginbfrange 337 //2 beginbfrange
312 //<0000> <005E> <0020> 338 //<0000> <005E> <0020>
313 //<005F> <0061> [<00660066> <00660069> <00660066006C>] 339 //<005F> <0061> [<00660066> <00660069> <00660066006C>]
314 340
315 while (tokenizer->readToken(&token)) { 341 while (tokenizer->readToken(&token)) {
316 342
317 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "beg incodespacerange") == 0) { 343 // TODO(edisonn): perf, macro that would make equal first for token. fKeywordLength with sizeof(keyword), instead od strlen, make sure it is keyword, not a char*
318 while (tokenizer->readToken(&token) && !(token.fType == kKeyword _TokenType && strcmp(token.fKeyword, "endcodespacerange") == 0)) { 344 if (tokenIsKeyword(token, "begincodespacerange")) {
345 while (tokenizer->readToken(&token) && !tokenIsKeyword(token, "e ndcodespacerange")) {
319 // tokenizer->PutBack(token); 346 // tokenizer->PutBack(token);
320 // tokenizer->readToken(&token); 347 // tokenizer->readToken(&token);
321 // TODO(edisonn): check token type! ignore/report errors. 348 // TODO(edisonn): check token type! ignore/report errors.
322 int start = skstoi(token.fObject->asString()); 349 int start = skstoi(token.fObject);
323 tokenizer->readToken(&token); 350 tokenizer->readToken(&token);
324 int end = skstoi(token.fObject->asString()); 351 int end = skstoi(token.fObject);
325 for (int i = start; i <= end; i++) { 352 for (int i = start; i <= end; i++) {
326 fCMapEncodingFlag[i] |= 1; 353 fCMapEncodingFlag[i] |= 1;
327 } 354 }
328 } 355 }
329 } 356 }
330 357
331 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "beg inbfchar") == 0) { 358 if (tokenIsKeyword(token, "beginbfchar")) {
332 while (tokenizer->readToken(&token) && !(token.fType == kKeyword _TokenType && strcmp(token.fKeyword, "endbfchar") == 0)) { 359 while (tokenizer->readToken(&token) && !tokenIsKeyword(token, "e ndbfchar")) {
333 // tokenizer->PutBack(token); 360 // tokenizer->PutBack(token);
334 // tokenizer->readToken(&token); 361 // tokenizer->readToken(&token);
335 int from = skstoi(token.fObject->asString()); 362 int from = skstoi(token.fObject);
336 tokenizer->readToken(&token); 363 tokenizer->readToken(&token);
337 int to = skstoi(token.fObject->asString()); 364 int to = skstoi(token.fObject);
338 365
339 fCMapEncodingFlag[from] |= 2; 366 fCMapEncodingFlag[from] |= 2;
340 fCMapEncoding[from] = to; 367 fCMapEncoding[from] = to;
341 } 368 }
342 } 369 }
343 370
344 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "beg inbfrange") == 0) { 371 if (tokenIsKeyword(token, "beginbfrange")) {
345 while (tokenizer->readToken(&token) && !(token.fType == kKeyword _TokenType && strcmp(token.fKeyword, "endbfrange") == 0)) { 372 while (tokenizer->readToken(&token) && !tokenIsKeyword(token, "e ndbfrange")) {
346 // tokenizer->PutBack(token); 373 // tokenizer->PutBack(token);
347 // tokenizer->readToken(&token); 374 // tokenizer->readToken(&token);
348 int start = skstoi(token.fObject->asString()); 375 int start = skstoi(token.fObject);
349 tokenizer->readToken(&token); 376 tokenizer->readToken(&token);
350 int end = skstoi(token.fObject->asString()); 377 int end = skstoi(token.fObject);
351 378
352 379
353 tokenizer->readToken(&token); // [ or just an array directly ? 380 tokenizer->readToken(&token); // [ or just an array directly ?
354 // tokenizer->PutBack(token); 381 // tokenizer->PutBack(token);
355 382
356 if (token.fType == kObject_TokenType && token.fObject->asStr ing()) { 383 // TODO(edisonn): read spec: any string or only hex string?
384 if (token.fType == kObject_TokenType && token.fObject->isAny String()) {
357 // tokenizer->readToken(&token); 385 // tokenizer->readToken(&token);
358 int value = skstoi(token.fObject->asString()); 386 int value = skstoi(token.fObject);
359 387
360 for (int i = start; i <= end; i++) { 388 for (int i = start; i <= end; i++) {
361 fCMapEncodingFlag[i] |= 2; 389 fCMapEncodingFlag[i] |= 2;
362 fCMapEncoding[i] = value; 390 fCMapEncoding[i] = value;
363 value++; 391 value++;
364 // if i != end, verify last byte id not if, ignore/r eport error 392 // if i != end, verify last byte id not if, ignore/r eport error
365 } 393 }
366 394
367 // read one string 395 // read one string
368 } else if (token.fType == kObject_TokenType && token.fObject ->asArray()) { 396 } else if (token.fType == kObject_TokenType && token.fObject ->isArray()) {
369 // tokenizer->readToken(&token); 397 // tokenizer->readToken(&token);
370 for (int i = 0; i < token.fObject->asArray()->size(); i+ +) { 398 for (unsigned int i = 0; i < token.fObject->size(); i++) {
371 fCMapEncodingFlag[start + i] |= 2; 399 fCMapEncodingFlag[start + i] |= 2;
372 fCMapEncoding[start + i] = skstoi((*token.fObject->a sArray())[i]->asString()); 400 fCMapEncoding[start + i] = skstoi((*token.fObject)[i ]);
373 } 401 }
374 // read array 402 // read array
375 } 403 }
376 404
377 //fCMapEncodingFlag[from] = 1; 405 //fCMapEncodingFlag[from] = 1;
378 //fCMapEncoding[from] = to; 406 //fCMapEncoding[from] = to;
379 } 407 }
380 } 408 }
381 } 409 }
382 } 410 }
383 } 411 }
384 412
385 413
386 SkPdfType0Font::SkPdfType0Font(SkPdfType0FontDictionary* dict) { 414 SkPdfType0Font::SkPdfType0Font(SkNativeParsedPDF* doc, SkPdfType0FontDictionary* dict) {
387 fBaseFont = fontFromName(dict, dict->BaseFont().c_str()); 415 fBaseFont = fontFromName(doc, dict, dict->BaseFont(doc).c_str());
388 fEncoding = NULL; 416 fEncoding = NULL;
389 417
390 if (dict->has_Encoding()) { 418 if (dict->has_Encoding()) {
391 if (dict->isEncodingAName()) { 419 if (dict->isEncodingAName(doc)) {
392 fEncoding = SkPdfEncoding::fromName(dict->getEncodingAsName().c_str( )); 420 fEncoding = SkPdfEncoding::fromName(dict->getEncodingAsName(doc).c_s tr());
393 } else if (dict->isEncodingAStream()) { 421 } else if (dict->isEncodingAStream(doc)) {
394 //fEncoding = loadEncodingFromStream(dict->getEncodingAsStream()); 422 //fEncoding = loadEncodingFromStream(dict->getEncodingAsStream());
395 } else { 423 } else {
396 // TODO(edisonn): error ... warning .. assert? 424 // TODO(edisonn): error ... warning .. assert?
397 } 425 }
398 } 426 }
399 427
400 if (dict->has_ToUnicode()) { 428 if (dict->has_ToUnicode()) {
401 fToUnicode = new SkPdfToUnicode(dict->ToUnicode()); 429 fToUnicode = new SkPdfToUnicode(doc, dict->ToUnicode(doc));
402 } 430 }
403 } 431 }
404 432
405 std::map<std::string, SkPdfEncoding*>& getStandardEncodings() { 433 std::map<std::string, SkPdfEncoding*>& getStandardEncodings() {
406 static std::map<std::string, SkPdfEncoding*> encodings; 434 static std::map<std::string, SkPdfEncoding*> encodings;
407 if (encodings.empty()) { 435 if (encodings.empty()) {
408 encodings["Identity-H"] = SkPdfIdentityHEncoding::instance(); 436 encodings["Identity-H"] = SkPdfIdentityHEncoding::instance();
409 } 437 }
410 438
411 return encodings; 439 return encodings;
412 } 440 }
413 441
414 442
415 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { 443 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) {
416 SkPdfEncoding* encoding = getStandardEncodings()[name]; 444 SkPdfEncoding* encoding = getStandardEncodings()[name];
417 445
418 #ifdef PDF_TRACE 446 #ifdef PDF_TRACE
419 if (encoding == NULL) { 447 if (encoding == NULL) {
420 printf("Encoding not found: %s\n", name); 448 printf("Encoding not found: %s\n", name);
421 } 449 }
422 #endif 450 #endif
423 return encoding; 451 return encoding;
424 } 452 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.h ('k') | experimental/PdfViewer/SkPdfParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698