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 |
134 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { | 141 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { |
135 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); | 142 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); |
136 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); | 143 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); |
137 size_t vheaSize = face->getTableSize(vheaTag); | 144 size_t vheaSize = face->getTableSize(vheaTag); |
138 size_t vorgSize = face->getTableSize(vorgTag); | 145 size_t vorgSize = face->getTableSize(vorgTag); |
139 if ((vheaSize > 0) || (vorgSize > 0)) | 146 if ((vheaSize > 0) || (vorgSize > 0)) |
140 m_hasVerticalGlyphs = true; | 147 m_hasVerticalGlyphs = true; |
141 } | 148 } |
142 | 149 |
143 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is | 150 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (glyphs[i]) { | 303 if (glyphs[i]) { |
297 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 304 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
298 haveGlyphs = true; | 305 haveGlyphs = true; |
299 } | 306 } |
300 } | 307 } |
301 | 308 |
302 return haveGlyphs; | 309 return haveGlyphs; |
303 } | 310 } |
304 | 311 |
305 } // namespace blink | 312 } // namespace blink |
OLD | NEW |