|
Lines 171-177
void UniscribeController::advance(unsign
Source/WebCore/platform/graphics/win/UniscribeController.cpp_sec1
|
| 171 |
int itemStart = m_run.rtl() ? index + 1 : indexOfFontTransition; |
171 |
int itemStart = m_run.rtl() ? index + 1 : indexOfFontTransition; |
| 172 |
int itemLength = m_run.rtl() ? indexOfFontTransition - index : index - indexOfFontTransition; |
172 |
int itemLength = m_run.rtl() ? indexOfFontTransition - index : index - indexOfFontTransition; |
| 173 |
m_currentCharacter = baseCharacter + itemStart; |
173 |
m_currentCharacter = baseCharacter + itemStart; |
| 174 |
itemizeShapeAndPlace((isSmallCaps ? smallCapsBuffer.data() : cp) + itemStart, itemLength, fontData, glyphBuffer); |
174 |
itemizeShapeAndPlace((isSmallCaps ? smallCapsBuffer.data() : cp) + itemStart, itemStart, itemLength, fontData, glyphBuffer); |
| 175 |
indexOfFontTransition = index; |
175 |
indexOfFontTransition = index; |
| 176 |
} |
176 |
} |
| 177 |
} |
177 |
} |
|
Lines 183-195
void UniscribeController::advance(unsign
Source/WebCore/platform/graphics/win/UniscribeController.cpp_sec2
|
| 183 |
|
183 |
|
| 184 |
int itemStart = m_run.rtl() ? 0 : indexOfFontTransition; |
184 |
int itemStart = m_run.rtl() ? 0 : indexOfFontTransition; |
| 185 |
m_currentCharacter = baseCharacter + itemStart; |
185 |
m_currentCharacter = baseCharacter + itemStart; |
| 186 |
itemizeShapeAndPlace((nextIsSmallCaps ? smallCapsBuffer.data() : cp) + itemStart, itemLength, nextFontData, glyphBuffer); |
186 |
itemizeShapeAndPlace((nextIsSmallCaps ? smallCapsBuffer.data() : cp) + itemStart, itemStart, itemLength, nextFontData, glyphBuffer); |
| 187 |
} |
187 |
} |
| 188 |
|
188 |
|
| 189 |
m_currentCharacter = baseCharacter + length; |
189 |
m_currentCharacter = baseCharacter + length; |
| 190 |
} |
190 |
} |
| 191 |
|
191 |
|
| 192 |
void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned length, const Font* fontData, GlyphBuffer* glyphBuffer) |
192 |
void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned stringOffset, unsigned length, const Font* fontData, GlyphBuffer* glyphBuffer) |
| 193 |
{ |
193 |
{ |
| 194 |
// ScriptItemize (in Windows XP versions prior to SP2) can overflow by 1. This is why there is an extra empty item |
194 |
// ScriptItemize (in Windows XP versions prior to SP2) can overflow by 1. This is why there is an extra empty item |
| 195 |
// hanging out at the end of the array |
195 |
// hanging out at the end of the array |
|
Lines 208-219
void UniscribeController::itemizeShapeAn
Source/WebCore/platform/graphics/win/UniscribeController.cpp_sec3
|
| 208 |
|
208 |
|
| 209 |
if (m_run.rtl()) { |
209 |
if (m_run.rtl()) { |
| 210 |
for (int i = m_items.size() - 2; i >= 0; i--) { |
210 |
for (int i = m_items.size() - 2; i >= 0; i--) { |
| 211 |
if (!shapeAndPlaceItem(cp, i, fontData, glyphBuffer)) |
211 |
if (!shapeAndPlaceItem(cp, stringOffset, i, fontData, glyphBuffer)) |
| 212 |
return; |
212 |
return; |
| 213 |
} |
213 |
} |
| 214 |
} else { |
214 |
} else { |
| 215 |
for (unsigned i = 0; i < m_items.size() - 1; i++) { |
215 |
for (unsigned i = 0; i < m_items.size() - 1; i++) { |
| 216 |
if (!shapeAndPlaceItem(cp, i, fontData, glyphBuffer)) |
216 |
if (!shapeAndPlaceItem(cp, stringOffset, i, fontData, glyphBuffer)) |
| 217 |
return; |
217 |
return; |
| 218 |
} |
218 |
} |
| 219 |
} |
219 |
} |
|
Lines 231-237
void UniscribeController::resetControlAn
Source/WebCore/platform/graphics/win/UniscribeController.cpp_sec4
|
| 231 |
m_state.fOverrideDirection = m_run.directionalOverride(); |
231 |
m_state.fOverrideDirection = m_run.directionalOverride(); |
| 232 |
} |
232 |
} |
| 233 |
|
233 |
|
| 234 |
bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const Font* fontData, GlyphBuffer* glyphBuffer) |
234 |
bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned stringOffset, unsigned i, const Font* fontData, GlyphBuffer* glyphBuffer) |
| 235 |
{ |
235 |
{ |
| 236 |
// Determine the string for this item. |
236 |
// Determine the string for this item. |
| 237 |
const UChar* str = cp + m_items[i].iCharPos; |
237 |
const UChar* str = cp + m_items[i].iCharPos; |
|
Lines 253-258
bool UniscribeController::shapeAndPlaceI
Source/WebCore/platform/graphics/win/UniscribeController.cpp_sec5
|
| 253 |
if (!shape(str, len, item, fontData, glyphs, clusters, visualAttributes)) |
253 |
if (!shape(str, len, item, fontData, glyphs, clusters, visualAttributes)) |
| 254 |
return true; |
254 |
return true; |
| 255 |
|
255 |
|
|
|
256 |
Vector<Optional<unsigned>> stringOffsets(glyphs.size()); |
| 257 |
for (unsigned i = 0; i < len; ++i) { |
| 258 |
if (stringOffsets[clusters[i]]) |
| 259 |
stringOffsets[clusters[i]] = std::min(*stringOffsets[clusters[i]], i); |
| 260 |
else |
| 261 |
stringOffsets[clusters[i]] = i; |
| 262 |
} |
| 263 |
|
| 256 |
// We now have a collection of glyphs. |
264 |
// We now have a collection of glyphs. |
| 257 |
Vector<GOFFSET> offsets; |
265 |
Vector<GOFFSET> offsets; |
| 258 |
Vector<int> advances; |
266 |
Vector<int> advances; |
|
Lines 367-373
bool UniscribeController::shapeAndPlaceI
Source/WebCore/platform/graphics/win/UniscribeController.cpp_sec6
|
| 367 |
else |
375 |
else |
| 368 |
glyphBuffer->expandLastAdvance(origin); |
376 |
glyphBuffer->expandLastAdvance(origin); |
| 369 |
GlyphBufferAdvance glyphAdvance(-origin.width() + advance, -origin.height()); |
377 |
GlyphBufferAdvance glyphAdvance(-origin.width() + advance, -origin.height()); |
| 370 |
glyphBuffer->add(glyph, fontData, glyphAdvance); |
378 |
glyphBuffer->add(glyph, fontData, glyphAdvance, stringOffsets[k].valueOr(0) + stringOffset); |
| 371 |
} |
379 |
} |
| 372 |
|
380 |
|
| 373 |
FloatRect glyphBounds = fontData->boundsForGlyph(glyph); |
381 |
FloatRect glyphBounds = fontData->boundsForGlyph(glyph); |