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

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

Issue 2305803002: SkPDF: revert changes to CMapName/Registry/Ordering in 3d01c62 (Closed)
Patch Set: Created 4 years, 3 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/SkPDFFont.cpp ('k') | no next file » | 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 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 "SkPDFMakeToUnicodeCmap.h" 8 #include "SkPDFMakeToUnicodeCmap.h"
9 #include "SkPDFUtils.h" 9 #include "SkPDFUtils.h"
10 #include "SkUtils.h" 10 #include "SkUtils.h"
11 11
12 static void append_tounicode_header(SkDynamicMemoryWStream* cmap, 12 static void append_tounicode_header(SkDynamicMemoryWStream* cmap,
13 bool multibyte) { 13 bool multibyte) {
14 // 12 dict begin: 12 is an Adobe-suggested value. Shall not change. 14 // 12 dict begin: 12 is an Adobe-suggested value. Shall not change.
15 // It's there to prevent old version Adobe Readers from malfunctioning. 15 // It's there to prevent old version Adobe Readers from malfunctioning.
16 const char* kHeader = 16 const char* kHeader =
17 "/CIDInit /ProcSet findresource begin\n" 17 "/CIDInit /ProcSet findresource begin\n"
18 "12 dict begin\n" 18 "12 dict begin\n"
19 "begincmap\n"; 19 "begincmap\n";
20 cmap->writeText(kHeader); 20 cmap->writeText(kHeader);
21 21
22 // The /CIDSystemInfo must be consistent to the one in 22 // The /CIDSystemInfo must be consistent to the one in
23 // SkPDFFont::populateCIDFont(). 23 // SkPDFFont::populateCIDFont().
24 // We can not pass over the system info object here because the format is 24 // We can not pass over the system info object here because the format is
25 // different. This is not a reference object. 25 // different. This is not a reference object.
26 const char* kSysInfo = 26 const char* kSysInfo =
27 "/CIDSystemInfo\n" 27 "/CIDSystemInfo\n"
28 "<< /Registry (Skia)\n" 28 "<< /Registry (Adobe)\n"
29 "/Ordering (SkiaOrdering)\n" 29 "/Ordering (UCS)\n"
30 "/Supplement 0\n" 30 "/Supplement 0\n"
31 ">> def\n"; 31 ">> def\n";
32 cmap->writeText(kSysInfo); 32 cmap->writeText(kSysInfo);
33 33
34 // The CMapName must be consistent to /CIDSystemInfo above. 34 // The CMapName must be consistent to /CIDSystemInfo above.
35 // /CMapType 2 means ToUnicode. 35 // /CMapType 2 means ToUnicode.
36 // Codespace range just tells the PDF processor the valid range. 36 // Codespace range just tells the PDF processor the valid range.
37 const char* kTypeInfoHeader = 37 const char* kTypeInfoHeader =
38 "/CMapName /Skia-Identity-SkiaOrdering def\n" 38 "/CMapName /Adobe-Identity-UCS def\n"
39 "/CMapType 2 def\n" 39 "/CMapType 2 def\n"
40 "1 begincodespacerange\n"; 40 "1 begincodespacerange\n";
41 cmap->writeText(kTypeInfoHeader); 41 cmap->writeText(kTypeInfoHeader);
42 if (multibyte) { 42 if (multibyte) {
43 cmap->writeText("<0000> <FFFF>\n"); 43 cmap->writeText("<0000> <FFFF>\n");
44 } else { 44 } else {
45 cmap->writeText("<00> <FF>\n"); 45 cmap->writeText("<00> <FF>\n");
46 } 46 }
47 cmap->writeText("endcodespacerange\n"); 47 cmap->writeText("endcodespacerange\n");
48 } 48 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 SkGlyphID firstGlyphID, 226 SkGlyphID firstGlyphID,
227 SkGlyphID lastGlyphID) { 227 SkGlyphID lastGlyphID) {
228 SkDynamicMemoryWStream cmap; 228 SkDynamicMemoryWStream cmap;
229 append_tounicode_header(&cmap, multiByteGlyphs); 229 append_tounicode_header(&cmap, multiByteGlyphs);
230 SkPDFAppendCmapSections(glyphToUnicode, subset, &cmap, multiByteGlyphs, 230 SkPDFAppendCmapSections(glyphToUnicode, subset, &cmap, multiByteGlyphs,
231 firstGlyphID, lastGlyphID); 231 firstGlyphID, lastGlyphID);
232 append_cmap_footer(&cmap); 232 append_cmap_footer(&cmap);
233 return sk_make_sp<SkPDFStream>( 233 return sk_make_sp<SkPDFStream>(
234 std::unique_ptr<SkStreamAsset>(cmap.detachAsStream())); 234 std::unique_ptr<SkStreamAsset>(cmap.detachAsStream()));
235 } 235 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698