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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 UErrorCode errorCode = U_ZERO_ERROR; | 610 UErrorCode errorCode = U_ZERO_ERROR; |
611 UScriptCode nextScript = uscript_getScript(character, &errorCode); | 611 UScriptCode nextScript = uscript_getScript(character, &errorCode); |
612 if (U_FAILURE(errorCode)) | 612 if (U_FAILURE(errorCode)) |
613 return false; | 613 return false; |
614 | 614 |
615 do { | 615 do { |
616 const UChar* currentCharacterPosition = iterator.characters(); | 616 const UChar* currentCharacterPosition = iterator.characters(); |
617 const SimpleFontData* currentFontData = nextFontData; | 617 const SimpleFontData* currentFontData = nextFontData; |
618 UScriptCode currentScript = nextScript; | 618 UScriptCode currentScript = nextScript; |
619 | 619 |
| 620 UChar32 lastCharacter = character; |
620 for (iterator.advance(clusterLength); iterator.consume(character, cluste
rLength); iterator.advance(clusterLength)) { | 621 for (iterator.advance(clusterLength); iterator.consume(character, cluste
rLength); iterator.advance(clusterLength)) { |
621 if (Character::treatAsZeroWidthSpace(character)) | 622 if (Character::treatAsZeroWidthSpace(character)) |
622 continue; | 623 continue; |
623 | 624 |
624 int length = handleMultipleUChar(character, clusterLength, currentFo
ntData, currentCharacterPosition, iterator.characters() + clusterLength, normali
zedBufferEnd); | 625 int length = handleMultipleUChar(character, clusterLength, currentFo
ntData, currentCharacterPosition, iterator.characters() + clusterLength, normali
zedBufferEnd); |
625 if (length) { | 626 if (length) { |
626 clusterLength = length; | 627 clusterLength = length; |
627 continue; | 628 continue; |
628 } | 629 } |
629 | 630 |
630 nextFontData = font->glyphDataForCharacter(character, false).fontDat
a; | 631 nextFontData = font->glyphDataForCharacter(character, false).fontDat
a; |
631 nextScript = uscript_getScript(character, &errorCode); | 632 nextScript = uscript_getScript(character, &errorCode); |
632 if (U_FAILURE(errorCode)) | 633 if (U_FAILURE(errorCode)) |
633 return false; | 634 return false; |
| 635 if (lastCharacter == zeroWidthJoiner) |
| 636 currentFontData = nextFontData; |
634 if ((nextFontData != currentFontData) || ((currentScript != nextScri
pt) && (nextScript != USCRIPT_INHERITED) && (!uscript_hasScript(character, curre
ntScript)))) | 637 if ((nextFontData != currentFontData) || ((currentScript != nextScri
pt) && (nextScript != USCRIPT_INHERITED) && (!uscript_hasScript(character, curre
ntScript)))) |
635 break; | 638 break; |
636 currentCharacterPosition = iterator.characters(); | 639 currentCharacterPosition = iterator.characters(); |
| 640 lastCharacter = character; |
637 } | 641 } |
638 | 642 |
639 CandidateRun run = { character, startIndexOfCurrentRun, iterator.current
Character(), currentFontData, currentScript }; | 643 CandidateRun run = { character, startIndexOfCurrentRun, iterator.current
Character(), currentFontData, currentScript }; |
640 runs->append(run); | 644 runs->append(run); |
641 | 645 |
642 currentFontData = nextFontData; | 646 currentFontData = nextFontData; |
643 startIndexOfCurrentRun = iterator.currentCharacter(); | 647 startIndexOfCurrentRun = iterator.currentCharacter(); |
644 } while (iterator.consume(character, clusterLength)); | 648 } while (iterator.consume(character, clusterLength)); |
645 | 649 |
646 return true; | 650 return true; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 if (!foundToX) | 1033 if (!foundToX) |
1030 toX = m_run.rtl() ? 0 : m_totalWidth; | 1034 toX = m_run.rtl() ? 0 : m_totalWidth; |
1031 | 1035 |
1032 // Using floorf() and roundf() as the same as mac port. | 1036 // Using floorf() and roundf() as the same as mac port. |
1033 if (fromX < toX) | 1037 if (fromX < toX) |
1034 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from
X), height); | 1038 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from
X), height); |
1035 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he
ight); | 1039 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he
ight); |
1036 } | 1040 } |
1037 | 1041 |
1038 } // namespace WebCore | 1042 } // namespace WebCore |
OLD | NEW |