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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 if (m_run.rtl()) | 1010 if (m_run.rtl()) |
1011 clusterStart = currentRun->startIndex() + currentRun->numCharacters(); | 1011 clusterStart = currentRun->startIndex() + currentRun->numCharacters(); |
1012 else | 1012 else |
1013 clusterStart = currentRun->startIndex() + glyphToCharacterIndexes[0]; | 1013 clusterStart = currentRun->startIndex() + glyphToCharacterIndexes[0]; |
1014 | 1014 |
1015 float advanceSoFar = initialAdvance; | 1015 float advanceSoFar = initialAdvance; |
1016 for (unsigned i = 0; i < numGlyphs; ++i) { | 1016 for (unsigned i = 0; i < numGlyphs; ++i) { |
1017 uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToChara
cterIndexes[i]; | 1017 uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToChara
cterIndexes[i]; |
1018 bool isRunEnd = (i + 1 == numGlyphs); | 1018 bool isRunEnd = (i + 1 == numGlyphs); |
1019 bool isClusterEnd = isRunEnd || (currentRun->startIndex() + glyphToChar
acterIndexes[i + 1] != currentCharacterIndex); | 1019 bool isClusterEnd = isRunEnd || (currentRun->startIndex() + glyphToChar
acterIndexes[i + 1] != currentCharacterIndex); |
| 1020 |
| 1021 if ((m_run.rtl() && currentCharacterIndex >= m_toIndex) || (!m_run.rtl()
&& currentCharacterIndex < m_fromIndex)) { |
| 1022 advanceSoFar += advances[i]; |
| 1023 m_run.rtl() ? --clusterStart : ++clusterStart; |
| 1024 continue; |
| 1025 } |
| 1026 |
1020 clusterAdvance += advances[i]; | 1027 clusterAdvance += advances[i]; |
1021 | 1028 |
1022 if (isClusterEnd) { | 1029 if (isClusterEnd) { |
1023 uint16_t clusterEnd; | 1030 uint16_t clusterEnd; |
1024 if (m_run.rtl()) | 1031 if (m_run.rtl()) |
1025 clusterEnd = currentCharacterIndex; | 1032 clusterEnd = currentCharacterIndex; |
1026 else | 1033 else |
1027 clusterEnd = isRunEnd ? currentRun->startIndex() + currentRun->n
umCharacters() : currentRun->startIndex() + glyphToCharacterIndexes[i + 1]; | 1034 clusterEnd = isRunEnd ? currentRun->startIndex() + currentRun->n
umCharacters() : currentRun->startIndex() + glyphToCharacterIndexes[i + 1]; |
1028 | 1035 |
1029 graphemesInCluster = countGraphemesInCluster(m_normalizedBuffer.get(
), m_normalizedBufferLength, clusterStart, clusterEnd); | 1036 graphemesInCluster = countGraphemesInCluster(m_normalizedBuffer.get(
), m_normalizedBufferLength, clusterStart, clusterEnd); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 fromX = 0; | 1145 fromX = 0; |
1139 if (!foundToX) | 1146 if (!foundToX) |
1140 toX = m_run.rtl() ? 0 : m_totalWidth; | 1147 toX = m_run.rtl() ? 0 : m_totalWidth; |
1141 | 1148 |
1142 if (fromX < toX) | 1149 if (fromX < toX) |
1143 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); | 1150 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); |
1144 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); | 1151 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); |
1145 } | 1152 } |
1146 | 1153 |
1147 } // namespace blink | 1154 } // namespace blink |
OLD | NEW |