equal
deleted
inserted
replaced
393 int offset = ((round == false) || ((x - currX) < (nextX - x))) ? |
393 int offset = ((round == false) || ((x - currX) < (nextX - x))) ? |
394 (i - txtOffset) : (i + 1 - txtOffset); |
394 (i - txtOffset) : (i + 1 - txtOffset); |
395 // the length of the string measured as a whole may differ from |
395 // the length of the string measured as a whole may differ from |
396 // the sum of individual character lengths, for example if |
396 // the sum of individual character lengths, for example if |
397 // fractional metrics are enabled; and we must guard from this. |
397 // fractional metrics are enabled; and we must guard from this. |
398 while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) { |
398 while (offset > 0 && metrics.charsWidth(txt, txtOffset, offset) > (x - x0)) { |
399 offset--; |
399 offset--; |
400 } |
400 } |
401 return (offset < 0 ? 0 : offset); |
401 return offset; |
402 } |
402 } |
403 currX = nextX; |
403 currX = nextX; |
404 } |
404 } |
405 |
405 |
406 // didn't find, return end offset |
406 // didn't find, return end offset |