Changeset 68148 in webkit
- Timestamp:
- Sep 23, 2010, 9:18:01 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r68147 r68148 1 2010-09-23 Brad Moore <bradm@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Address a remaining discrepancy in piecewise text measurement 6 https://bugs.webkit.org/show_bug.cgi?id=45796 7 8 Don't include always-integral space widths in the floating point accumulator designed 9 to minimize precision loss. This brings whole-string measurement in line with piecewise 10 text measurement when dealing with fonts with fractional advances. 11 12 * platform/graphics/WidthIterator.cpp: 13 (WebCore::WidthIterator::advance): Change the associativity of width addition to minimize precision loss. 14 1 15 2010-09-23 Patrick Gansterer <paroga@webkit.org> 2 16 -
trunk/WebCore/platform/graphics/WidthIterator.cpp
r63570 r68148 213 213 // Force characters that are used to determine word boundaries for the rounding hack 214 214 // to be integer width, so following words will start on an integer boundary. 215 if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c)) 215 if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c)) { 216 216 width = ceilf(width); 217 217 218 // Check to see if the next character is a "rounding hack character", if so, adjust 219 // width so that the total run width will be on an integer boundary. 220 if ((m_run.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp)) 221 || (m_run.applyRunRounding() && currentCharacter >= m_end)) { 222 float totalWidth = widthSinceLastRounding + width; 223 widthSinceLastRounding = ceilf(totalWidth); 224 width += widthSinceLastRounding - totalWidth; 225 m_runWidthSoFar += widthSinceLastRounding; 226 widthSinceLastRounding = 0; 227 } else 228 widthSinceLastRounding += width; 218 // Since widthSinceLastRounding can lose precision if we include measurements for 219 // preceding whitespace, we bypass it here. 220 m_runWidthSoFar += width; 221 222 // Since this is a rounding hack character, we should have reset this sum on the previous 223 // iteration. 224 ASSERT(!widthSinceLastRounding); 225 } else { 226 // Check to see if the next character is a "rounding hack character", if so, adjust 227 // width so that the total run width will be on an integer boundary. 228 if ((m_run.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp)) 229 || (m_run.applyRunRounding() && currentCharacter >= m_end)) { 230 float totalWidth = widthSinceLastRounding + width; 231 widthSinceLastRounding = ceilf(totalWidth); 232 width += widthSinceLastRounding - totalWidth; 233 m_runWidthSoFar += widthSinceLastRounding; 234 widthSinceLastRounding = 0; 235 } else 236 widthSinceLastRounding += width; 237 } 229 238 230 239 if (glyphBuffer)
Note:
See TracChangeset
for help on using the changeset viewer.