OLD | NEW |
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> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 class SkPdfFont { | 157 class SkPdfFont { |
158 public: | 158 public: |
159 SkPdfFont* fBaseFont; | 159 SkPdfFont* fBaseFont; |
160 SkPdfEncoding* fEncoding; | 160 SkPdfEncoding* fEncoding; |
161 SkPdfToUnicode* fToUnicode; | 161 SkPdfToUnicode* fToUnicode; |
162 | 162 |
163 | 163 |
164 public: | 164 public: |
165 SkPdfFont() : fBaseFont(NULL), fEncoding(SkPdfDefaultEncoding::instance()),
fToUnicode(NULL) {} | 165 SkPdfFont() : fBaseFont(NULL), fEncoding(SkPdfDefaultEncoding::instance()),
fToUnicode(NULL) {} |
166 | 166 |
| 167 virtual ~SkPdfFont() { |
| 168 // TODO(edisonn): NYI (will leak for now) |
| 169 } |
| 170 |
167 const SkPdfEncoding* encoding() const {return fEncoding;} | 171 const SkPdfEncoding* encoding() const {return fEncoding;} |
168 | 172 |
169 void drawText(const SkDecodedText& text, SkPaint* paint, PdfContext* pdfCont
ext, SkCanvas* canvas) { | 173 void drawText(const SkDecodedText& text, SkPaint* paint, PdfContext* pdfCont
ext, SkCanvas* canvas) { |
170 for (int i = 0 ; i < text.size(); i++) { | 174 for (int i = 0 ; i < text.size(); i++) { |
171 double width = drawOneChar(text[i], paint, pdfContext, canvas); | 175 double width = drawOneChar(text[i], paint, pdfContext, canvas); |
172 pdfContext->fGraphicsState.fMatrixTm.preTranslate(SkDoubleToScalar(w
idth), SkDoubleToScalar(0.0)); | 176 pdfContext->fGraphicsState.fMatrixTm.preTranslate(SkDoubleToScalar(w
idth), SkDoubleToScalar(0.0)); |
173 canvas->translate(SkDoubleToScalar(width), SkDoubleToScalar(0.0)); | 177 canvas->translate(SkDoubleToScalar(width), SkDoubleToScalar(0.0)); |
174 } | 178 } |
175 } | 179 } |
176 | 180 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 SkDoubleToScalar(0.0)); | 415 SkDoubleToScalar(0.0)); |
412 return fChars[ch - fFirstChar].fWidth; | 416 return fChars[ch - fFirstChar].fWidth; |
413 } | 417 } |
414 | 418 |
415 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { | 419 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { |
416 | 420 |
417 } | 421 } |
418 }; | 422 }; |
419 | 423 |
420 #endif // __DEFINED__SkPdfFont | 424 #endif // __DEFINED__SkPdfFont |
OLD | NEW |