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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLe
vel }; | 212 static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLe
vel }; |
213 const short ltrForcedEmbeddingLevelValue = 0; | 213 const short ltrForcedEmbeddingLevelValue = 0; |
214 const short rtlForcedEmbeddingLevelValue = 1; | 214 const short rtlForcedEmbeddingLevelValue = 1; |
215 static const void* ltrOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, <rForcedEmbeddingLevelValue) }; | 215 static const void* ltrOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, <rForcedEmbeddingLevelValue) }; |
216 static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) }; | 216 static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefa
ult, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) }; |
217 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); |
218 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); |
219 | 219 |
220 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 | 220 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 |
221 ProviderInfo info = { cp, length, stringAttributes.get() }; | 221 ProviderInfo info = { cp, length, stringAttributes.get() }; |
222 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)); |
223 #else | 223 #else |
224 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCop
y(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); | 224 RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCop
y(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); |
225 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedS
tringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get())); | 225 RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedS
tringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get())); |
226 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)); |
227 #endif | 227 #endif |
228 | 228 |
229 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))
); | 229 line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))
); |
230 } else { | 230 } else { |
231 ProviderInfo info = { cp, length, stringAttributes.get() }; | 231 ProviderInfo info = { cp, length, stringAttributes.get() }; |
232 | 232 |
233 line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttribut
es, 0, &info)); | 233 line.adoptCF(WKCreateCTLineWithUniCharProvider(&provideStringAndAttribut
es, 0, &info)); |
234 } | 234 } |
235 | 235 |
236 m_coreTextLines.append(line.get()); | 236 m_coreTextLines.append(line.get()); |
237 | 237 |
238 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); | 238 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); |
239 | 239 |
240 CFIndex runCount = CFArrayGetCount(runArray); | 240 CFIndex runCount = CFArrayGetCount(runArray); |
241 | 241 |
242 for (CFIndex r = 0; r < runCount; r++) { | 242 for (CFIndex r = 0; r < runCount; r++) { |
243 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray,
m_run.ltr() ? r : runCount - 1 - r)); | 243 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray,
m_run.ltr() ? r : runCount - 1 - r)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 } | 283 } |
284 if (m_fallbackFonts && runFontData != m_font.primaryFont()) | 284 if (m_fallbackFonts && runFontData != m_font.primaryFont()) |
285 m_fallbackFonts->add(fontData); | 285 m_fallbackFonts->add(fontData); |
286 | 286 |
287 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp,
stringLocation, length, runRange)); | 287 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp,
stringLocation, length, runRange)); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 } // namespace WebCore | 291 } // namespace WebCore |
OLD | NEW |