OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 CharacterRange CachingWordShaper::getCharacterRange(const Font* font, | 109 CharacterRange CachingWordShaper::getCharacterRange(const Font* font, |
110 const TextRun& run, unsigned from, unsigned to) | 110 const TextRun& run, unsigned from, unsigned to) |
111 { | 111 { |
112 ShapeResultBuffer buffer; | 112 ShapeResultBuffer buffer; |
113 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr, | 113 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr, |
114 &buffer); | 114 &buffer); |
115 | 115 |
116 return buffer.getCharacterRange(run.direction(), totalWidth, from, to); | 116 return buffer.getCharacterRange(run.direction(), totalWidth, from, to); |
117 } | 117 } |
118 | 118 |
| 119 Vector<CharacterRange> CachingWordShaper::individualCharacterRanges( |
| 120 const Font* font, const TextRun& run, unsigned from, unsigned to) |
| 121 { |
| 122 ShapeResultBuffer buffer; |
| 123 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr, |
| 124 &buffer); |
| 125 |
| 126 Vector<CharacterRange> allExtents; |
| 127 for (unsigned position = from; position <= to; position++) { |
| 128 allExtents.append(buffer.getCharacterRange(run.direction(), totalWidth, |
| 129 position, position + 1)); |
| 130 } |
| 131 |
| 132 return allExtents; |
| 133 } |
| 134 |
119 }; // namespace blink | 135 }; // namespace blink |
OLD | NEW |