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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 for (unsigned i = 0; i < numGlyphs; ++i) { | 939 for (unsigned i = 0; i < numGlyphs; ++i) { |
940 uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToChara
cterIndexes[i]; | 940 uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToChara
cterIndexes[i]; |
941 FloatPoint& currentOffset = offsets[i]; | 941 FloatPoint& currentOffset = offsets[i]; |
942 FloatPoint& nextOffset = (i == numGlyphs - 1) ? firstOffsetOfNextRun : o
ffsets[i + 1]; | 942 FloatPoint& nextOffset = (i == numGlyphs - 1) ? firstOffsetOfNextRun : o
ffsets[i + 1]; |
943 float glyphAdvanceX = advances[i] + nextOffset.x() - currentOffset.x(); | 943 float glyphAdvanceX = advances[i] + nextOffset.x() - currentOffset.x(); |
944 float glyphAdvanceY = nextOffset.y() - currentOffset.y(); | 944 float glyphAdvanceY = nextOffset.y() - currentOffset.y(); |
945 if (m_run.rtl()) { | 945 if (m_run.rtl()) { |
946 if (currentCharacterIndex >= m_toIndex) | 946 if (currentCharacterIndex >= m_toIndex) |
947 m_startOffset.move(glyphAdvanceX, glyphAdvanceY); | 947 m_startOffset.move(glyphAdvanceX, glyphAdvanceY); |
948 else if (currentCharacterIndex >= m_fromIndex) | 948 else if (currentCharacterIndex >= m_fromIndex) |
949 glyphBuffer->add(glyphs[i], currentRun->fontData(), createGlyphB
ufferAdvance(glyphAdvanceX, glyphAdvanceY)); | 949 glyphBuffer->add(glyphs[i], currentRun->fontData(), FloatSize(gl
yphAdvanceX, glyphAdvanceY)); |
950 } else { | 950 } else { |
951 if (currentCharacterIndex < m_fromIndex) | 951 if (currentCharacterIndex < m_fromIndex) |
952 m_startOffset.move(glyphAdvanceX, glyphAdvanceY); | 952 m_startOffset.move(glyphAdvanceX, glyphAdvanceY); |
953 else if (currentCharacterIndex < m_toIndex) | 953 else if (currentCharacterIndex < m_toIndex) |
954 glyphBuffer->add(glyphs[i], currentRun->fontData(), createGlyphB
ufferAdvance(glyphAdvanceX, glyphAdvanceY)); | 954 glyphBuffer->add(glyphs[i], currentRun->fontData(), FloatSize(gl
yphAdvanceX, glyphAdvanceY)); |
955 } | 955 } |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
959 void HarfBuzzShaper::fillGlyphBufferForTextEmphasis(GlyphBuffer* glyphBuffer, Ha
rfBuzzRun* currentRun) | 959 void HarfBuzzShaper::fillGlyphBufferForTextEmphasis(GlyphBuffer* glyphBuffer, Ha
rfBuzzRun* currentRun) |
960 { | 960 { |
961 // FIXME: Instead of generating a synthetic GlyphBuffer here which is then u
sed by the | 961 // FIXME: Instead of generating a synthetic GlyphBuffer here which is then u
sed by the |
962 // drawEmphasisMarks method of FontFastPath, we should roll our own emphasis
mark drawing function. | 962 // drawEmphasisMarks method of FontFastPath, we should roll our own emphasis
mark drawing function. |
963 | 963 |
964 float* advances = currentRun->advances(); | 964 float* advances = currentRun->advances(); |
(...skipping 30 matching lines...) Expand all Loading... |
995 clusterEnd = isRunEnd ? currentRun->startIndex() + currentRun->n
umCharacters() : currentRun->startIndex() + glyphToCharacterIndexes[i + 1]; | 995 clusterEnd = isRunEnd ? currentRun->startIndex() + currentRun->n
umCharacters() : currentRun->startIndex() + glyphToCharacterIndexes[i + 1]; |
996 | 996 |
997 graphemesInCluster = countGraphemesInCluster(m_normalizedBuffer.get(
), m_normalizedBufferLength, clusterStart, clusterEnd); | 997 graphemesInCluster = countGraphemesInCluster(m_normalizedBuffer.get(
), m_normalizedBufferLength, clusterStart, clusterEnd); |
998 if (!graphemesInCluster || !clusterAdvance) | 998 if (!graphemesInCluster || !clusterAdvance) |
999 continue; | 999 continue; |
1000 | 1000 |
1001 float glyphAdvanceX = clusterAdvance / graphemesInCluster; | 1001 float glyphAdvanceX = clusterAdvance / graphemesInCluster; |
1002 for (unsigned j = 0; j < graphemesInCluster; ++j) { | 1002 for (unsigned j = 0; j < graphemesInCluster; ++j) { |
1003 // Do not put emphasis marks on space, separator, and control ch
aracters. | 1003 // Do not put emphasis marks on space, separator, and control ch
aracters. |
1004 Glyph glyphToAdd = Character::canReceiveTextEmphasis(m_run[curre
ntCharacterIndex]) ? 1 : 0; | 1004 Glyph glyphToAdd = Character::canReceiveTextEmphasis(m_run[curre
ntCharacterIndex]) ? 1 : 0; |
1005 glyphBuffer->add(glyphToAdd, currentRun->fontData(), createGlyph
BufferAdvance(glyphAdvanceX, 0)); | 1005 glyphBuffer->add(glyphToAdd, currentRun->fontData(), glyphAdvanc
eX); |
1006 } | 1006 } |
1007 clusterStart = clusterEnd; | 1007 clusterStart = clusterEnd; |
1008 clusterAdvance = 0; | 1008 clusterAdvance = 0; |
1009 } | 1009 } |
1010 } | 1010 } |
1011 } | 1011 } |
1012 | 1012 |
1013 bool HarfBuzzShaper::fillGlyphBuffer(GlyphBuffer* glyphBuffer) | 1013 bool HarfBuzzShaper::fillGlyphBuffer(GlyphBuffer* glyphBuffer) |
1014 { | 1014 { |
1015 unsigned numRuns = m_harfBuzzRuns.size(); | 1015 unsigned numRuns = m_harfBuzzRuns.size(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 point.x() + fromX, point.x() + toX, | 1122 point.x() + fromX, point.x() + toX, |
1123 point.y(), height); | 1123 point.y(), height); |
1124 } | 1124 } |
1125 | 1125 |
1126 return Font::pixelSnappedSelectionRect( | 1126 return Font::pixelSnappedSelectionRect( |
1127 point.x() + toX, point.x() + fromX, | 1127 point.x() + toX, point.x() + fromX, |
1128 point.y(), height); | 1128 point.y(), height); |
1129 } | 1129 } |
1130 | 1130 |
1131 } // namespace WebCore | 1131 } // namespace WebCore |
OLD | NEW |