| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // we get out of the loop, |i| will be |i + 1|. That is, if only the | 214 // we get out of the loop, |i| will be |i + 1|. That is, if only the |
| 215 // last font in the array covers the character, |i| will be numFonts. | 215 // last font in the array covers the character, |i| will be numFonts. |
| 216 // So, we have to use '<=" rather than '<' to see if we found a font | 216 // So, we have to use '<=" rather than '<' to see if we found a font |
| 217 // covering the character. | 217 // covering the character. |
| 218 if (i <= num_fonts) | 218 if (i <= num_fonts) |
| 219 return FontDataFromFontPlatformData(data, kDoNotRetain); | 219 return FontDataFromFontPlatformData(data, kDoNotRetain); |
| 220 | 220 |
| 221 return nullptr; | 221 return nullptr; |
| 222 } | 222 } |
| 223 | 223 |
| 224 static inline bool EqualIgnoringCase(const AtomicString& a, const SkString& b) { | 224 static inline bool DeprecatedEqualIgnoringCase(const AtomicString& a, |
| 225 return EqualIgnoringCase(a, ToAtomicString(b)); | 225 const SkString& b) { |
| 226 return DeprecatedEqualIgnoringCase(a, ToAtomicString(b)); |
| 226 } | 227 } |
| 227 | 228 |
| 228 static bool TypefacesMatchesFamily(const SkTypeface* tf, | 229 static bool TypefacesMatchesFamily(const SkTypeface* tf, |
| 229 const AtomicString& family) { | 230 const AtomicString& family) { |
| 230 SkTypeface::LocalizedStrings* actual_families = | 231 SkTypeface::LocalizedStrings* actual_families = |
| 231 tf->createFamilyNameIterator(); | 232 tf->createFamilyNameIterator(); |
| 232 bool matches_requested_family = false; | 233 bool matches_requested_family = false; |
| 233 SkTypeface::LocalizedString actual_family; | 234 SkTypeface::LocalizedString actual_family; |
| 234 | 235 |
| 235 while (actual_families->next(&actual_family)) { | 236 while (actual_families->next(&actual_family)) { |
| 236 if (EqualIgnoringCase(family, actual_family.fString)) { | 237 if (DeprecatedEqualIgnoringCase(family, actual_family.fString)) { |
| 237 matches_requested_family = true; | 238 matches_requested_family = true; |
| 238 break; | 239 break; |
| 239 } | 240 } |
| 240 } | 241 } |
| 241 actual_families->unref(); | 242 actual_families->unref(); |
| 242 | 243 |
| 243 // getFamilyName may return a name not returned by the | 244 // getFamilyName may return a name not returned by the |
| 244 // createFamilyNameIterator. | 245 // createFamilyNameIterator. |
| 245 // Specifically in cases where Windows substitutes the font based on the | 246 // Specifically in cases where Windows substitutes the font based on the |
| 246 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes registry | 247 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes registry |
| 247 // entries. | 248 // entries. |
| 248 if (!matches_requested_family) { | 249 if (!matches_requested_family) { |
| 249 SkString family_name; | 250 SkString family_name; |
| 250 tf->getFamilyName(&family_name); | 251 tf->getFamilyName(&family_name); |
| 251 if (EqualIgnoringCase(family, family_name)) | 252 if (DeprecatedEqualIgnoringCase(family, family_name)) |
| 252 matches_requested_family = true; | 253 matches_requested_family = true; |
| 253 } | 254 } |
| 254 | 255 |
| 255 return matches_requested_family; | 256 return matches_requested_family; |
| 256 } | 257 } |
| 257 | 258 |
| 258 static bool TypefacesHasWeightSuffix(const AtomicString& family, | 259 static bool TypefacesHasWeightSuffix(const AtomicString& family, |
| 259 AtomicString& adjusted_name, | 260 AtomicString& adjusted_name, |
| 260 FontWeight& variant_weight) { | 261 FontWeight& variant_weight) { |
| 261 struct FamilyWeightSuffix { | 262 struct FamilyWeightSuffix { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 ((font_description.Style() == kFontStyleItalic || | 397 ((font_description.Style() == kFontStyleItalic || |
| 397 font_description.Style() == kFontStyleOblique) && | 398 font_description.Style() == kFontStyleOblique) && |
| 398 !tf->isItalic()) || | 399 !tf->isItalic()) || |
| 399 font_description.IsSyntheticItalic(), | 400 font_description.IsSyntheticItalic(), |
| 400 font_description.Orientation())); | 401 font_description.Orientation())); |
| 401 | 402 |
| 402 return result; | 403 return result; |
| 403 } | 404 } |
| 404 | 405 |
| 405 } // namespace blink | 406 } // namespace blink |
| OLD | NEW |