| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class FontMetrics { | 30 class FontMetrics { |
| 31 public: | 31 public: |
| 32 FontMetrics() | 32 FontMetrics() |
| 33 : m_unitsPerEm(gDefaultUnitsPerEm) | 33 : m_unitsPerEm(gDefaultUnitsPerEm) |
| 34 , m_ascent(0) | 34 , m_ascent(0) |
| 35 , m_descent(0) | 35 , m_descent(0) |
| 36 , m_lineGap(0) | 36 , m_lineGap(0) |
| 37 , m_lineSpacing(0) | 37 , m_lineSpacing(0) |
| 38 , m_xHeight(0) | 38 , m_xHeight(0) |
| 39 , m_zeroWidth(0) | 39 , m_zeroWidth(0) |
| 40 , m_underlinethickness(0) |
| 40 , m_hasXHeight(false) | 41 , m_hasXHeight(false) |
| 41 , m_hasZeroWidth(false) | 42 , m_hasZeroWidth(false) |
| 42 { | 43 { |
| 43 } | 44 } |
| 44 | 45 |
| 45 unsigned unitsPerEm() const { return m_unitsPerEm; } | 46 unsigned unitsPerEm() const { return m_unitsPerEm; } |
| 46 void setUnitsPerEm(unsigned unitsPerEm) { m_unitsPerEm = unitsPerEm; } | 47 void setUnitsPerEm(unsigned unitsPerEm) { m_unitsPerEm = unitsPerEm; } |
| 47 | 48 |
| 48 float floatAscent(FontBaseline baselineType = AlphabeticBaseline) const | 49 float floatAscent(FontBaseline baselineType = AlphabeticBaseline) const |
| 49 { | 50 { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 float zeroWidth() const { return m_zeroWidth; } | 116 float zeroWidth() const { return m_zeroWidth; } |
| 116 void setZeroWidth(float zeroWidth) | 117 void setZeroWidth(float zeroWidth) |
| 117 { | 118 { |
| 118 m_zeroWidth = zeroWidth; | 119 m_zeroWidth = zeroWidth; |
| 119 m_hasZeroWidth = true; | 120 m_hasZeroWidth = true; |
| 120 } | 121 } |
| 121 | 122 |
| 122 bool hasZeroWidth() const { return m_hasZeroWidth; } | 123 bool hasZeroWidth() const { return m_hasZeroWidth; } |
| 123 void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; } | 124 void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; } |
| 124 | 125 |
| 126 float underlineThickness() const { return m_underlinethickness; } |
| 127 void setUnderlineThickness(float underlineThickness) { m_underlinethickness
= underlineThickness; } |
| 128 |
| 125 private: | 129 private: |
| 126 friend class SimpleFontData; | 130 friend class SimpleFontData; |
| 127 | 131 |
| 128 void reset() | 132 void reset() |
| 129 { | 133 { |
| 130 m_unitsPerEm = gDefaultUnitsPerEm; | 134 m_unitsPerEm = gDefaultUnitsPerEm; |
| 131 m_ascent = 0; | 135 m_ascent = 0; |
| 132 m_descent = 0; | 136 m_descent = 0; |
| 133 m_lineGap = 0; | 137 m_lineGap = 0; |
| 134 m_lineSpacing = 0; | 138 m_lineSpacing = 0; |
| 135 m_xHeight = 0; | 139 m_xHeight = 0; |
| 136 m_hasXHeight = false; | 140 m_hasXHeight = false; |
| 141 m_underlinethickness = 0; |
| 137 } | 142 } |
| 138 | 143 |
| 139 unsigned m_unitsPerEm; | 144 unsigned m_unitsPerEm; |
| 140 float m_ascent; | 145 float m_ascent; |
| 141 float m_descent; | 146 float m_descent; |
| 142 float m_lineGap; | 147 float m_lineGap; |
| 143 float m_lineSpacing; | 148 float m_lineSpacing; |
| 144 float m_xHeight; | 149 float m_xHeight; |
| 145 float m_zeroWidth; | 150 float m_zeroWidth; |
| 151 float m_underlinethickness; |
| 146 bool m_hasXHeight; | 152 bool m_hasXHeight; |
| 147 bool m_hasZeroWidth; | 153 bool m_hasZeroWidth; |
| 148 }; | 154 }; |
| 149 | 155 |
| 150 inline float scaleEmToUnits(float x, unsigned unitsPerEm) | 156 inline float scaleEmToUnits(float x, unsigned unitsPerEm) |
| 151 { | 157 { |
| 152 return unitsPerEm ? x / unitsPerEm : x; | 158 return unitsPerEm ? x / unitsPerEm : x; |
| 153 } | 159 } |
| 154 | 160 |
| 155 } // namespace WebCore | 161 } // namespace WebCore |
| 156 | 162 |
| 157 #endif // FontMetrics_h | 163 #endif // FontMetrics_h |
| OLD | NEW |