OLD | NEW |
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 #include "SkPDFCatalog.h" | 10 #include "SkPDFCatalog.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const SkTDArray<SkPDFPage*>& pages, | 36 const SkTDArray<SkPDFPage*>& pages, |
37 SkTDArray<SkPDFObject*>* substitutes) { | 37 SkTDArray<SkPDFObject*>* substitutes) { |
38 SkASSERT(catalog); | 38 SkASSERT(catalog); |
39 SkASSERT(substitutes); | 39 SkASSERT(substitutes); |
40 | 40 |
41 SkPDFGlyphSetMap usage; | 41 SkPDFGlyphSetMap usage; |
42 for (int i = 0; i < pages.count(); ++i) { | 42 for (int i = 0; i < pages.count(); ++i) { |
43 usage.merge(pages[i]->getFontGlyphUsage()); | 43 usage.merge(pages[i]->getFontGlyphUsage()); |
44 } | 44 } |
45 SkPDFGlyphSetMap::F2BIter iterator(usage); | 45 SkPDFGlyphSetMap::F2BIter iterator(usage); |
46 SkPDFGlyphSetMap::FontGlyphSetPair* entry = iterator.next(); | 46 const SkPDFGlyphSetMap::FontGlyphSetPair* entry = iterator.next(); |
47 while (entry) { | 47 while (entry) { |
48 SkPDFFont* subsetFont = | 48 SkPDFFont* subsetFont = |
49 entry->fFont->getFontSubset(entry->fGlyphSet); | 49 entry->fFont->getFontSubset(entry->fGlyphSet); |
50 if (subsetFont) { | 50 if (subsetFont) { |
51 catalog->setSubstitute(entry->fFont, subsetFont); | 51 catalog->setSubstitute(entry->fFont, subsetFont); |
52 substitutes->push(subsetFont); // Transfer ownership to substitutes | 52 substitutes->push(subsetFont); // Transfer ownership to substitutes |
53 } | 53 } |
54 entry = iterator.next(); | 54 entry = iterator.next(); |
55 } | 55 } |
56 } | 56 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 fTrailerDict->insertInt("Size", int(objCount)); | 267 fTrailerDict->insertInt("Size", int(objCount)); |
268 fTrailerDict->insert("Root", new SkPDFObjRef(fDocCatalog))->unref(); | 268 fTrailerDict->insert("Root", new SkPDFObjRef(fDocCatalog))->unref(); |
269 } | 269 } |
270 | 270 |
271 stream->writeText("trailer\n"); | 271 stream->writeText("trailer\n"); |
272 fTrailerDict->emitObject(stream, fCatalog.get(), false); | 272 fTrailerDict->emitObject(stream, fCatalog.get(), false); |
273 stream->writeText("\nstartxref\n"); | 273 stream->writeText("\nstartxref\n"); |
274 stream->writeBigDecAsText(fXRefFileOffset); | 274 stream->writeBigDecAsText(fXRefFileOffset); |
275 stream->writeText("\n%%EOF"); | 275 stream->writeText("\n%%EOF"); |
276 } | 276 } |
OLD | NEW |