| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 #include "platform/RuntimeEnabledFeatures.h" | 33 #include "platform/RuntimeEnabledFeatures.h" |
| 34 #include "wtf/text/AtomicStringHash.h" | 34 #include "wtf/text/AtomicStringHash.h" |
| 35 #include "wtf/text/StringHash.h" | 35 #include "wtf/text/StringHash.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 struct SameSizeAsFontDescription { | 39 struct SameSizeAsFontDescription { |
| 40 FontFamily familyList; | 40 FontFamily familyList; |
| 41 RefPtr<FontFeatureSettings> m_featureSettings; | 41 RefPtr<FontFeatureSettings> m_featureSettings; |
| 42 String locale; | 42 String locale; |
| 43 float sizes[4]; | 43 float sizes[5]; |
| 44 // FXIME: Make them fit into one word. | 44 // FXIME: Make them fit into one word. |
| 45 uint32_t bitfields; | 45 uint32_t bitfields; |
| 46 uint32_t bitfields2 : 7; | 46 uint32_t bitfields2 : 7; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 static_assert(sizeof(FontDescription) == sizeof(SameSizeAsFontDescription), "Fon
tDescription should stay small"); | 49 static_assert(sizeof(FontDescription) == sizeof(SameSizeAsFontDescription), "Fon
tDescription should stay small"); |
| 50 | 50 |
| 51 TypesettingFeatures FontDescription::s_defaultTypesettingFeatures = 0; | 51 TypesettingFeatures FontDescription::s_defaultTypesettingFeatures = 0; |
| 52 | 52 |
| 53 bool FontDescription::s_useSubpixelTextPositioning = false; | 53 bool FontDescription::s_useSubpixelTextPositioning = false; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 m_historicalLigaturesState = ligatures.historical; | 138 m_historicalLigaturesState = ligatures.historical; |
| 139 m_contextualLigaturesState = ligatures.contextual; | 139 m_contextualLigaturesState = ligatures.contextual; |
| 140 | 140 |
| 141 updateTypesettingFeatures(); | 141 updateTypesettingFeatures(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 float FontDescription::effectiveFontSize() const | 144 float FontDescription::effectiveFontSize() const |
| 145 { | 145 { |
| 146 // Ensure that the effective precision matches the font-cache precision. | 146 // Ensure that the effective precision matches the font-cache precision. |
| 147 // This guarantees that the same precision is used regardless of cache statu
s. | 147 // This guarantees that the same precision is used regardless of cache statu
s. |
| 148 return floorf(computedSize() * FontCacheKey::precisionMultiplier()) / FontCa
cheKey::precisionMultiplier(); | 148 float computedOrAdjustedSize = adjustedSize() ? adjustedSize() : computedSiz
e(); |
| 149 return floorf(computedOrAdjustedSize * FontCacheKey::precisionMultiplier())
/ FontCacheKey::precisionMultiplier(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 FontCacheKey FontDescription::cacheKey(const FontFaceCreationParams& creationPar
ams, FontTraits desiredTraits) const | 152 FontCacheKey FontDescription::cacheKey(const FontFaceCreationParams& creationPar
ams, FontTraits desiredTraits) const |
| 152 { | 153 { |
| 153 FontTraits fontTraits = desiredTraits.bitfield() ? desiredTraits : traits(); | 154 FontTraits fontTraits = desiredTraits.bitfield() ? desiredTraits : traits(); |
| 154 | 155 |
| 155 unsigned options = | 156 unsigned options = |
| 156 static_cast<unsigned>(m_syntheticItalic) << 5 | // bit 6 | 157 static_cast<unsigned>(m_syntheticItalic) << 5 | // bit 6 |
| 157 static_cast<unsigned>(m_syntheticBold) << 4 | // bit 5 | 158 static_cast<unsigned>(m_syntheticBold) << 4 | // bit 5 |
| 158 static_cast<unsigned>(m_textRendering) << 2 | // bits 3-4 | 159 static_cast<unsigned>(m_textRendering) << 2 | // bits 3-4 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 219 |
| 219 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 220 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
| 220 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 221 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
| 221 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { | 222 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { |
| 222 m_typesettingFeatures |= blink::Ligatures; | 223 m_typesettingFeatures |= blink::Ligatures; |
| 223 } | 224 } |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |