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

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

Issue 616703004: Merge 183104 "Force ComplexPath if any part of the node requires it" (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2171/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | Source/platform/text/TextRun.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 s_useSubpixelPositioning = false; 69 s_useSubpixelPositioning = false;
70 } 70 }
71 71
72 ASSERT(fontManager); 72 ASSERT(fontManager);
73 m_fontManager = adoptPtr(fontManager); 73 m_fontManager = adoptPtr(fontManager);
74 } 74 }
75 75
76 76
77 // Given the desired base font, this will create a SimpleFontData for a specific 77 // Given the desired base font, this will create a SimpleFontData for a specific
78 // font that can be used to render the given range of characters. 78 // font that can be used to render the given range of characters.
79 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip tion& fontDescription, UChar32 character, const SimpleFontData*) 79 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(
80 const FontDescription& fontDescription, UChar32 character,
81 const SimpleFontData* originalFontData)
80 { 82 {
81 // First try the specified font with standard style & weight. 83 // First try the specified font with standard style & weight.
82 if (fontDescription.style() == FontStyleItalic 84 if (fontDescription.style() == FontStyleItalic
83 || fontDescription.weight() >= FontWeightBold) { 85 || fontDescription.weight() >= FontWeightBold) {
84 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle( 86 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle(
85 fontDescription, character); 87 fontDescription, character);
86 if (fontData) 88 if (fontData)
87 return fontData; 89 return fontData;
88 } 90 }
89 91
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // because it's based on script to font mapping. This problem is 156 // because it's based on script to font mapping. This problem is
155 // critical enough for non-Latin scripts (especially Han) to 157 // critical enough for non-Latin scripts (especially Han) to
156 // warrant an additional (real coverage) check with fontCotainsCharacter. 158 // warrant an additional (real coverage) check with fontCotainsCharacter.
157 int i; 159 int i;
158 for (i = 0; (!data || !data->fontContainsCharacter(character)) && i < numFon ts; ++i) { 160 for (i = 0; (!data || !data->fontContainsCharacter(character)) && i < numFon ts; ++i) {
159 family = panUniFonts[i]; 161 family = panUniFonts[i];
160 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family ))); 162 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family )));
161 data = getFontPlatformData(fontDescription, createByFamily); 163 data = getFontPlatformData(fontDescription, createByFamily);
162 } 164 }
163 165
166 // For font fallback we want to match the subpixel behavior of the original
167 // font. Mixing subpixel and non-subpixel in the same text run looks really
168 // odd and causes problems with preferred width calculations.
169 if (data && originalFontData) {
170 const FontPlatformData& platformData = originalFontData->platformData();
171 data->setMinSizeForAntiAlias(platformData.minSizeForAntiAlias());
172 data->setMinSizeForSubpixel(platformData.minSizeForSubpixel());
173 }
174
164 // When i-th font (0-base) in |panUniFonts| contains a character and 175 // When i-th font (0-base) in |panUniFonts| contains a character and
165 // we get out of the loop, |i| will be |i + 1|. That is, if only the 176 // we get out of the loop, |i| will be |i + 1|. That is, if only the
166 // last font in the array covers the character, |i| will be numFonts. 177 // last font in the array covers the character, |i| will be numFonts.
167 // So, we have to use '<=" rather than '<' to see if we found a font 178 // So, we have to use '<=" rather than '<' to see if we found a font
168 // covering the character. 179 // covering the character.
169 if (i <= numFonts) 180 if (i <= numFonts)
170 return fontDataFromFontPlatformData(data, DoNotRetain); 181 return fontDataFromFontPlatformData(data, DoNotRetain);
171 182
172 return nullptr; 183 return nullptr;
173 } 184 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 if (typefacesMatchesFamily(tf.get(), family)) { 381 if (typefacesMatchesFamily(tf.get(), family)) {
371 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); 382 result->setMinSizeForSubpixel(minSizeForSubpixelForFont);
372 break; 383 break;
373 } 384 }
374 } 385 }
375 386
376 return result; 387 return result;
377 } 388 }
378 389
379 } // namespace blink 390 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | Source/platform/text/TextRun.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698