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

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

Issue 22407005: pdfviewer: fix font rotation issues (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/SkPdfRenderer.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> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SkPdfFont() : fBaseFont(NULL), fEncoding(SkPdfDefaultEncoding::instance()), fToUnicode(NULL) {} 165 SkPdfFont() : fBaseFont(NULL), fEncoding(SkPdfDefaultEncoding::instance()), fToUnicode(NULL) {}
166 166
167 virtual ~SkPdfFont() { 167 virtual ~SkPdfFont() {
168 // TODO(edisonn): NYI (will leak for now) 168 // TODO(edisonn): NYI (will leak for now)
169 } 169 }
170 170
171 const SkPdfEncoding* encoding() const {return fEncoding;} 171 const SkPdfEncoding* encoding() const {return fEncoding;}
172 172
173 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) {
174 for (int i = 0 ; i < text.size(); i++) { 174 for (int i = 0 ; i < text.size(); i++) {
175 canvas->setMatrix(pdfContext->fGraphicsState.fMatrixTm);
176 #ifdef PDF_TRACE
177 SkPoint point = SkPoint::Make(SkDoubleToScalar(0), SkDoubleToScalar( 0));
178 pdfContext->fGraphicsState.fMatrixTm.mapPoints(&point, 1);
179 printf("DrawText at (%f, %f)\n", SkScalarToDouble(point.x()), SkScal arToDouble(point.y()));
180 #endif // PDF_TRACE
175 double width = drawOneChar(text[i], paint, pdfContext, canvas); 181 double width = drawOneChar(text[i], paint, pdfContext, canvas);
176 pdfContext->fGraphicsState.fMatrixTm.preTranslate(SkDoubleToScalar(w idth), SkDoubleToScalar(0.0)); 182 pdfContext->fGraphicsState.fMatrixTm.preTranslate(SkDoubleToScalar(w idth), SkDoubleToScalar(0.0));
177 canvas->translate(SkDoubleToScalar(width), SkDoubleToScalar(0.0));
178 } 183 }
179 } 184 }
180 185
181 void ToUnicode(const SkDecodedText& textIn, SkUnicodeText* textOut) const { 186 void ToUnicode(const SkDecodedText& textIn, SkUnicodeText* textOut) const {
182 if (fToUnicode) { 187 if (fToUnicode) {
183 textOut->text = new uint16_t[textIn.len]; 188 textOut->text = new uint16_t[textIn.len];
184 textOut->len = textIn.len; 189 textOut->len = textIn.len;
185 for (int i = 0; i < textIn.len; i++) { 190 for (int i = 0; i < textIn.len; i++) {
186 textOut->text[i] = fToUnicode->fCMapEncoding[textIn.text[i]]; 191 textOut->text[i] = fToUnicode->fCMapEncoding[textIn.text[i]];
187 } 192 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 SkDoubleToScalar(0.0)); 420 SkDoubleToScalar(0.0));
416 return fChars[ch - fFirstChar].fWidth; 421 return fChars[ch - fFirstChar].fWidth;
417 } 422 }
418 423
419 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { 424 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) {
420 425
421 } 426 }
422 }; 427 };
423 428
424 #endif // __DEFINED__SkPdfFont 429 #endif // __DEFINED__SkPdfFont
OLDNEW
« no previous file with comments | « no previous file | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698