| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkDataTable.h" | 8 #include "SkDataTable.h" |
| 9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" |
| 10 #include "SkFontHost_FreeType_common.h" | 10 #include "SkFontHost_FreeType_common.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) | 387 : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) |
| 388 , fStream(SkRef(stream)) | 388 , fStream(SkRef(stream)) |
| 389 , fIndex(ttcIndex) | 389 , fIndex(ttcIndex) |
| 390 { }; | 390 { }; |
| 391 | 391 |
| 392 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { | 392 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { |
| 393 familyName->reset(); | 393 familyName->reset(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) co
nst SK_OVERRIDE { | 396 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) co
nst SK_OVERRIDE { |
| 397 desc->setStyle(this->style()); | 397 desc->setFontIndex(fIndex); |
| 398 *serialize = true; | 398 *serialize = true; |
| 399 } | 399 } |
| 400 | 400 |
| 401 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { | 401 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { |
| 402 *ttcIndex = fIndex; | 402 *ttcIndex = fIndex; |
| 403 return fStream->duplicate(); | 403 return fStream->duplicate(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 private: | 406 private: |
| 407 SkAutoTUnref<SkStreamAsset> fStream; | 407 SkAutoTUnref<SkStreamAsset> fStream; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 418 } | 418 } |
| 419 mutable SkAutoFcPattern fPattern; | 419 mutable SkAutoFcPattern fPattern; |
| 420 | 420 |
| 421 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { | 421 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { |
| 422 *familyName = get_string(fPattern, FC_FAMILY); | 422 *familyName = get_string(fPattern, FC_FAMILY); |
| 423 } | 423 } |
| 424 | 424 |
| 425 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) co
nst SK_OVERRIDE { | 425 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) co
nst SK_OVERRIDE { |
| 426 FCLocker lock; | 426 FCLocker lock; |
| 427 desc->setFamilyName(get_string(fPattern, FC_FAMILY)); | 427 desc->setFamilyName(get_string(fPattern, FC_FAMILY)); |
| 428 desc->setFontFileName(get_string(fPattern, FC_FILE)); | |
| 429 desc->setFullName(get_string(fPattern, FC_FULLNAME)); | 428 desc->setFullName(get_string(fPattern, FC_FULLNAME)); |
| 430 desc->setPostscriptName(get_string(fPattern, FC_POSTSCRIPT_NAME)); | 429 desc->setPostscriptName(get_string(fPattern, FC_POSTSCRIPT_NAME)); |
| 431 desc->setStyle(this->style()); | 430 desc->setFontFileName(get_string(fPattern, FC_FILE)); |
| 431 desc->setFontIndex(get_int(fPattern, FC_INDEX, 0)); |
| 432 *serialize = false; | 432 *serialize = false; |
| 433 } | 433 } |
| 434 | 434 |
| 435 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { | 435 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { |
| 436 FCLocker lock; | 436 FCLocker lock; |
| 437 *ttcIndex = get_int(fPattern, FC_INDEX, 0); | 437 *ttcIndex = get_int(fPattern, FC_INDEX, 0); |
| 438 return SkStream::NewFromFile(get_string(fPattern, FC_FILE)); | 438 return SkStream::NewFromFile(get_string(fPattern, FC_FILE)); |
| 439 } | 439 } |
| 440 | 440 |
| 441 virtual ~SkTypeface_fontconfig() { | 441 virtual ~SkTypeface_fontconfig() { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 return typeface.detach(); | 856 return typeface.detach(); |
| 857 } | 857 } |
| 858 | 858 |
| 859 return this->matchFamilyStyle(NULL, style); | 859 return this->matchFamilyStyle(NULL, style); |
| 860 } | 860 } |
| 861 }; | 861 }; |
| 862 | 862 |
| 863 SkFontMgr* SkFontMgr::Factory() { | 863 SkFontMgr* SkFontMgr::Factory() { |
| 864 return SkNEW(SkFontMgr_fontconfig); | 864 return SkNEW(SkFontMgr_fontconfig); |
| 865 } | 865 } |
| OLD | NEW |