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

Side by Side Diff: Source/platform/fonts/FontMetrics.h

Issue 182923003: Chrome not considering Underline Position from Font (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding comments and updating check for Underline Pos Created 6 years, 9 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
OLDNEW
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 20 matching lines...) Expand all
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_underlinethickness(0)
41 , m_underlinePosition(0)
41 , m_hasXHeight(false) 42 , m_hasXHeight(false)
42 , m_hasZeroWidth(false) 43 , m_hasZeroWidth(false)
43 { 44 {
44 } 45 }
45 46
46 unsigned unitsPerEm() const { return m_unitsPerEm; } 47 unsigned unitsPerEm() const { return m_unitsPerEm; }
47 void setUnitsPerEm(unsigned unitsPerEm) { m_unitsPerEm = unitsPerEm; } 48 void setUnitsPerEm(unsigned unitsPerEm) { m_unitsPerEm = unitsPerEm; }
48 49
49 float floatAscent(FontBaseline baselineType = AlphabeticBaseline) const 50 float floatAscent(FontBaseline baselineType = AlphabeticBaseline) const
50 { 51 {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 m_zeroWidth = zeroWidth; 120 m_zeroWidth = zeroWidth;
120 m_hasZeroWidth = true; 121 m_hasZeroWidth = true;
121 } 122 }
122 123
123 bool hasZeroWidth() const { return m_hasZeroWidth; } 124 bool hasZeroWidth() const { return m_hasZeroWidth; }
124 void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; } 125 void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; }
125 126
126 float underlineThickness() const { return m_underlinethickness; } 127 float underlineThickness() const { return m_underlinethickness; }
127 void setUnderlineThickness(float underlineThickness) { m_underlinethickness = underlineThickness; } 128 void setUnderlineThickness(float underlineThickness) { m_underlinethickness = underlineThickness; }
128 129
130 float underlinePosition() const { return m_underlinePosition; }
131 void setUnderlinePosition(float underlinePosition) { m_underlinePosition = u nderlinePosition; }
132
129 private: 133 private:
130 friend class SimpleFontData; 134 friend class SimpleFontData;
131 135
132 void reset() 136 void reset()
133 { 137 {
134 m_unitsPerEm = gDefaultUnitsPerEm; 138 m_unitsPerEm = gDefaultUnitsPerEm;
135 m_ascent = 0; 139 m_ascent = 0;
136 m_descent = 0; 140 m_descent = 0;
137 m_lineGap = 0; 141 m_lineGap = 0;
138 m_lineSpacing = 0; 142 m_lineSpacing = 0;
139 m_xHeight = 0; 143 m_xHeight = 0;
140 m_hasXHeight = false; 144 m_hasXHeight = false;
141 m_underlinethickness = 0; 145 m_underlinethickness = 0;
146 m_underlinePosition = 0;
142 } 147 }
143 148
144 unsigned m_unitsPerEm; 149 unsigned m_unitsPerEm;
145 float m_ascent; 150 float m_ascent;
146 float m_descent; 151 float m_descent;
147 float m_lineGap; 152 float m_lineGap;
148 float m_lineSpacing; 153 float m_lineSpacing;
149 float m_xHeight; 154 float m_xHeight;
150 float m_zeroWidth; 155 float m_zeroWidth;
151 float m_underlinethickness; 156 float m_underlinethickness;
157 float m_underlinePosition;
152 bool m_hasXHeight; 158 bool m_hasXHeight;
153 bool m_hasZeroWidth; 159 bool m_hasZeroWidth;
154 }; 160 };
155 161
156 inline float scaleEmToUnits(float x, unsigned unitsPerEm) 162 inline float scaleEmToUnits(float x, unsigned unitsPerEm)
157 { 163 {
158 return unitsPerEm ? x / unitsPerEm : x; 164 return unitsPerEm ? x / unitsPerEm : x;
159 } 165 }
160 166
161 } // namespace WebCore 167 } // namespace WebCore
162 168
163 #endif // FontMetrics_h 169 #endif // FontMetrics_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698