OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs()
); | 316 hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs()
); |
317 if (m_run.rtl() || m_run.directionalOverride()) | 317 if (m_run.rtl() || m_run.directionalOverride()) |
318 hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION
_RTL : HB_DIRECTION_LTR); | 318 hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION
_RTL : HB_DIRECTION_LTR); |
319 | 319 |
320 for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) { | 320 for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) { |
321 unsigned runIndex = m_run.rtl() ? m_harfbuzzRuns.size() - i - 1 : i; | 321 unsigned runIndex = m_run.rtl() ? m_harfbuzzRuns.size() - i - 1 : i; |
322 HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get(); | 322 HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get(); |
323 const SimpleFontData* currentFontData = currentRun->fontData(); | 323 const SimpleFontData* currentFontData = currentRun->fontData(); |
324 | 324 |
| 325 // Add a space as pre-context to the buffer. This prevents showing dotte
d-circle |
| 326 // for combining marks at the beginning of runs. |
| 327 static const uint16_t preContext = ' '; |
| 328 hb_buffer_add_utf16(harfbuzzBuffer.get(), &preContext, 1, 1, 0); |
| 329 |
325 if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->st
artIndex()])) { | 330 if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->st
artIndex()])) { |
326 String upperText = String(m_normalizedBuffer.get() + currentRun->sta
rtIndex(), currentRun->numCharacters()); | 331 String upperText = String(m_normalizedBuffer.get() + currentRun->sta
rtIndex(), currentRun->numCharacters()); |
327 upperText.makeUpper(); | 332 upperText.makeUpper(); |
328 currentFontData = m_font->glyphDataForCharacter(upperText[0], false,
SmallCapsVariant).fontData; | 333 currentFontData = m_font->glyphDataForCharacter(upperText[0], false,
SmallCapsVariant).fontData; |
329 hb_buffer_add_utf16(harfbuzzBuffer.get(), upperText.characters(), cu
rrentRun->numCharacters(), 0, currentRun->numCharacters()); | 334 hb_buffer_add_utf16(harfbuzzBuffer.get(), upperText.characters(), cu
rrentRun->numCharacters(), 0, currentRun->numCharacters()); |
330 } else | 335 } else |
331 hb_buffer_add_utf16(harfbuzzBuffer.get(), m_normalizedBuffer.get() +
currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharac
ters()); | 336 hb_buffer_add_utf16(harfbuzzBuffer.get(), m_normalizedBuffer.get() +
currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharac
ters()); |
332 | 337 |
333 FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tF
ontData->platformData()); | 338 FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tF
ontData->platformData()); |
334 HarfBuzzNGFace* face = platformData->harfbuzzFace(); | 339 HarfBuzzNGFace* face = platformData->harfbuzzFace(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 if (!foundToX) | 530 if (!foundToX) |
526 toX = m_run.rtl() ? 0 : m_totalWidth; | 531 toX = m_run.rtl() ? 0 : m_totalWidth; |
527 | 532 |
528 // Using floorf() and roundf() as the same as mac port. | 533 // Using floorf() and roundf() as the same as mac port. |
529 if (fromX < toX) | 534 if (fromX < toX) |
530 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from
X), height); | 535 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from
X), height); |
531 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he
ight); | 536 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he
ight); |
532 } | 537 } |
533 | 538 |
534 } // namespace WebCore | 539 } // namespace WebCore |
OLD | NEW |