| 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 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "core/platform/graphics/FontDescription.h" | 31 #include "core/platform/graphics/FontDescription.h" |
| 32 | 32 |
| 33 #include "FontFamilyNames.h" |
| 34 |
| 33 namespace WebCore { | 35 namespace WebCore { |
| 34 | 36 |
| 35 struct SameSizeAsFontDescription { | 37 struct SameSizeAsFontDescription { |
| 36 FontFamily familyList; | 38 FontFamily familyList; |
| 37 RefPtr<FontFeatureSettings> m_featureSettings; | 39 RefPtr<FontFeatureSettings> m_featureSettings; |
| 38 float sizes[2]; | 40 float sizes[2]; |
| 39 // FXIME: Make them fit into one word. | 41 // FXIME: Make them fit into one word. |
| 40 uint32_t bitfields; | 42 uint32_t bitfields; |
| 41 uint32_t bitfields2 : 8; | 43 uint32_t bitfields2 : 8; |
| 42 }; | 44 }; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 case FontWeight600: | 82 case FontWeight600: |
| 81 case FontWeight700: | 83 case FontWeight700: |
| 82 case FontWeight800: | 84 case FontWeight800: |
| 83 case FontWeight900: | 85 case FontWeight900: |
| 84 return FontWeight900; | 86 return FontWeight900; |
| 85 } | 87 } |
| 86 ASSERT_NOT_REACHED(); | 88 ASSERT_NOT_REACHED(); |
| 87 return FontWeightNormal; | 89 return FontWeightNormal; |
| 88 } | 90 } |
| 89 | 91 |
| 92 bool FontDescription::useFixedDefaultSize() const |
| 93 { |
| 94 // only use fixed default size when there is only one font family, and that
family is "monospace" |
| 95 return genericFamily() == MonospaceFamily && !family().next() && family().fa
mily() == FontFamilyNames::monospaceFamily; |
| 96 } |
| 97 |
| 90 FontTraitsMask FontDescription::traitsMask() const | 98 FontTraitsMask FontDescription::traitsMask() const |
| 91 { | 99 { |
| 92 return static_cast<FontTraitsMask>((m_italic ? FontStyleItalicMask : FontSty
leNormalMask) | 100 return static_cast<FontTraitsMask>((m_italic ? FontStyleItalicMask : FontSty
leNormalMask) |
| 93 | (m_smallCaps ? FontVariantSmallCapsMask : FontVariantNormalMask) | 101 | (m_smallCaps ? FontVariantSmallCapsMask : FontVariantNormalMask) |
| 94 | (FontWeight100Mask << (m_weight - FontWeight100))); | 102 | (FontWeight100Mask << (m_weight - FontWeight100))); |
| 95 | 103 |
| 96 } | 104 } |
| 97 | 105 |
| 98 FontDescription FontDescription::makeNormalFeatureSettings() const | 106 FontDescription FontDescription::makeNormalFeatureSettings() const |
| 99 { | 107 { |
| 100 FontDescription normalDescription(*this); | 108 FontDescription normalDescription(*this); |
| 101 normalDescription.setFeatureSettings(0); | 109 normalDescription.setFeatureSettings(0); |
| 102 return normalDescription; | 110 return normalDescription; |
| 103 } | 111 } |
| 104 | 112 |
| 105 } // namespace WebCore | 113 } // namespace WebCore |
| OLD | NEW |