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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp

Issue 2161683002: Add LayoutLocale class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test stability Created 4 years, 4 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 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 || fontDescription.weight() >= FontWeightBold)) { 119 || fontDescription.weight() >= FontWeightBold)) {
120 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle( 120 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle(
121 fontDescription, character); 121 fontDescription, character);
122 if (fontData) 122 if (fontData)
123 return fontData; 123 return fontData;
124 } 124 }
125 125
126 UScriptCode script; 126 UScriptCode script;
127 const wchar_t* family = getFallbackFamily(character, 127 const wchar_t* family = getFallbackFamily(character,
128 fontDescription.genericFamily(), 128 fontDescription.genericFamily(),
129 fontDescription.script(), 129 fontDescription.localeOrDefault(),
130 fontDescription.locale(),
131 &script, 130 &script,
132 fallbackPriority, 131 fallbackPriority,
133 m_fontManager.get()); 132 m_fontManager.get());
134 FontPlatformData* data = 0; 133 FontPlatformData* data = 0;
135 if (family) { 134 if (family) {
136 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family ))); 135 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family )));
137 data = getFontPlatformData(fontDescription, createByFamily); 136 data = getFontPlatformData(fontDescription, createByFamily);
138 } 137 }
139 138
140 if ((!data || !data->fontContainsCharacter(character)) && s_useSkiaFontFallb ack) { 139 if ((!data || !data->fontContainsCharacter(character)) && s_useSkiaFontFallb ack) {
141 const char* bcp47Locale = nullptr; 140 const char* bcp47Locale = nullptr;
142 int localeCount = 0; 141 int localeCount = 0;
143 CString fontLocale; 142 CString fontLocale;
144 // If the font description has a locale, use that. Otherwise, Skia will 143 // If the font description has a locale, use that. Otherwise, Skia will
145 // fall back on the user's default locale. 144 // fall back on the user's default locale.
146 // TODO(kulshin): extract locale fallback logic from 145 // TODO(kulshin): extract locale fallback logic from
147 // FontCacheAndroid.cpp and share that code 146 // FontCacheAndroid.cpp and share that code
148 if (!fontDescription.locale().isEmpty()) { 147 if (fontDescription.locale()) {
149 fontLocale = toSkFontMgrLocale(fontDescription.locale()); 148 fontLocale = fontDescription.locale()->localeForSkFontMgr();
150 bcp47Locale = fontLocale.data(); 149 bcp47Locale = fontLocale.data();
151 localeCount = 1; 150 localeCount = 1;
152 } 151 }
153 152
154 CString familyName = fontDescription.family().family().utf8(); 153 CString familyName = fontDescription.family().family().utf8();
155 154
156 SkTypeface* typeface = m_fontManager->matchFamilyStyleCharacter( 155 SkTypeface* typeface = m_fontManager->matchFamilyStyleCharacter(
157 familyName.data(), 156 familyName.data(),
158 fontDescription.skiaFontStyle(), 157 fontDescription.skiaFontStyle(),
159 &bcp47Locale, 158 &bcp47Locale,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (typefacesMatchesFamily(tf.get(), family)) { 446 if (typefacesMatchesFamily(tf.get(), family)) {
448 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); 447 result->setMinSizeForSubpixel(minSizeForSubpixelForFont);
449 break; 448 break;
450 } 449 }
451 } 450 }
452 451
453 return result; 452 return result;
454 } 453 }
455 454
456 } // namespace blink 455 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698