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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } else { | 122 } else { |
123 xHeight = ascent * 0.56; // Best guess from Windows font metrics. | 123 xHeight = ascent * 0.56; // Best guess from Windows font metrics. |
124 m_fontMetrics.setXHeight(xHeight); | 124 m_fontMetrics.setXHeight(xHeight); |
125 m_fontMetrics.setHasXHeight(false); | 125 m_fontMetrics.setHasXHeight(false); |
126 } | 126 } |
127 | 127 |
128 float lineGap = SkScalarToFloat(metrics.fLeading); | 128 float lineGap = SkScalarToFloat(metrics.fLeading); |
129 m_fontMetrics.setLineGap(lineGap); | 129 m_fontMetrics.setLineGap(lineGap); |
130 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(li
neGap)); | 130 m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(li
neGap)); |
131 | 131 |
132 // For now Skia does not support underline Thickness, once patch is comitted
we can uncomment following | 132 float underlineThickness = SkScalarToFloat(metrics.fUnderlineThickness); |
133 // code, till then setting Underline Thickness to Zero so that default calcu
lation is done. | 133 m_fontMetrics.setUnderlineThickness(underlineThickness); |
134 // float underlineThickness = SkScalarToFloat(metrics.fUnderlineThickness); | 134 |
135 // m_fontMetrics.setUnderlineThickness(underlineThickness); | 135 float underlinePosition = SkScalarToFloat(metrics.fUnderlinePosition); |
136 m_fontMetrics.setUnderlineThickness(0.f); | 136 m_fontMetrics.setUnderlineThickness(underlinePosition); |
137 | 137 |
138 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { | 138 if (platformData().orientation() == Vertical && !isTextOrientationFallback()
) { |
139 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); | 139 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); |
140 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); | 140 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); |
141 size_t vheaSize = face->getTableSize(vheaTag); | 141 size_t vheaSize = face->getTableSize(vheaTag); |
142 size_t vorgSize = face->getTableSize(vorgTag); | 142 size_t vorgSize = face->getTableSize(vorgTag); |
143 if ((vheaSize > 0) || (vorgSize > 0)) | 143 if ((vheaSize > 0) || (vorgSize > 0)) |
144 m_hasVerticalGlyphs = true; | 144 m_hasVerticalGlyphs = true; |
145 } | 145 } |
146 | 146 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 272 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); |
273 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { | 273 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { |
274 addResult.storedValue->value = true; | 274 addResult.storedValue->value = true; |
275 return true; | 275 return true; |
276 } | 276 } |
277 return false; | 277 return false; |
278 } | 278 } |
279 #endif | 279 #endif |
280 | 280 |
281 } // namespace WebCore | 281 } // namespace WebCore |
OLD | NEW |