size_t lastHyphenLocation(const StringView& text, size_t beforeIndex) const override { CFIndex result = CFStringGetHyphenationLocationBeforeIndex( text.toString().impl()->createCFString().get(), beforeIndex, CFRangeMake(0, text.length()), 0, m_localeCF.get(), 0); return result == kCFNotFound ? 0 : result; }
size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier) { RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull)); DEFINE_STATIC_LOCAL(AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >, cfLocaleCache, ()); RetainPtr<CFLocaleRef> locale = cfLocaleCache.get(localeIdentifier); CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0); return result == kCFNotFound ? 0 : result; }