OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2014 Google Inc. All rights reserved. | 3 * Copyright (C) 2014 Google 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 * 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 28 matching lines...) Expand all Loading... |
39 FontWeight400 = 3, | 39 FontWeight400 = 3, |
40 FontWeight500 = 4, | 40 FontWeight500 = 4, |
41 FontWeight600 = 5, | 41 FontWeight600 = 5, |
42 FontWeight700 = 6, | 42 FontWeight700 = 6, |
43 FontWeight800 = 7, | 43 FontWeight800 = 7, |
44 FontWeight900 = 8, | 44 FontWeight900 = 8, |
45 FontWeightNormal = FontWeight400, | 45 FontWeightNormal = FontWeight400, |
46 FontWeightBold = FontWeight700 | 46 FontWeightBold = FontWeight700 |
47 }; | 47 }; |
48 | 48 |
| 49 // Converts a FontWeight to its corresponding numeric value |
| 50 inline int numericFontWeight(FontWeight weight) |
| 51 { |
| 52 return (weight - FontWeight100 + 1) * 100; |
| 53 } |
| 54 |
49 // Numeric values matching OS/2 & Windows Metrics usWidthClass table. | 55 // Numeric values matching OS/2 & Windows Metrics usWidthClass table. |
50 // https://www.microsoft.com/typography/otspec/os2.htm | 56 // https://www.microsoft.com/typography/otspec/os2.htm |
51 enum FontStretch { | 57 enum FontStretch { |
52 FontStretchUltraCondensed = 1, | 58 FontStretchUltraCondensed = 1, |
53 FontStretchExtraCondensed = 2, | 59 FontStretchExtraCondensed = 2, |
54 FontStretchCondensed = 3, | 60 FontStretchCondensed = 3, |
55 FontStretchSemiCondensed = 4, | 61 FontStretchSemiCondensed = 4, |
56 FontStretchNormal = 5, | 62 FontStretchNormal = 5, |
57 FontStretchSemiExpanded = 6, | 63 FontStretchSemiExpanded = 6, |
58 FontStretchExpanded = 7, | 64 FontStretchExpanded = 7, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 unsigned m_weight : 4; | 111 unsigned m_weight : 4; |
106 unsigned m_stretch : 4; | 112 unsigned m_stretch : 4; |
107 unsigned m_filler : 21; | 113 unsigned m_filler : 21; |
108 } m_traits; | 114 } m_traits; |
109 FontTraitsBitfield m_bitfield; | 115 FontTraitsBitfield m_bitfield; |
110 }; | 116 }; |
111 }; | 117 }; |
112 | 118 |
113 } // namespace blink | 119 } // namespace blink |
114 #endif // FontTraits_h | 120 #endif // FontTraits_h |
OLD | NEW |