OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 currentX = nextX; | 310 currentX = nextX; |
311 ++glyphIndex; | 311 ++glyphIndex; |
312 } | 312 } |
313 | 313 |
314 return rtl() ? 0 : m_numCharacters; | 314 return rtl() ? 0 : m_numCharacters; |
315 } | 315 } |
316 | 316 |
317 float HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset) | 317 float HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset) |
318 { | 318 { |
319 ASSERT(offset < m_numCharacters); | 319 ASSERT(offset < m_numCharacters); |
| 320 ASSERT(hasGlyphToCharacterIndexes()); |
320 unsigned glyphIndex = 0; | 321 unsigned glyphIndex = 0; |
321 float position = 0; | 322 float position = 0; |
322 if (rtl()) { | 323 if (rtl()) { |
323 while (glyphIndex < m_numGlyphs && m_glyphToCharacterIndexes[glyphIndex]
> offset) { | 324 while (glyphIndex < m_numGlyphs && m_glyphToCharacterIndexes[glyphIndex]
> offset) { |
324 position += m_advances[glyphIndex]; | 325 position += m_advances[glyphIndex]; |
325 ++glyphIndex; | 326 ++glyphIndex; |
326 } | 327 } |
327 // For RTL, we need to return the right side boundary of the character. | 328 // For RTL, we need to return the right side boundary of the character. |
328 // Add advance of glyphs which are part of the character. | 329 // Add advance of glyphs which are part of the character. |
329 while (glyphIndex < m_numGlyphs - 1 && m_glyphToCharacterIndexes[glyphIn
dex] == m_glyphToCharacterIndexes[glyphIndex + 1]) { | 330 while (glyphIndex < m_numGlyphs - 1 && m_glyphToCharacterIndexes[glyphIn
dex] == m_glyphToCharacterIndexes[glyphIndex + 1]) { |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 fromX = 0; | 1146 fromX = 0; |
1146 if (!foundToX) | 1147 if (!foundToX) |
1147 toX = m_run.rtl() ? 0 : m_totalWidth; | 1148 toX = m_run.rtl() ? 0 : m_totalWidth; |
1148 | 1149 |
1149 if (fromX < toX) | 1150 if (fromX < toX) |
1150 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); | 1151 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); |
1151 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); | 1152 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); |
1152 } | 1153 } |
1153 | 1154 |
1154 } // namespace blink | 1155 } // namespace blink |
OLD | NEW |