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

Side by Side Diff: src/pdf/SkPDFMetadata.cpp

Issue 2253283004: SkPDF: in-place font subsetting (Closed) Base URL: https://skia.googlesource.com/skia.git@SkPdfCacheMetrics
Patch Set: 2016-08-18 (Thursday) 16:02:16 EDT Created 4 years, 4 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
« no previous file with comments | « src/pdf/SkPDFMakeToUnicodeCmap.cpp ('k') | src/pdf/SkPDFTypes.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 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkMD5.h" 8 #include "SkMD5.h"
9 #include "SkMilestone.h" 9 #include "SkMilestone.h"
10 #include "SkPDFMetadata.h" 10 #include "SkPDFMetadata.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 SkASSERT(data == uuid.fData + 16); 161 SkASSERT(data == uuid.fData + 16);
162 return SkString(buffer, 36); 162 return SkString(buffer, 36);
163 } 163 }
164 #undef HEXIFY 164 #undef HEXIFY
165 165
166 namespace { 166 namespace {
167 class PDFXMLObject final : public SkPDFObject { 167 class PDFXMLObject final : public SkPDFObject {
168 public: 168 public:
169 PDFXMLObject(SkString xml) : fXML(std::move(xml)) {} 169 PDFXMLObject(SkString xml) : fXML(std::move(xml)) {}
170 void emitObject(SkWStream* stream, 170 void emitObject(SkWStream* stream,
171 const SkPDFObjNumMap& omap, 171 const SkPDFObjNumMap& omap) const override {
172 const SkPDFSubstituteMap& smap) const override {
173 SkPDFDict dict("Metadata"); 172 SkPDFDict dict("Metadata");
174 dict.insertName("Subtype", "XML"); 173 dict.insertName("Subtype", "XML");
175 dict.insertInt("Length", fXML.size()); 174 dict.insertInt("Length", fXML.size());
176 dict.emitObject(stream, omap, smap); 175 dict.emitObject(stream, omap);
177 static const char streamBegin[] = " stream\n"; 176 static const char streamBegin[] = " stream\n";
178 stream->write(streamBegin, strlen(streamBegin)); 177 stream->write(streamBegin, strlen(streamBegin));
179 // Do not compress this. The standard requires that a 178 // Do not compress this. The standard requires that a
180 // program that does not understand PDF can grep for 179 // program that does not understand PDF can grep for
181 // "<?xpacket" and extracť the entire XML. 180 // "<?xpacket" and extracť the entire XML.
182 stream->write(fXML.c_str(), fXML.size()); 181 stream->write(fXML.c_str(), fXML.size());
183 static const char streamEnd[] = "\nendstream"; 182 static const char streamEnd[] = "\nendstream";
184 stream->write(streamEnd, strlen(streamEnd)); 183 stream->write(streamEnd, strlen(streamEnd));
185 } 184 }
186 185
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 templateString, modificationDate.c_str(), creationDate.c_str(), 333 templateString, modificationDate.c_str(), creationDate.c_str(),
335 creator.c_str(), title.c_str(), subject.c_str(), author.c_str(), 334 creator.c_str(), title.c_str(), subject.c_str(), author.c_str(),
336 keywords1.c_str(), documentID.c_str(), instanceID.c_str(), 335 keywords1.c_str(), documentID.c_str(), instanceID.c_str(),
337 producer.c_str(), keywords2.c_str())); 336 producer.c_str(), keywords2.c_str()));
338 } 337 }
339 338
340 #undef SKPDF_CUSTOM_PRODUCER_KEY 339 #undef SKPDF_CUSTOM_PRODUCER_KEY
341 #undef SKPDF_PRODUCER 340 #undef SKPDF_PRODUCER
342 #undef SKPDF_STRING 341 #undef SKPDF_STRING
343 #undef SKPDF_STRING_IMPL 342 #undef SKPDF_STRING_IMPL
OLDNEW
« no previous file with comments | « src/pdf/SkPDFMakeToUnicodeCmap.cpp ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698