OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } else { | 124 } else { |
125 xHeight = ascent * 0.56; // Best guess from Windows font metrics. | 125 xHeight = ascent * 0.56; // Best guess from Windows font metrics. |
126 m_fontMetrics.setXHeight(xHeight); | 126 m_fontMetrics.setXHeight(xHeight); |
127 m_fontMetrics.setHasXHeight(false); | 127 m_fontMetrics.setHasXHeight(false); |
128 } | 128 } |
129 | 129 |
130 float lineGap = SkScalarToFloat(metrics.fLeading); | 130 float lineGap = SkScalarToFloat(metrics.fLeading); |
131 m_fontMetrics.setLineGap(lineGap); | 131 m_fontMetrics.setLineGap(lineGap); |
132 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(li
neGap)); | 132 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(li
neGap)); |
133 | 133 |
134 SkScalar underlineThickness, underlinePosition; | |
135 if (metrics.hasUnderlineThickness(&underlineThickness) | |
136 && metrics.hasUnderlinePosition(&underlinePosition)) { | |
137 m_fontMetrics.setUnderlineThickness(SkScalarToFloat(underlineThickness))
; | |
138 m_fontMetrics.setUnderlinePosition(SkScalarToFloat(-underlinePosition)); | |
139 } | |
140 | |
141 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { | 134 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { |
142 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); | 135 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); |
143 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); | 136 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); |
144 size_t vheaSize = face->getTableSize(vheaTag); | 137 size_t vheaSize = face->getTableSize(vheaTag); |
145 size_t vorgSize = face->getTableSize(vorgTag); | 138 size_t vorgSize = face->getTableSize(vorgTag); |
146 if ((vheaSize > 0) || (vorgSize > 0)) | 139 if ((vheaSize > 0) || (vorgSize > 0)) |
147 m_hasVerticalGlyphs = true; | 140 m_hasVerticalGlyphs = true; |
148 } | 141 } |
149 | 142 |
150 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is | 143 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (glyphs[i]) { | 296 if (glyphs[i]) { |
304 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 297 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
305 haveGlyphs = true; | 298 haveGlyphs = true; |
306 } | 299 } |
307 } | 300 } |
308 | 301 |
309 return haveGlyphs; | 302 return haveGlyphs; |
310 } | 303 } |
311 | 304 |
312 } // namespace blink | 305 } // namespace blink |
OLD | NEW |