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

Side by Side Diff: Source/platform/fonts/skia/SimpleFontDataSkia.cpp

Issue 295923006: Fix underline position and thickness calculation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/TestExpectations ('k') | public/blink_skia_config.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 float underlineThickness = SkScalarToFloat(metrics.fUnderlineThickness); 134 SkScalar underlineThickness, underlinePosition;
135 m_fontMetrics.setUnderlineThickness(underlineThickness); 135 if (metrics.hasUnderlineThickness(&underlineThickness)
136 136 && metrics.hasUnderlinePosition(&underlinePosition)) {
137 float underlinePosition = SkScalarToFloat(metrics.fUnderlinePosition); 137 m_fontMetrics.setUnderlineThickness(SkScalarToFloat(underlineThickness)) ;
138 m_fontMetrics.setUnderlineThickness(underlinePosition); 138 m_fontMetrics.setUnderlinePosition(SkScalarToFloat(-underlinePosition));
139 }
139 140
140 if (platformData().orientation() == Vertical && !isTextOrientationFallback() ) { 141 if (platformData().orientation() == Vertical && !isTextOrientationFallback() ) {
141 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a'); 142 static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a');
142 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); 143 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G');
143 size_t vheaSize = face->getTableSize(vheaTag); 144 size_t vheaSize = face->getTableSize(vheaTag);
144 size_t vorgSize = face->getTableSize(vorgTag); 145 size_t vorgSize = face->getTableSize(vorgTag);
145 if ((vheaSize > 0) || (vorgSize > 0)) 146 if ((vheaSize > 0) || (vorgSize > 0))
146 m_hasVerticalGlyphs = true; 147 m_hasVerticalGlyphs = true;
147 } 148 }
148 149
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (glyphs[i]) { 299 if (glyphs[i]) {
299 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); 300 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this);
300 haveGlyphs = true; 301 haveGlyphs = true;
301 } 302 }
302 } 303 }
303 304
304 return haveGlyphs; 305 return haveGlyphs;
305 } 306 }
306 307
307 } // namespace WebCore 308 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | public/blink_skia_config.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698