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

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

Issue 23258004: pdfviewer: code cleanup - remove STL usage (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | experimental/PdfViewer/SkPdfFont.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 #ifndef __DEFINED__SkPdfFont 1 #ifndef __DEFINED__SkPdfFont
2 #define __DEFINED__SkPdfFont 2 #define __DEFINED__SkPdfFont
3 3
4 #include "SkPdfHeaders_autogen.h" 4 #include "SkPdfHeaders_autogen.h"
5 #include "SkPdfMapper_autogen.h" 5 #include "SkPdfMapper_autogen.h"
6 6
7 #include <map>
8 #include <string>
9
10 #include "SkTypeface.h" 7 #include "SkTypeface.h"
11 #include "SkUtils.h" 8 #include "SkUtils.h"
12 #include "SkPdfGraphicsState.h" 9 #include "SkPdfGraphicsState.h"
13 #include "SkPdfUtils.h" 10 #include "SkPdfUtils.h"
14 11 #include "SkTDict.h"
15 12
16 class SkPdfType0Font; 13 class SkPdfType0Font;
17 class SkPdfType1Font; 14 class SkPdfType1Font;
18 class SkPdfType3Font; 15 class SkPdfType3Font;
19 class SkPdfTrueTypeFont; 16 class SkPdfTrueTypeFont;
20 class SkPdfMultiMasterFont; 17 class SkPdfMultiMasterFont;
21 class SkPdfFont; 18 class SkPdfFont;
22 19
23 struct SkPdfStandardFontEntry { 20 struct SkPdfStandardFontEntry {
24 // We don't own this pointer! 21 // We don't own this pointer!
25 const char* fName; 22 const char* fName;
26 bool fIsBold; 23 bool fIsBold;
27 bool fIsItalic; 24 bool fIsItalic;
28 SkPdfStandardFontEntry() 25 SkPdfStandardFontEntry()
29 : fName(NULL), 26 : fName(NULL),
30 fIsBold(false), 27 fIsBold(false),
31 fIsItalic(false) {} 28 fIsItalic(false) {}
32 29
33 SkPdfStandardFontEntry(const char* name, bool bold, bool italic) 30 SkPdfStandardFontEntry(const char* name, bool bold, bool italic)
34 : fName(name), 31 : fName(name),
35 fIsBold(bold), 32 fIsBold(bold),
36 fIsItalic(italic) {} 33 fIsItalic(italic) {}
37 }; 34 };
38 35
39 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts(); 36 SkTDict<SkPdfStandardFontEntry>& getStandardFonts();
40 SkTypeface* SkTypefaceFromPdfStandardFont(const char* fontName, bool bold, bool italic); 37 SkTypeface* SkTypefaceFromPdfStandardFont(const char* fontName, bool bold, bool italic);
41 SkPdfFont* fontFromName(SkPdfNativeDoc* doc, SkPdfNativeObject* obj, const char* fontName); 38 SkPdfFont* fontFromName(SkPdfNativeDoc* doc, SkPdfNativeObject* obj, const char* fontName);
42 39
43 struct SkUnencodedText { 40 struct SkUnencodedText {
44 void* text; 41 void* text;
45 int len; 42 int len;
46 43
47 public: 44 public:
48 SkUnencodedText(const SkPdfString* obj) { 45 SkUnencodedText(const SkPdfString* obj) {
49 text = (void*)obj->c_str(); 46 text = (void*)obj->c_str();
(...skipping 17 matching lines...) Expand all
67 unsigned int operator[](int i) const { return text[i]; } 64 unsigned int operator[](int i) const { return text[i]; }
68 int size() const { return len; } 65 int size() const { return len; }
69 }; 66 };
70 67
71 class SkPdfEncoding { 68 class SkPdfEncoding {
72 public: 69 public:
73 virtual bool decodeText(const SkUnencodedText& textIn, SkDecodedText* textOu t) const = 0; 70 virtual bool decodeText(const SkUnencodedText& textIn, SkDecodedText* textOu t) const = 0;
74 static SkPdfEncoding* fromName(const char* name); 71 static SkPdfEncoding* fromName(const char* name);
75 }; 72 };
76 73
77 std::map<std::string, SkPdfEncoding*>& getStandardEncodings(); 74 SkTDict<SkPdfEncoding*>& getStandardEncodings();
78 75
79 class SkPdfToUnicode { 76 class SkPdfToUnicode {
80 SkPdfNativeDoc* fParsed; 77 SkPdfNativeDoc* fParsed;
81 // TODO(edisonn): hide public members 78 // TODO(edisonn): hide public members
82 public: 79 public:
83 unsigned short* fCMapEncoding; 80 unsigned short* fCMapEncoding;
84 unsigned char* fCMapEncodingFlag; 81 unsigned char* fCMapEncodingFlag;
85 82
86 SkPdfToUnicode(SkPdfNativeDoc* parsed, SkPdfStream* stream); 83 SkPdfToUnicode(SkPdfNativeDoc* parsed, SkPdfStream* stream);
87 }; 84 };
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 SkDoubleToScalar(0.0)); 434 SkDoubleToScalar(0.0));
438 return fChars[ch - fFirstChar].fWidth; 435 return fChars[ch - fFirstChar].fWidth;
439 } 436 }
440 437
441 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { 438 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) {
442 439
443 } 440 }
444 }; 441 };
445 442
446 #endif // __DEFINED__SkPdfFont 443 #endif // __DEFINED__SkPdfFont
OLDNEW
« no previous file with comments | « no previous file | experimental/PdfViewer/SkPdfFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698