| 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 #include "SkFontMgr.h" | 8 #include "SkFontMgr.h" |
| 9 #include "SkFontStyle.h" | 9 #include "SkFontStyle.h" |
| 10 #include "SkFontConfigInterface.h" | 10 #include "SkFontConfigInterface.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 return NULL; // don't accept too large fonts (>= 1GB) for safety. | 304 return NULL; // don't accept too large fonts (>= 1GB) for safety. |
| 305 } | 305 } |
| 306 | 306 |
| 307 // TODO should the caller give us the style or should we get it from fre
etype? | 307 // TODO should the caller give us the style or should we get it from fre
etype? |
| 308 SkTypeface::Style style = SkTypeface::kNormal; | 308 SkTypeface::Style style = SkTypeface::kNormal; |
| 309 bool isFixedWidth = false; | 309 bool isFixedWidth = false; |
| 310 if (!find_name_and_attributes(stream, NULL, &style, &isFixedWidth)) { | 310 if (!find_name_and_attributes(stream, NULL, &style, &isFixedWidth)) { |
| 311 return NULL; | 311 return NULL; |
| 312 } | 312 } |
| 313 | 313 |
| 314 SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, isFixedWidth,
stream)); | 314 SkTypeface* face = FontConfigTypeface::Create(style, isFixedWidth, strea
m); |
| 315 return face; | 315 return face; |
| 316 } | 316 } |
| 317 | 317 |
| 318 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
SK_OVERRIDE { | 318 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const
SK_OVERRIDE { |
| 319 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); | 319 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); |
| 320 return stream.get() ? this->createFromStream(stream, ttcIndex) : NULL; | 320 return stream.get() ? this->createFromStream(stream, ttcIndex) : NULL; |
| 321 } | 321 } |
| 322 | 322 |
| 323 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 323 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
| 324 unsigned styleBits) const SK_OVER
RIDE { | 324 unsigned styleBits) const SK_OVER
RIDE { |
| 325 FCLocker lock; | 325 FCLocker lock; |
| 326 return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName, | 326 return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName, |
| 327 (SkTypeface::Style)styleBits); | 327 (SkTypeface::Style)styleBits); |
| 328 } | 328 } |
| 329 }; | 329 }; |
| 330 | 330 |
| 331 SkFontMgr* SkFontMgr::Factory() { | 331 SkFontMgr* SkFontMgr::Factory() { |
| 332 SkFontConfigInterface* fci = RefFCI(); | 332 SkFontConfigInterface* fci = RefFCI(); |
| 333 return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL; | 333 return fci ? SkNEW_ARGS(SkFontMgr_fontconfig, (fci)) : NULL; |
| 334 } | 334 } |
| OLD | NEW |