OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2010, 2011 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 412 |
413 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
, size_t length) const | 413 bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
, size_t length) const |
414 { | 414 { |
415 ASSERT(isMainThread()); | 415 ASSERT(isMainThread()); |
416 | 416 |
417 if (!m_combiningCharacterSequenceSupport) | 417 if (!m_combiningCharacterSequenceSupport) |
418 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool>
); | 418 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool>
); |
419 | 419 |
420 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen
ceSupport->add(String(characters, length), false); | 420 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen
ceSupport->add(String(characters, length), false); |
421 if (!addResult.isNewEntry) | 421 if (!addResult.isNewEntry) |
422 return addResult.iterator->value; | 422 return addResult.storedValue->value; |
423 | 423 |
424 RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(platformData().c
tFont(), 0)); | 424 RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(platformData().c
tFont(), 0)); |
425 | 425 |
426 ProviderInfo info = { characters, length, getCFStringAttributes(0, platformD
ata().orientation()) }; | 426 ProviderInfo info = { characters, length, getCFStringAttributes(0, platformD
ata().orientation()) }; |
427 RetainPtr<CTLineRef> line(AdoptCF, CTLineCreateWithUniCharProvider(&provideS
tringAndAttributes, 0, &info)); | 427 RetainPtr<CTLineRef> line(AdoptCF, CTLineCreateWithUniCharProvider(&provideS
tringAndAttributes, 0, &info)); |
428 | 428 |
429 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); | 429 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); |
430 CFIndex runCount = CFArrayGetCount(runArray); | 430 CFIndex runCount = CFArrayGetCount(runArray); |
431 | 431 |
432 for (CFIndex r = 0; r < runCount; r++) { | 432 for (CFIndex r = 0; r < runCount; r++) { |
433 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray,
r)); | 433 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray,
r)); |
434 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID()); | 434 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID()); |
435 CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun); | 435 CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun); |
436 CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttri
butes, kCTFontAttributeName)); | 436 CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttri
butes, kCTFontAttributeName)); |
437 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont,
0)); | 437 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont,
0)); |
438 if (!CFEqual(runCGFont.get(), cgFont.get())) | 438 if (!CFEqual(runCGFont.get(), cgFont.get())) |
439 return false; | 439 return false; |
440 } | 440 } |
441 | 441 |
442 addResult.iterator->value = true; | 442 addResult.storedValue->value = true; |
443 return true; | 443 return true; |
444 } | 444 } |
445 | 445 |
446 } // namespace WebCore | 446 } // namespace WebCore |
OLD | NEW |