Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2008 Google Inc. | 2 * Copyright 2008 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 "SkFontConfigInterface.h" | 8 #include "SkFontConfigInterface.h" |
| 9 #include "SkFontConfigTypeface.h" | 9 #include "SkFontConfigTypeface.h" |
| 10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 78 |
| 79 SkTypeface* FontConfigTypeface::LegacyCreateTypeface( | 79 SkTypeface* FontConfigTypeface::LegacyCreateTypeface( |
| 80 const SkTypeface* familyFace, | 80 const SkTypeface* familyFace, |
| 81 const char familyName[], | 81 const char familyName[], |
| 82 SkTypeface::Style style) { | 82 SkTypeface::Style style) { |
| 83 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); | 83 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); |
| 84 if (NULL == fci.get()) { | 84 if (NULL == fci.get()) { |
| 85 return NULL; | 85 return NULL; |
| 86 } | 86 } |
| 87 | 87 |
| 88 SkString familyFaceName; | |
| 88 if (familyFace) { | 89 if (familyFace) { |
|
bungeman-skia
2015/02/18 21:05:49
It turns out we never actually come down this path
| |
| 89 FontConfigTypeface* fct = (FontConfigTypeface*)familyFace; | 90 familyFace->getFamilyName(&familyFaceName); |
| 90 familyName = fct->getFamilyName(); | 91 familyName = familyFaceName.c_str(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 SkFontStyle requestedStyle(style); | 94 SkFontStyle requestedStyle(style); |
| 94 FindRec rec(familyName, requestedStyle); | 95 FindRec rec(familyName, requestedStyle); |
| 95 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec); | 96 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec); |
| 96 if (face) { | 97 if (face) { |
| 97 //SkDebugf("found cached face <%s> <%s> %p [%d]\n", | 98 //SkDebugf("found cached face <%s> <%s> %p [%d]\n", |
| 98 // familyName, ((FontConfigTypeface*)face)->getFamilyName(), | 99 // familyName, ((FontConfigTypeface*)face)->getFamilyName(), |
| 99 // face, face->getRefCnt()); | 100 // face, face->getRefCnt()); |
| 100 return face; | 101 return face; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); | 138 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); |
| 138 if (NULL == fci.get()) { | 139 if (NULL == fci.get()) { |
| 139 return NULL; | 140 return NULL; |
| 140 } | 141 } |
| 141 | 142 |
| 142 *ttcIndex = this->getIdentity().fTTCIndex; | 143 *ttcIndex = this->getIdentity().fTTCIndex; |
| 143 return fci->openStream(this->getIdentity()); | 144 return fci->openStream(this->getIdentity()); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void FontConfigTypeface::onGetFamilyName(SkString* familyName) const { | 147 void FontConfigTypeface::onGetFamilyName(SkString* familyName) const { |
| 147 *familyName = this->getFamilyName(); | 148 *familyName = fFamilyName; |
| 148 } | 149 } |
| 149 | 150 |
| 150 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, | 151 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, |
| 151 bool* isLocalStream) const { | 152 bool* isLocalStream) const { |
| 152 desc->setFamilyName(this->getFamilyName()); | 153 SkString name; |
| 154 this->getFamilyName(&name); | |
| 155 desc->setFamilyName(name.c_str()); | |
| 153 desc->setFontIndex(this->getIdentity().fTTCIndex); | 156 desc->setFontIndex(this->getIdentity().fTTCIndex); |
| 154 *isLocalStream = SkToBool(this->getLocalStream()); | 157 *isLocalStream = SkToBool(this->getLocalStream()); |
| 155 } | 158 } |
| OLD | NEW |