| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov | 3 * Copyright (C) 2006 Alexey Proskuryakov |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 { | 454 { |
| 455 if (!m_combiningCharacterSequenceSupport) | 455 if (!m_combiningCharacterSequenceSupport) |
| 456 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool>
); | 456 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool>
); |
| 457 | 457 |
| 458 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen
ceSupport->add(String(characters, length), false); | 458 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen
ceSupport->add(String(characters, length), false); |
| 459 if (!addResult.isNewEntry) | 459 if (!addResult.isNewEntry) |
| 460 return addResult.storedValue->value; | 460 return addResult.storedValue->value; |
| 461 | 461 |
| 462 UErrorCode error = U_ZERO_ERROR; | 462 UErrorCode error = U_ZERO_ERROR; |
| 463 Vector<UChar, 4> normalizedCharacters(length); | 463 Vector<UChar, 4> normalizedCharacters(length); |
| 464 int32_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UN
ORM_UNICODE_3_2, &normalizedCharacters[0], length, &error); | 464 size_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UNO
RM_UNICODE_3_2, &normalizedCharacters[0], length, &error); |
| 465 // Can't render if we have an error or no composition occurred. | 465 // Can't render if we have an error or no composition occurred. |
| 466 if (U_FAILURE(error) || (static_cast<size_t>(normalizedLength) == length)) | 466 if (U_FAILURE(error) || normalizedLength == length) |
| 467 return false; | 467 return false; |
| 468 | 468 |
| 469 SkPaint paint; | 469 for (size_t offset = 0; offset < normalizedLength;) { |
| 470 m_platformData.setupPaint(&paint); | 470 UChar32 character; |
| 471 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 471 U16_NEXT(normalizedCharacters, offset, normalizedLength, character); |
| 472 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { | 472 if (!glyphForCharacter(character)) |
| 473 addResult.storedValue->value = true; | 473 return false; |
| 474 return true; | |
| 475 } | 474 } |
| 476 return false; | 475 |
| 476 addResult.storedValue->value = true; |
| 477 return true; |
| 477 } | 478 } |
| 478 | 479 |
| 479 bool SimpleFontData::fillGlyphPage(GlyphPage* pageToFill, unsigned offset, unsig
ned length, UChar* buffer, unsigned bufferLength) const | 480 bool SimpleFontData::fillGlyphPage(GlyphPage* pageToFill, unsigned offset, unsig
ned length, UChar* buffer, unsigned bufferLength) const |
| 480 { | 481 { |
| 481 if (SkUTF16_IsHighSurrogate(buffer[bufferLength-1])) { | 482 if (SkUTF16_IsHighSurrogate(buffer[bufferLength-1])) { |
| 482 SkDebugf("%s last char is high-surrogate", __FUNCTION__); | 483 SkDebugf("%s last char is high-surrogate", __FUNCTION__); |
| 483 return false; | 484 return false; |
| 484 } | 485 } |
| 485 | 486 |
| 486 SkTypeface* typeface = platformData().typeface(); | 487 SkTypeface* typeface = platformData().typeface(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 498 if (glyphs[i]) { | 499 if (glyphs[i]) { |
| 499 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 500 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
| 500 haveGlyphs = true; | 501 haveGlyphs = true; |
| 501 } | 502 } |
| 502 } | 503 } |
| 503 | 504 |
| 504 return haveGlyphs; | 505 return haveGlyphs; |
| 505 } | 506 } |
| 506 | 507 |
| 507 } // namespace blink | 508 } // namespace blink |
| OLD | NEW |