| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 SkAutoTUnref<SkPDFDict> descriptor(new SkPDFDict("FontDescriptor")); | 1307 SkAutoTUnref<SkPDFDict> descriptor(new SkPDFDict("FontDescriptor")); |
| 1308 setFontDescriptor(descriptor.get()); | 1308 setFontDescriptor(descriptor.get()); |
| 1309 | 1309 |
| 1310 int ttcIndex; | 1310 int ttcIndex; |
| 1311 size_t header SK_INIT_TO_AVOID_WARNING; | 1311 size_t header SK_INIT_TO_AVOID_WARNING; |
| 1312 size_t data SK_INIT_TO_AVOID_WARNING; | 1312 size_t data SK_INIT_TO_AVOID_WARNING; |
| 1313 size_t trailer SK_INIT_TO_AVOID_WARNING; | 1313 size_t trailer SK_INIT_TO_AVOID_WARNING; |
| 1314 SkAutoTUnref<SkStream> rawFontData(typeface()->openStream(&ttcIndex)); | 1314 SkAutoTUnref<SkStream> rawFontData(typeface()->openStream(&ttcIndex)); |
| 1315 SkData* fontData = handle_type1_stream(rawFontData.get(), &header, &data, | 1315 SkAutoTUnref<SkData> fontData(handle_type1_stream(rawFontData.get(), &header
, |
| 1316 &trailer); | 1316 &data, &trailer)); |
| 1317 if (fontData == NULL) { | 1317 if (fontData.get() == NULL) { |
| 1318 return false; | 1318 return false; |
| 1319 } | 1319 } |
| 1320 if (canEmbed()) { | 1320 if (canEmbed()) { |
| 1321 SkAutoTUnref<SkPDFStream> fontStream(new SkPDFStream(fontData)); | 1321 SkAutoTUnref<SkPDFStream> fontStream(new SkPDFStream(fontData.get())); |
| 1322 addResource(fontStream.get()); | 1322 addResource(fontStream.get()); |
| 1323 fontStream->insertInt("Length1", header); | 1323 fontStream->insertInt("Length1", header); |
| 1324 fontStream->insertInt("Length2", data); | 1324 fontStream->insertInt("Length2", data); |
| 1325 fontStream->insertInt("Length3", trailer); | 1325 fontStream->insertInt("Length3", trailer); |
| 1326 descriptor->insert("FontFile", | 1326 descriptor->insert("FontFile", |
| 1327 new SkPDFObjRef(fontStream.get()))->unref(); | 1327 new SkPDFObjRef(fontStream.get()))->unref(); |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 addResource(descriptor.get()); | 1330 addResource(descriptor.get()); |
| 1331 insert("FontDescriptor", new SkPDFObjRef(descriptor.get()))->unref(); | 1331 insert("FontDescriptor", new SkPDFObjRef(descriptor.get()))->unref(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 | 1490 |
| 1491 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); | 1491 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); |
| 1492 insertInt("FirstChar", 1); | 1492 insertInt("FirstChar", 1); |
| 1493 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); | 1493 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); |
| 1494 insert("Widths", widthArray.get()); | 1494 insert("Widths", widthArray.get()); |
| 1495 insertName("CIDToGIDMap", "Identity"); | 1495 insertName("CIDToGIDMap", "Identity"); |
| 1496 | 1496 |
| 1497 populateToUnicodeTable(NULL); | 1497 populateToUnicodeTable(NULL); |
| 1498 return true; | 1498 return true; |
| 1499 } | 1499 } |
| OLD | NEW |