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

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

Issue 18293012: pdf viewer: fix a few warnings, and enable warning as errors (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.cpp » ('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 "SkPdfNativeTokenizer.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"] = SkPdfStandardFontEntry("Arial", false, fals e);
15 gPdfStandardFonts["Arial,Bold"] = {"Arial", true, false}; 15 gPdfStandardFonts["Arial,Bold"] = SkPdfStandardFontEntry("Arial", true, false);
16 gPdfStandardFonts["Arial,BoldItalic"] = {"Arial", true, true}; 16 gPdfStandardFonts["Arial,BoldItalic"] = SkPdfStandardFontEntry("Arial", true, true);
17 gPdfStandardFonts["Arial,Italic"] = {"Arial", false, true}; 17 gPdfStandardFonts["Arial,Italic"] = SkPdfStandardFontEntry("Arial", fals e, true);
18 gPdfStandardFonts["Arial-Bold"] = {"Arial", true, false}; 18 gPdfStandardFonts["Arial-Bold"] = SkPdfStandardFontEntry("Arial", true, false);
19 gPdfStandardFonts["Arial-BoldItalic"] = {"Arial", true, true}; 19 gPdfStandardFonts["Arial-BoldItalic"] = SkPdfStandardFontEntry("Arial", true, true);
20 gPdfStandardFonts["Arial-BoldItalicMT"] = {"Arial", true, true}; 20 gPdfStandardFonts["Arial-BoldItalicMT"] = SkPdfStandardFontEntry("Arial" , true, true);
21 gPdfStandardFonts["Arial-BoldMT"] = {"Arial", true, false}; 21 gPdfStandardFonts["Arial-BoldMT"] = SkPdfStandardFontEntry("Arial", true , false);
22 gPdfStandardFonts["Arial-Italic"] = {"Arial", false, true}; 22 gPdfStandardFonts["Arial-Italic"] = SkPdfStandardFontEntry("Arial", fals e, true);
23 gPdfStandardFonts["Arial-ItalicMT"] = {"Arial", false, true}; 23 gPdfStandardFonts["Arial-ItalicMT"] = SkPdfStandardFontEntry("Arial", fa lse, true);
24 gPdfStandardFonts["ArialMT"] = {"Arial", false, false}; 24 gPdfStandardFonts["ArialMT"] = SkPdfStandardFontEntry("Arial", false, fa lse);
25 gPdfStandardFonts["Courier"] = {"Courier New", false, false}; 25 gPdfStandardFonts["Courier"] = SkPdfStandardFontEntry("Courier New", fal se, false);
26 gPdfStandardFonts["Courier,Bold"] = {"Courier New", true, false}; 26 gPdfStandardFonts["Courier,Bold"] = SkPdfStandardFontEntry("Courier New" , true, false);
27 gPdfStandardFonts["Courier,BoldItalic"] = {"Courier New", true, true}; 27 gPdfStandardFonts["Courier,BoldItalic"] = SkPdfStandardFontEntry("Courie r New", true, true);
28 gPdfStandardFonts["Courier,Italic"] = {"Courier New", false, true}; 28 gPdfStandardFonts["Courier,Italic"] = SkPdfStandardFontEntry("Courier Ne w", false, true);
29 gPdfStandardFonts["Courier-Bold"] = {"Courier New", true, false}; 29 gPdfStandardFonts["Courier-Bold"] = SkPdfStandardFontEntry("Courier New" , true, false);
30 gPdfStandardFonts["Courier-BoldOblique"] = {"Courier New", true, true}; 30 gPdfStandardFonts["Courier-BoldOblique"] = SkPdfStandardFontEntry("Couri er New", true, true);
31 gPdfStandardFonts["Courier-Oblique"] = {"Courier New", false, true}; 31 gPdfStandardFonts["Courier-Oblique"] = SkPdfStandardFontEntry("Courier N ew", false, true);
32 gPdfStandardFonts["CourierNew"] = {"Courier New", false, false}; 32 gPdfStandardFonts["CourierNew"] = SkPdfStandardFontEntry("Courier New", false, false);
33 gPdfStandardFonts["CourierNew,Bold"] = {"Courier New", true, false}; 33 gPdfStandardFonts["CourierNew,Bold"] = SkPdfStandardFontEntry("Courier N ew", true, false);
34 gPdfStandardFonts["CourierNew,BoldItalic"] = {"Courier New", true, true} ; 34 gPdfStandardFonts["CourierNew,BoldItalic"] = SkPdfStandardFontEntry("Cou rier New", true, true);
35 gPdfStandardFonts["CourierNew,Italic"] = {"Courier New", false, true}; 35 gPdfStandardFonts["CourierNew,Italic"] = SkPdfStandardFontEntry("Courier New", false, true);
36 gPdfStandardFonts["CourierNew-Bold"] = {"Courier New", true, false}; 36 gPdfStandardFonts["CourierNew-Bold"] = SkPdfStandardFontEntry("Courier N ew", true, false);
37 gPdfStandardFonts["CourierNew-BoldItalic"] = {"Courier New", true, true} ; 37 gPdfStandardFonts["CourierNew-BoldItalic"] = SkPdfStandardFontEntry("Cou rier New", true, true);
38 gPdfStandardFonts["CourierNew-Italic"] = {"Courier New", false, true}; 38 gPdfStandardFonts["CourierNew-Italic"] = SkPdfStandardFontEntry("Courier New", false, true);
39 gPdfStandardFonts["CourierNewPS-BoldItalicMT"] = {"Courier New", true, t rue}; 39 gPdfStandardFonts["CourierNewPS-BoldItalicMT"] = SkPdfStandardFontEntry( "Courier New", true, true);
40 gPdfStandardFonts["CourierNewPS-BoldMT"] = {"Courier New", true, false}; 40 gPdfStandardFonts["CourierNewPS-BoldMT"] = SkPdfStandardFontEntry("Couri er New", true, false);
41 gPdfStandardFonts["CourierNewPS-ItalicMT"] = {"Courier New", false, true }; 41 gPdfStandardFonts["CourierNewPS-ItalicMT"] = SkPdfStandardFontEntry("Cou rier New", false, true);
42 gPdfStandardFonts["CourierNewPSMT"] = {"Courier New", false, false}; 42 gPdfStandardFonts["CourierNewPSMT"] = SkPdfStandardFontEntry("Courier Ne w", false, false);
43 gPdfStandardFonts["Helvetica"] = {"Helvetica", false, false}; 43 gPdfStandardFonts["Helvetica"] = SkPdfStandardFontEntry("Helvetica", fal se, false);
44 gPdfStandardFonts["Helvetica,Bold"] = {"Helvetica", true, false}; 44 gPdfStandardFonts["Helvetica,Bold"] = SkPdfStandardFontEntry("Helvetica" , true, false);
45 gPdfStandardFonts["Helvetica,BoldItalic"] = {"Helvetica", true, true}; 45 gPdfStandardFonts["Helvetica,BoldItalic"] = SkPdfStandardFontEntry("Helv etica", true, true);
46 gPdfStandardFonts["Helvetica,Italic"] = {"Helvetica", false, true}; 46 gPdfStandardFonts["Helvetica,Italic"] = SkPdfStandardFontEntry("Helvetic a", false, true);
47 gPdfStandardFonts["Helvetica-Bold"] = {"Helvetica", true, false}; 47 gPdfStandardFonts["Helvetica-Bold"] = SkPdfStandardFontEntry("Helvetica" , true, false);
48 gPdfStandardFonts["Helvetica-BoldItalic"] = {"Helvetica", true, true}; 48 gPdfStandardFonts["Helvetica-BoldItalic"] = SkPdfStandardFontEntry("Helv etica", true, true);
49 gPdfStandardFonts["Helvetica-BoldOblique"] = {"Helvetica", true, true}; 49 gPdfStandardFonts["Helvetica-BoldOblique"] = SkPdfStandardFontEntry("Hel vetica", true, true);
50 gPdfStandardFonts["Helvetica-Italic"] = {"Helvetica", false, true}; 50 gPdfStandardFonts["Helvetica-Italic"] = SkPdfStandardFontEntry("Helvetic a", false, true);
51 gPdfStandardFonts["Helvetica-Oblique"] = {"Helvetica", false, true}; 51 gPdfStandardFonts["Helvetica-Oblique"] = SkPdfStandardFontEntry("Helveti ca", false, true);
52 gPdfStandardFonts["Times-Bold"] = {"Times New Roman", true, false}; 52 gPdfStandardFonts["Times-Bold"] = SkPdfStandardFontEntry("Times New Roma n", true, false);
53 gPdfStandardFonts["Times-BoldItalic"] = {"Times New Roman", true, true}; 53 gPdfStandardFonts["Times-BoldItalic"] = SkPdfStandardFontEntry("Times Ne w Roman", true, true);
54 gPdfStandardFonts["Times-Italic"] = {"Times New Roman", false, true}; 54 gPdfStandardFonts["Times-Italic"] = SkPdfStandardFontEntry("Times New Ro man", false, true);
55 gPdfStandardFonts["Times-Roman"] = {"Times New Roman", false, false}; 55 gPdfStandardFonts["Times-Roman"] = SkPdfStandardFontEntry("Times New Rom an", false, false);
56 gPdfStandardFonts["TimesNewRoman"] = {"Times New Roman", false, false}; 56 gPdfStandardFonts["TimesNewRoman"] = SkPdfStandardFontEntry("Times New R oman", false, false);
57 gPdfStandardFonts["TimesNewRoman,Bold"] = {"Times New Roman", true, fals e}; 57 gPdfStandardFonts["TimesNewRoman,Bold"] = SkPdfStandardFontEntry("Times New Roman", true, false);
58 gPdfStandardFonts["TimesNewRoman,BoldItalic"] = {"Times New Roman", true , true}; 58 gPdfStandardFonts["TimesNewRoman,BoldItalic"] = SkPdfStandardFontEntry(" Times New Roman", true, true);
59 gPdfStandardFonts["TimesNewRoman,Italic"] = {"Times New Roman", false, t rue}; 59 gPdfStandardFonts["TimesNewRoman,Italic"] = SkPdfStandardFontEntry("Time s New Roman", false, true);
60 gPdfStandardFonts["TimesNewRoman-Bold"] = {"Times New Roman", true, fals e}; 60 gPdfStandardFonts["TimesNewRoman-Bold"] = SkPdfStandardFontEntry("Times New Roman", true, false);
61 gPdfStandardFonts["TimesNewRoman-BoldItalic"] = {"Times New Roman", true , true}; 61 gPdfStandardFonts["TimesNewRoman-BoldItalic"] = SkPdfStandardFontEntry(" Times New Roman", true, true);
62 gPdfStandardFonts["TimesNewRoman-Italic"] = {"Times New Roman", false, t rue}; 62 gPdfStandardFonts["TimesNewRoman-Italic"] = SkPdfStandardFontEntry("Time s New Roman", false, true);
63 gPdfStandardFonts["TimesNewRomanPS"] = {"Times New Roman", false, false} ; 63 gPdfStandardFonts["TimesNewRomanPS"] = SkPdfStandardFontEntry("Times New Roman", false, false);
64 gPdfStandardFonts["TimesNewRomanPS-Bold"] = {"Times New Roman", true, fa lse}; 64 gPdfStandardFonts["TimesNewRomanPS-Bold"] = SkPdfStandardFontEntry("Time s New Roman", true, false);
65 gPdfStandardFonts["TimesNewRomanPS-BoldItalic"] = {"Times New Roman", tr ue, true}; 65 gPdfStandardFonts["TimesNewRomanPS-BoldItalic"] = SkPdfStandardFontEntry ("Times New Roman", true, true);
66 gPdfStandardFonts["TimesNewRomanPS-BoldItalicMT"] = {"Times New Roman", true, true}; 66 gPdfStandardFonts["TimesNewRomanPS-BoldItalicMT"] = SkPdfStandardFontEnt ry("Times New Roman", true, true);
67 gPdfStandardFonts["TimesNewRomanPS-BoldMT"] = {"Times New Roman", true, false}; 67 gPdfStandardFonts["TimesNewRomanPS-BoldMT"] = SkPdfStandardFontEntry("Ti mes New Roman", true, false);
68 gPdfStandardFonts["TimesNewRomanPS-Italic"] = {"Times New Roman", false, true}; 68 gPdfStandardFonts["TimesNewRomanPS-Italic"] = SkPdfStandardFontEntry("Ti mes New Roman", false, true);
69 gPdfStandardFonts["TimesNewRomanPS-ItalicMT"] = {"Times New Roman", fals e, true}; 69 gPdfStandardFonts["TimesNewRomanPS-ItalicMT"] = SkPdfStandardFontEntry(" Times New Roman", false, true);
70 gPdfStandardFonts["TimesNewRomanPSMT"] = {"Times New Roman", false, fals e}; 70 gPdfStandardFonts["TimesNewRomanPSMT"] = SkPdfStandardFontEntry("Times N ew Roman", false, false);
71 gPdfStandardFonts["Symbol"] = {"Symbol", false, false}; 71 gPdfStandardFonts["Symbol"] = SkPdfStandardFontEntry("Symbol", false, fa lse);
72 gPdfStandardFonts["ZapfDingbats"] = {"ZapfDingbats", false, false}; 72 gPdfStandardFonts["ZapfDingbats"] = SkPdfStandardFontEntry("ZapfDingbats ", false, false);
73 73
74 // TODO(edisonn): these are hacks. Load Post Script font name. 74 // TODO(edisonn): these are hacks. Load Post Script font name.
75 // see FT_Get_Postscript_Name 75 // see FT_Get_Postscript_Name
76 // Font config is not using it, yet. 76 // Font config is not using it, yet.
77 //https://bugs.freedesktop.org/show_bug.cgi?id=18095 77 //https://bugs.freedesktop.org/show_bug.cgi?id=18095
78 78
79 gPdfStandardFonts["Arial-Black"] = {"Arial", true, false}; 79 gPdfStandardFonts["Arial-Black"] = SkPdfStandardFontEntry("Arial", true, false);
80 gPdfStandardFonts["DejaVuSans"] = {"DejaVu Sans", false, false}; 80 gPdfStandardFonts["DejaVuSans"] = SkPdfStandardFontEntry("DejaVu Sans", false, false);
81 gPdfStandardFonts["DejaVuSansMono"] = {"DejaVuSans Mono", false, false}; 81 gPdfStandardFonts["DejaVuSansMono"] = SkPdfStandardFontEntry("DejaVuSans Mono", false, false);
82 gPdfStandardFonts["DejaVuSansMono-Bold"] = {"DejaVuSans Mono", true, fal se}; 82 gPdfStandardFonts["DejaVuSansMono-Bold"] = SkPdfStandardFontEntry("DejaV uSans Mono", true, false);
83 gPdfStandardFonts["DejaVuSansMono-Oblique"] = {"DejaVuSans Mono", false, true}; 83 gPdfStandardFonts["DejaVuSansMono-Oblique"] = SkPdfStandardFontEntry("De jaVuSans Mono", false, true);
84 gPdfStandardFonts["Georgia-Bold"] = {"Georgia", true, false}; 84 gPdfStandardFonts["Georgia-Bold"] = SkPdfStandardFontEntry("Georgia", tr ue, false);
85 gPdfStandardFonts["Georgia-BoldItalic"] = {"Georgia", true, true}; 85 gPdfStandardFonts["Georgia-BoldItalic"] = SkPdfStandardFontEntry("Georgi a", true, true);
86 gPdfStandardFonts["Georgia-Italic"] = {"Georgia", false, true}; 86 gPdfStandardFonts["Georgia-Italic"] = SkPdfStandardFontEntry("Georgia", false, true);
87 gPdfStandardFonts["TrebuchetMS"] = {"Trebuchet MS", false, false}; 87 gPdfStandardFonts["TrebuchetMS"] = SkPdfStandardFontEntry("Trebuchet MS" , false, false);
88 gPdfStandardFonts["TrebuchetMS-Bold"] = {"Trebuchet MS", true, false}; 88 gPdfStandardFonts["TrebuchetMS-Bold"] = SkPdfStandardFontEntry("Trebuche t MS", true, false);
89 gPdfStandardFonts["Verdana-Bold"] = {"Verdana", true, false}; 89 gPdfStandardFonts["Verdana-Bold"] = SkPdfStandardFontEntry("Verdana", tr ue, false);
90 gPdfStandardFonts["WenQuanYiMicroHei"] = {"WenQuanYi Micro Hei", false, false}; 90 gPdfStandardFonts["WenQuanYiMicroHei"] = SkPdfStandardFontEntry("WenQuan Yi Micro Hei", false, false);
91 91
92 // TODO(edisonn): list all phonts available, builf post script name as i n pdf spec 92 // TODO(edisonn): list all phonts available, builf post script name as i n pdf spec
93 /* 93 /*
94 * The PostScript name for the value of BaseFontis determined in one of two ways: 94 * The PostScript name for the value of BaseFontis determined in one of two ways:
95 • Use the PostScript name that is an optional entry in the “name” table of the 95 • Use the PostScript name that is an optional entry in the “name” table of the
96 TrueType font itself. 96 TrueType font itself.
97 • In the absence of such an entry in the “name” table, derive a PostScript name 97 • In the absence of such an entry in the “name” table, derive a PostScript name
98 from the name by which the font is known in the host operating system: on a 98 from the name by which the font is known in the host operating system: on a
99 Windows system, it is based on the lfFaceName field in a LOGFONT structure; in 99 Windows system, it is based on the lfFaceName field in a LOGFONT structure; in
100 the Mac OS, it is based on the name of the FONDresource. If the name contains 100 the Mac OS, it is based on the name of the FONDresource. If the name contains
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { 443 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) {
444 SkPdfEncoding* encoding = getStandardEncodings()[name]; 444 SkPdfEncoding* encoding = getStandardEncodings()[name];
445 445
446 #ifdef PDF_TRACE 446 #ifdef PDF_TRACE
447 if (encoding == NULL) { 447 if (encoding == NULL) {
448 printf("Encoding not found: %s\n", name); 448 printf("Encoding not found: %s\n", name);
449 } 449 }
450 #endif 450 #endif
451 return encoding; 451 return encoding;
452 } 452 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.h ('k') | experimental/PdfViewer/SkPdfParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698