OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // we get out of the loop, |i| will be |i + 1|. That is, if only the | 150 // we get out of the loop, |i| will be |i + 1|. That is, if only the |
151 // last font in the array covers the character, |i| will be numFonts. | 151 // last font in the array covers the character, |i| will be numFonts. |
152 // So, we have to use '<=" rather than '<' to see if we found a font | 152 // So, we have to use '<=" rather than '<' to see if we found a font |
153 // covering the character. | 153 // covering the character. |
154 if (i <= numFonts) | 154 if (i <= numFonts) |
155 return getFontResourceData(data, DoNotRetain); | 155 return getFontResourceData(data, DoNotRetain); |
156 | 156 |
157 return 0; | 157 return 0; |
158 } | 158 } |
159 | 159 |
| 160 static inline bool equalIgnoringCase(const AtomicString& a, const SkString& b) |
| 161 { |
| 162 return equalIgnoringCase(a, AtomicString::fromUTF8(b.c_str())); |
| 163 } |
| 164 |
160 static bool typefacesMatchesFamily(const SkTypeface* tf, const AtomicString& fam
ily) | 165 static bool typefacesMatchesFamily(const SkTypeface* tf, const AtomicString& fam
ily) |
161 { | 166 { |
162 SkTypeface::LocalizedStrings* actualFamilies = tf->createFamilyNameIterator(
); | 167 SkTypeface::LocalizedStrings* actualFamilies = tf->createFamilyNameIterator(
); |
163 bool matchesRequestedFamily = false; | 168 bool matchesRequestedFamily = false; |
164 SkTypeface::LocalizedString actualFamily; | 169 SkTypeface::LocalizedString actualFamily; |
165 | 170 |
166 while (actualFamilies->next(&actualFamily)) { | 171 while (actualFamilies->next(&actualFamily)) { |
167 if (equalIgnoringCase(family, AtomicString::fromUTF8(actualFamily.fStrin
g.c_str()))) { | 172 if (equalIgnoringCase(family, actualFamily.fString)) { |
168 matchesRequestedFamily = true; | 173 matchesRequestedFamily = true; |
169 break; | 174 break; |
170 } | 175 } |
171 } | 176 } |
172 actualFamilies->unref(); | 177 actualFamilies->unref(); |
173 | 178 |
174 return matchesRequestedFamily; | 179 return matchesRequestedFamily; |
175 } | 180 } |
176 | 181 |
177 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family) | 182 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family) |
(...skipping 17 matching lines...) Expand all Loading... |
195 name.data(), | 200 name.data(), |
196 fontDescription.computedSize(), | 201 fontDescription.computedSize(), |
197 fontDescription.weight() >= FontWeightBold && !tf->isBold(), | 202 fontDescription.weight() >= FontWeightBold && !tf->isBold(), |
198 fontDescription.italic() && !tf->isItalic(), | 203 fontDescription.italic() && !tf->isItalic(), |
199 fontDescription.orientation()); | 204 fontDescription.orientation()); |
200 tf->unref(); | 205 tf->unref(); |
201 return result; | 206 return result; |
202 } | 207 } |
203 | 208 |
204 } | 209 } |
OLD | NEW |