| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef SkPdfFont_DEFINED | 8 #ifndef SkPdfFont_DEFINED |
| 9 #define SkPdfFont_DEFINED | 9 #define SkPdfFont_DEFINED |
| 10 | 10 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 for (int i = 0; i < textIn.len; i++) { | 204 for (int i = 0; i < textIn.len; i++) { |
| 205 textOut->text[i] = fToUnicode->fCMapEncoding[textIn.text[i]]; | 205 textOut->text[i] = fToUnicode->fCMapEncoding[textIn.text[i]]; |
| 206 } | 206 } |
| 207 } else { | 207 } else { |
| 208 textOut->text = textIn.text; | 208 textOut->text = textIn.text; |
| 209 textOut->len = textIn.len; | 209 textOut->len = textIn.len; |
| 210 } | 210 } |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 inline unsigned int ToUnicode(unsigned int ch) const { | 213 inline unsigned int ToUnicode(unsigned int ch) const { |
| 214 if (fToUnicode) { | 214 if (fToUnicode && fToUnicode->fCMapEncoding) { |
| 215 return fToUnicode->fCMapEncoding[ch]; | 215 return fToUnicode->fCMapEncoding[ch]; |
| 216 } else { | 216 } else { |
| 217 return ch; | 217 return ch; |
| 218 } | 218 } |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 static SkPdfFont* fontFromPdfDictionary(SkPdfNativeDoc* doc, SkPdfFontDictio
nary* dict); | 221 static SkPdfFont* fontFromPdfDictionary(SkPdfNativeDoc* doc, SkPdfFontDictio
nary* dict); |
| 222 static SkPdfFont* Default() {return fontFromName(NULL, NULL, "TimesNewRoman"
);} | 222 static SkPdfFont* Default() {return fontFromName(NULL, NULL, "TimesNewRoman"
);} |
| 223 | 223 |
| 224 static SkPdfType0Font* fontFromType0FontDictionary(SkPdfNativeDoc* doc, SkPd
fType0FontDictionary* dict); | 224 static SkPdfType0Font* fontFromType0FontDictionary(SkPdfNativeDoc* doc, SkPd
fType0FontDictionary* dict); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 SkDoubleToScalar(0.0)); | 441 SkDoubleToScalar(0.0)); |
| 442 return fChars[ch - fFirstChar].fWidth; | 442 return fChars[ch - fFirstChar].fWidth; |
| 443 } | 443 } |
| 444 | 444 |
| 445 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { | 445 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { |
| 446 | 446 |
| 447 } | 447 } |
| 448 }; | 448 }; |
| 449 | 449 |
| 450 #endif // SkPdfFont_DEFINED | 450 #endif // SkPdfFont_DEFINED |
| OLD | NEW |