OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 #if USE(HARFBUZZ) | 257 #if USE(HARFBUZZ) |
258 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
, size_t length) const | 258 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
, size_t length) const |
259 { | 259 { |
260 if (!m_combiningCharacterSequenceSupport) | 260 if (!m_combiningCharacterSequenceSupport) |
261 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool>
); | 261 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool>
); |
262 | 262 |
263 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen
ceSupport->add(String(characters, length), false); | 263 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen
ceSupport->add(String(characters, length), false); |
264 if (!addResult.isNewEntry) | 264 if (!addResult.isNewEntry) |
265 return addResult.iterator->value; | 265 return addResult.storedValue->value; |
266 | 266 |
267 UErrorCode error = U_ZERO_ERROR; | 267 UErrorCode error = U_ZERO_ERROR; |
268 Vector<UChar, 4> normalizedCharacters(length); | 268 Vector<UChar, 4> normalizedCharacters(length); |
269 int32_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UN
ORM_UNICODE_3_2, &normalizedCharacters[0], length, &error); | 269 int32_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UN
ORM_UNICODE_3_2, &normalizedCharacters[0], length, &error); |
270 // Can't render if we have an error or no composition occurred. | 270 // Can't render if we have an error or no composition occurred. |
271 if (U_FAILURE(error) || (static_cast<size_t>(normalizedLength) == length)) | 271 if (U_FAILURE(error) || (static_cast<size_t>(normalizedLength) == length)) |
272 return false; | 272 return false; |
273 | 273 |
274 SkPaint paint; | 274 SkPaint paint; |
275 m_platformData.setupPaint(&paint); | 275 m_platformData.setupPaint(&paint); |
276 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 276 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); |
277 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { | 277 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { |
278 addResult.iterator->value = true; | 278 addResult.storedValue->value = true; |
279 return true; | 279 return true; |
280 } | 280 } |
281 return false; | 281 return false; |
282 } | 282 } |
283 #endif | 283 #endif |
284 | 284 |
285 } // namespace WebCore | 285 } // namespace WebCore |
OLD | NEW |