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

Side by Side Diff: Source/core/css/CSSSegmentedFontFace.cpp

Issue 26702008: Allow small-caps synthesis for @font-face with multiple sources including SVG format (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/core/css/CSSSegmentedFontFace.h ('k') | Source/core/css/CSSSegmentedFontFaceCache.cpp » ('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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 fontData = SegmentedFontData::create(); 131 fontData = SegmentedFontData::create();
132 132
133 bool syntheticBold = !(m_traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight60 0Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)); 133 bool syntheticBold = !(m_traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight60 0Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
134 bool syntheticItalic = !(m_traitsMask & FontStyleItalicMask) && (desiredTrai tsMask & FontStyleItalicMask); 134 bool syntheticItalic = !(m_traitsMask & FontStyleItalicMask) && (desiredTrai tsMask & FontStyleItalicMask);
135 135
136 for (int i = m_fontFaces.size() - 1; i >= 0; --i) { 136 for (int i = m_fontFaces.size() - 1; i >= 0; --i) {
137 if (!m_fontFaces[i]->isValid()) 137 if (!m_fontFaces[i]->isValid())
138 continue; 138 continue;
139 if (RefPtr<SimpleFontData> faceFontData = m_fontFaces[i]->getFontData(fo ntDescription, syntheticBold, syntheticItalic)) { 139 if (RefPtr<SimpleFontData> faceFontData = m_fontFaces[i]->getFontData(fo ntDescription, syntheticBold, syntheticItalic)) {
140 ASSERT(!faceFontData->isSegmented()); 140 ASSERT(!faceFontData->isSegmented());
141 #if ENABLE(SVG_FONTS)
142 // For SVG Fonts that specify that they only support the "normal" va riant, we will assume they are incapable
143 // of small-caps synthesis and just ignore the font face.
144 if (faceFontData->isSVGFont() && (desiredTraitsMask & FontVariantSma llCapsMask) && !(m_traitsMask & FontVariantSmallCapsMask))
145 continue;
146 #endif
141 appendFontData(fontData.get(), faceFontData.release(), m_fontFaces[i ]->ranges()); 147 appendFontData(fontData.get(), faceFontData.release(), m_fontFaces[i ]->ranges());
142 } 148 }
143 } 149 }
144 if (fontData->numRanges()) 150 if (fontData->numRanges())
145 return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has. 151 return fontData; // No release, we have a reference to an object in the cache which should retain the ref count it has.
146 152
147 return 0; 153 return 0;
148 } 154 }
149 155
150 bool CSSSegmentedFontFace::hasSVGFontFaceSource() const
151 {
152 unsigned size = m_fontFaces.size();
153 for (unsigned i = 0; i < size; i++) {
154 if (m_fontFaces[i]->hasSVGFontFaceSource())
155 return true;
156 }
157 return false;
158 }
159
160 bool CSSSegmentedFontFace::isLoading() const 156 bool CSSSegmentedFontFace::isLoading() const
161 { 157 {
162 unsigned size = m_fontFaces.size(); 158 unsigned size = m_fontFaces.size();
163 for (unsigned i = 0; i < size; i++) { 159 for (unsigned i = 0; i < size; i++) {
164 if (m_fontFaces[i]->loadStatus() == FontFace::Loading) 160 if (m_fontFaces[i]->loadStatus() == FontFace::Loading)
165 return true; 161 return true;
166 } 162 }
167 return false; 163 return false;
168 } 164 }
169 165
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 unsigned size = m_fontFaces.size(); 216 unsigned size = m_fontFaces.size();
221 for (unsigned i = 0; i < size; i++) { 217 for (unsigned i = 0; i < size; i++) {
222 RefPtr<FontFace> face = m_fontFaces[i]->fontFace(); 218 RefPtr<FontFace> face = m_fontFaces[i]->fontFace();
223 if (face && m_fontFaces[i]->ranges().intersectsWith(text)) 219 if (face && m_fontFaces[i]->ranges().intersectsWith(text))
224 fontFaces.append(face); 220 fontFaces.append(face);
225 } 221 }
226 return fontFaces; 222 return fontFaces;
227 } 223 }
228 224
229 } 225 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSSegmentedFontFace.h ('k') | Source/core/css/CSSSegmentedFontFaceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698