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

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

Issue 307243002: Fix font family based fallback font selection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Windows link fix. Created 6 years, 6 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
« no previous file with comments | « Source/platform/fonts/FontDescription.h ('k') | Source/platform/fonts/FontFaceCreationParams.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) 2007 Nicholas Shanks <contact@nickshanks.com> 2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com>
3 * Copyright (C) 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2008 Apple 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 { 120 {
121 float size = (RuntimeEnabledFeatures::subpixelFontScalingEnabled()) 121 float size = (RuntimeEnabledFeatures::subpixelFontScalingEnabled())
122 ? computedSize() 122 ? computedSize()
123 : computedPixelSize(); 123 : computedPixelSize();
124 124
125 // Ensure that the effective precision matches the font-cache precision. 125 // Ensure that the effective precision matches the font-cache precision.
126 // This guarantees that the same precision is used regardless of cache statu s. 126 // This guarantees that the same precision is used regardless of cache statu s.
127 return floorf(size * FontCacheKey::precisionMultiplier()) / FontCacheKey::pr ecisionMultiplier(); 127 return floorf(size * FontCacheKey::precisionMultiplier()) / FontCacheKey::pr ecisionMultiplier();
128 } 128 }
129 129
130 FontCacheKey FontDescription::cacheKey(const AtomicString& familyName, FontTrait s desiredTraits) const 130 FontCacheKey FontDescription::cacheKey(const FontFaceCreationParams& creationPar ams, FontTraits desiredTraits) const
131 { 131 {
132 FontTraits fontTraits = desiredTraits.mask() 132 FontTraits fontTraits = desiredTraits.mask()
133 ? desiredTraits 133 ? desiredTraits
134 : traits(); 134 : traits();
135 135
136 unsigned options = 136 unsigned options =
137 static_cast<unsigned>(m_syntheticItalic) << 7 | // bit 8 137 static_cast<unsigned>(m_syntheticItalic) << 7 | // bit 8
138 static_cast<unsigned>(m_syntheticBold) << 6 | // bit 7 138 static_cast<unsigned>(m_syntheticBold) << 6 | // bit 7
139 static_cast<unsigned>(m_fontSmoothing) << 4 | // bits 5-6 139 static_cast<unsigned>(m_fontSmoothing) << 4 | // bits 5-6
140 static_cast<unsigned>(m_textRendering) << 2 | // bits 3-4 140 static_cast<unsigned>(m_textRendering) << 2 | // bits 3-4
141 static_cast<unsigned>(m_orientation) << 1 | // bit 2 141 static_cast<unsigned>(m_orientation) << 1 | // bit 2
142 static_cast<unsigned>(m_subpixelTextPosition); // bit 1 142 static_cast<unsigned>(m_subpixelTextPosition); // bit 1
143 143
144 return FontCacheKey(familyName, effectiveFontSize(), options | fontTraits.ma sk() << 8); 144 return FontCacheKey(creationParams, effectiveFontSize(), options | fontTrait s.mask() << 8);
145 } 145 }
146 146
147 147
148 void FontDescription::setDefaultTypesettingFeatures(TypesettingFeatures typesett ingFeatures) 148 void FontDescription::setDefaultTypesettingFeatures(TypesettingFeatures typesett ingFeatures)
149 { 149 {
150 s_defaultTypesettingFeatures = typesettingFeatures; 150 s_defaultTypesettingFeatures = typesettingFeatures;
151 } 151 }
152 152
153 TypesettingFeatures FontDescription::defaultTypesettingFeatures() 153 TypesettingFeatures FontDescription::defaultTypesettingFeatures()
154 { 154 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt ate 201 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt ate
202 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt ate 202 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt ate
203 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt ate) { 203 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt ate) {
204 m_typesettingFeatures |= WebCore::Ligatures; 204 m_typesettingFeatures |= WebCore::Ligatures;
205 } 205 }
206 } 206 }
207 } 207 }
208 208
209 } // namespace WebCore 209 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontDescription.h ('k') | Source/platform/fonts/FontFaceCreationParams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698