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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } else { | 126 } else { |
127 xHeight = ascent * 0.56; // Best guess from Windows font metrics. | 127 xHeight = ascent * 0.56; // Best guess from Windows font metrics. |
128 m_fontMetrics.setXHeight(xHeight); | 128 m_fontMetrics.setXHeight(xHeight); |
129 m_fontMetrics.setHasXHeight(false); | 129 m_fontMetrics.setHasXHeight(false); |
130 } | 130 } |
131 | 131 |
132 float lineGap = SkScalarToFloat(metrics.fLeading); | 132 float lineGap = SkScalarToFloat(metrics.fLeading); |
133 m_fontMetrics.setLineGap(lineGap); | 133 m_fontMetrics.setLineGap(lineGap); |
134 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(li
neGap)); | 134 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(li
neGap)); |
135 | 135 |
| 136 // For now Skia does not support underline Thickness, once patch is comitted
we can uncomment following |
| 137 // code, till then setting Underline Thickness to Zero so that default calcu
lation is done. |
| 138 // float underlineThickness = SkScalarToFloat(metrics.fUnderlineThickness); |
| 139 // m_fontMetrics.setUnderlineThickness(underlineThickness); |
| 140 m_fontMetrics.setUnderlineThickness(0.f); |
| 141 |
136 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { | 142 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { |
137 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); | 143 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); |
138 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); | 144 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); |
139 size_t vheaSize = face->getTableSize(vheaTag); | 145 size_t vheaSize = face->getTableSize(vheaTag); |
140 size_t vorgSize = face->getTableSize(vorgTag); | 146 size_t vorgSize = face->getTableSize(vorgTag); |
141 if ((vheaSize > 0) || (vorgSize > 0)) | 147 if ((vheaSize > 0) || (vorgSize > 0)) |
142 m_hasVerticalGlyphs = true; | 148 m_hasVerticalGlyphs = true; |
143 } | 149 } |
144 | 150 |
145 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is | 151 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 302 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); |
297 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { | 303 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { |
298 addResult.iterator->value = true; | 304 addResult.iterator->value = true; |
299 return true; | 305 return true; |
300 } | 306 } |
301 return false; | 307 return false; |
302 } | 308 } |
303 #endif | 309 #endif |
304 | 310 |
305 } // namespace WebCore | 311 } // namespace WebCore |
OLD | NEW |