Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1478)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp

Issue 2161683002: Add LayoutLocale class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test stability Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 const size_t kMaxLocales = 4; 80 const size_t kMaxLocales = 4;
81 const char* bcp47Locales[kMaxLocales]; 81 const char* bcp47Locales[kMaxLocales];
82 size_t localeCount = 0; 82 size_t localeCount = 0;
83 83
84 if (fallbackPriority == FontFallbackPriority::EmojiEmoji) { 84 if (fallbackPriority == FontFallbackPriority::EmojiEmoji) {
85 bcp47Locales[localeCount++] = kAndroidColorEmojiLocale; 85 bcp47Locales[localeCount++] = kAndroidColorEmojiLocale;
86 } 86 }
87 if (const char* hanLocale = AcceptLanguagesResolver::preferredHanSkFontMgrLo cale()) 87 if (const char* hanLocale = AcceptLanguagesResolver::preferredHanSkFontMgrLo cale())
88 bcp47Locales[localeCount++] = hanLocale; 88 bcp47Locales[localeCount++] = hanLocale;
89 CString defaultLocale = toSkFontMgrLocale(defaultLanguage()); 89 bcp47Locales[localeCount++] = LayoutLocale::getDefault().localeForSkFontMgr( ).data();
90 bcp47Locales[localeCount++] = defaultLocale.data(); 90 if (const LayoutLocale* locale = fontDescription.locale())
91 CString fontLocale; 91 bcp47Locales[localeCount++] = locale->localeForSkFontMgr().data();
92 if (!fontDescription.locale().isEmpty()) {
93 fontLocale = toSkFontMgrLocale(fontDescription.locale());
94 bcp47Locales[localeCount++] = fontLocale.data();
95 }
96 ASSERT_WITH_SECURITY_IMPLICATION(localeCount < kMaxLocales); 92 ASSERT_WITH_SECURITY_IMPLICATION(localeCount < kMaxLocales);
97 RefPtr<SkTypeface> typeface = adoptRef(fm->matchFamilyStyleCharacter(0, SkFo ntStyle(), bcp47Locales, localeCount, c)); 93 RefPtr<SkTypeface> typeface = adoptRef(fm->matchFamilyStyleCharacter(0, SkFo ntStyle(), bcp47Locales, localeCount, c));
98 if (!typeface) 94 if (!typeface)
99 return emptyAtom; 95 return emptyAtom;
100 96
101 SkString skiaFamilyName; 97 SkString skiaFamilyName;
102 typeface->getFamilyName(&skiaFamilyName); 98 typeface->getFamilyName(&skiaFamilyName);
103 return skiaFamilyName.c_str(); 99 return skiaFamilyName.c_str();
104 } 100 }
105 #endif 101 #endif
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return wrapUnique(new FontPlatformData(tf, 210 return wrapUnique(new FontPlatformData(tf,
215 name.data(), 211 name.data(),
216 fontSize, 212 fontSize,
217 (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescr iption.isSyntheticBold(), 213 (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescr iption.isSyntheticBold(),
218 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), 214 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(),
219 fontDescription.orientation())); 215 fontDescription.orientation()));
220 } 216 }
221 #endif // !OS(WIN) 217 #endif // !OS(WIN)
222 218
223 } // namespace blink 219 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698