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

Side by Side Diff: Source/platform/fonts/FontFallbackList.cpp

Issue 162883002: Primary FontData of FontFallbackList should have space character (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (m_fontList[i]->isCustomFont() && m_fontList[i]->isLoading()) { 101 if (m_fontList[i]->isCustomFont() && m_fontList[i]->isLoading()) {
102 m_loadingCustomFonts = true; 102 m_loadingCustomFonts = true;
103 return true; 103 return true;
104 } 104 }
105 } 105 }
106 return false; 106 return false;
107 } 107 }
108 108
109 const FontData* FontFallbackList::primaryFontData(const FontDescription& fontDes cription) const 109 const FontData* FontFallbackList::primaryFontData(const FontDescription& fontDes cription) const
110 { 110 {
111 bool shouldLoadCustomFont = true;
112
111 for (unsigned fontIndex = 0; ; ++fontIndex) { 113 for (unsigned fontIndex = 0; ; ++fontIndex) {
112 const FontData* fontData = fontDataAt(fontDescription, fontIndex); 114 const FontData* fontData = fontDataAt(fontDescription, fontIndex);
113 if (!fontData) { 115 if (!fontData) {
114 // All fonts are custom fonts and are loading. Return the first Font Data. 116 // All fonts are custom fonts and are loading. Return the first Font Data.
115 // FIXME: Correct fallback to the default font. 117 // FIXME: Correct fallback to the default font.
116 return fontDataAt(fontDescription, 0); 118 return fontDataAt(fontDescription, 0);
117 } 119 }
118 120
121 if (fontData->isSegmented() && !toSegmentedFontData(fontData)->containsC haracter(' '))
122 continue;
123
119 // When a custom font is loading, we should use the correct fallback fon t to layout the text. 124 // When a custom font is loading, we should use the correct fallback fon t to layout the text.
120 // Here skip the temporary font for the loading custom font which may no t act as the correct fallback font. 125 // Here skip the temporary font for the loading custom font which may no t act as the correct fallback font.
121 if (!fontData->isLoadingFallback()) 126 if (!fontData->isLoadingFallback())
122 return fontData; 127 return fontData;
123 128
124 // Begin to load the first custom font if needed. 129 // Begin to load the first custom font if needed.
125 if (!fontIndex) { 130 if (shouldLoadCustomFont) {
131 shouldLoadCustomFont = false;
126 const SimpleFontData* simpleFontData = fontData->fontDataForCharacte r(' '); 132 const SimpleFontData* simpleFontData = fontData->fontDataForCharacte r(' ');
127 if (simpleFontData && simpleFontData->customFontData()) 133 if (simpleFontData && simpleFontData->customFontData())
128 simpleFontData->customFontData()->beginLoadIfNeeded(); 134 simpleFontData->customFontData()->beginLoadIfNeeded();
129 } 135 }
130 } 136 }
131 } 137 }
132 138
133 PassRefPtr<FontData> FontFallbackList::getFontData(const FontDescription& fontDe scription, int& familyIndex) const 139 PassRefPtr<FontData> FontFallbackList::getFontData(const FontDescription& fontDe scription, int& familyIndex) const
134 { 140 {
135 RefPtr<FontData> result; 141 RefPtr<FontData> result;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); 196 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex);
191 if (result) { 197 if (result) {
192 m_fontList.append(result); 198 m_fontList.append(result);
193 if (result->isLoading()) 199 if (result->isLoading())
194 m_loadingCustomFonts = true; 200 m_loadingCustomFonts = true;
195 } 201 }
196 return result.get(); 202 return result.get();
197 } 203 }
198 204
199 } 205 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/font-face-unicode-range-load-expected.txt ('k') | Source/platform/fonts/SegmentedFontData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698