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

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

Issue 2192703002: More LayoutLocale refactor with additional Chinese support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment updated as per drott review 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.localeOrDefault(), 129 fontDescription.locale(),
130 &script, 130 &script,
131 fallbackPriority, 131 fallbackPriority,
132 m_fontManager.get()); 132 m_fontManager.get());
133 FontPlatformData* data = 0; 133 FontPlatformData* data = 0;
134 if (family) { 134 if (family) {
135 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family ))); 135 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family )));
136 data = getFontPlatformData(fontDescription, createByFamily); 136 data = getFontPlatformData(fontDescription, createByFamily);
137 } 137 }
138 138
139 if ((!data || !data->fontContainsCharacter(character)) && s_useSkiaFontFallb ack) { 139 if ((!data || !data->fontContainsCharacter(character)) && s_useSkiaFontFallb ack) {
140 const char* bcp47Locale = nullptr; 140 const char* bcp47Locale = nullptr;
141 int localeCount = 0; 141 int localeCount = 0;
142 CString fontLocale;
143 // If the font description has a locale, use that. Otherwise, Skia will 142 // If the font description has a locale, use that. Otherwise, Skia will
144 // fall back on the user's default locale. 143 // fall back on the user's default locale.
145 // TODO(kulshin): extract locale fallback logic from 144 // TODO(kulshin): extract locale fallback logic from
146 // FontCacheAndroid.cpp and share that code 145 // FontCacheAndroid.cpp and share that code
147 if (fontDescription.locale()) { 146 if (fontDescription.locale()) {
148 fontLocale = fontDescription.locale()->localeForSkFontMgr(); 147 bcp47Locale = fontDescription.locale()->localeForSkFontMgr();
149 bcp47Locale = fontLocale.data();
150 localeCount = 1; 148 localeCount = 1;
151 } 149 }
152 150
153 CString familyName = fontDescription.family().family().utf8(); 151 CString familyName = fontDescription.family().family().utf8();
154 152
155 SkTypeface* typeface = m_fontManager->matchFamilyStyleCharacter( 153 SkTypeface* typeface = m_fontManager->matchFamilyStyleCharacter(
156 familyName.data(), 154 familyName.data(),
157 fontDescription.skiaFontStyle(), 155 fontDescription.skiaFontStyle(),
158 &bcp47Locale, 156 &bcp47Locale,
159 localeCount, 157 localeCount,
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 if (typefacesMatchesFamily(tf.get(), family)) { 444 if (typefacesMatchesFamily(tf.get(), family)) {
447 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); 445 result->setMinSizeForSubpixel(minSizeForSubpixelForFont);
448 break; 446 break;
449 } 447 }
450 } 448 }
451 449
452 return result; 450 return result;
453 } 451 }
454 452
455 } // namespace blink 453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698