| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "ComplexTextController.h" | 27 #include "ComplexTextController.h" |
| 28 | 28 |
| 29 #include "Font.h" | 29 #include "Font.h" |
| 30 #include "FontCache.h" | 30 #include "FontCache.h" |
| 31 #include "TextRun.h" | 31 #include "TextRun.h" |
| 32 #include "WebCoreSystemInterface.h" | 32 #include "WebCoreSystemInterface.h" |
| 33 | 33 |
| 34 #include <ApplicationServices/ApplicationServices.h> | 34 #include <ApplicationServices/ApplicationServices.h> |
| 35 | 35 |
| 36 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 | |
| 37 // The following symbols are SPI in 10.5. | |
| 38 extern "C" { | |
| 39 void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); | |
| 40 const CGSize* CTRunGetAdvancesPtr(CTRunRef run); | |
| 41 extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel; | |
| 42 } | |
| 43 #endif | |
| 44 | |
| 45 @interface WebCascadeList : NSArray { | 36 @interface WebCascadeList : NSArray { |
| 46 @private | 37 @private |
| 47 const WebCore::Font* _font; | 38 const WebCore::Font* _font; |
| 48 UChar32 _character; | 39 UChar32 _character; |
| 49 NSUInteger _count; | 40 NSUInteger _count; |
| 50 Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors; | 41 Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors; |
| 51 } | 42 } |
| 52 | 43 |
| 53 - (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character; | 44 - (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character; |
| 54 | 45 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 210 |
| 220 if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) { | 211 if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) { |
| 221 static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLe
vel }; | 212 static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLe
vel }; |
| 222 const short ltrForcedEmbeddingLevelValue = 0; | 213 const short ltrForcedEmbeddingLevelValue = 0; |
| 223 const short rtlForcedEmbeddingLevelValue = 1; | 214 const short rtlForcedEmbeddingLevelValue = 1; |
| 224 static const void* ltrOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, <rForcedEmbeddingLevelValue) }; | 215 static const void* ltrOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, <rForcedEmbeddingLevelValue) }; |
| 225 static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) }; | 216 static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) }; |
| 226 static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllo
catorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCop
yStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); | 217 static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllo
catorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCop
yStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); |
| 227 static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllo
catorDefault, optionKeys, rtlOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCop
yStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); | 218 static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllo
catorDefault, optionKeys, rtlOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCop
yStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); |
| 228 | 219 |
| 229 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 | 220 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 |
| 230 ProviderInfo info = { cp, length, stringAttributes.get() }; | 221 ProviderInfo info = { cp, length, stringAttributes.get() }; |
| 231 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithU
niCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? lt
rTypesetterOptions : rtlTypesetterOptions)); | 222 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithU
niCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? lt
rTypesetterOptions : rtlTypesetterOptions)); |
| 232 #else | 223 #else |
| 233 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCop
y(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); | 224 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCop
y(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); |
| 234 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedS
tringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get())); | 225 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedS
tringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get())); |
| 235 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAtt
ributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptio
ns : rtlTypesetterOptions)); | 226 RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAtt
ributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptio
ns : rtlTypesetterOptions)); |
| 236 #endif | 227 #endif |
| 237 | 228 |
| 238 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))
); | 229 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))
); |
| 239 } else { | 230 } else { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 282 } |
| 292 } | 283 } |
| 293 if (m_fallbackFonts && runFontData != m_font.primaryFont()) | 284 if (m_fallbackFonts && runFontData != m_font.primaryFont()) |
| 294 m_fallbackFonts->add(fontData); | 285 m_fallbackFonts->add(fontData); |
| 295 | 286 |
| 296 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp,
stringLocation, length, runRange)); | 287 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp,
stringLocation, length, runRange)); |
| 297 } | 288 } |
| 298 } | 289 } |
| 299 | 290 |
| 300 } // namespace WebCore | 291 } // namespace WebCore |
| OLD | NEW |