开发者

Using iOS CoreText APIs that don't use a CGContextRef in a non-main Thread

The iOS APIs don't mention threading restrictions on CoreText APIs. To what extent are they safe to use on non-main threads when calling functions that don't use a CGContextRe开发者_StackOverflow中文版f?

Specifically, I'm trying to create a bunch of NSAttributedStrings using a custom truncation algorithm, and I'd like to be able to background the work. I'm only using:

CTLineCreateWithAttributedString
CTLineGetTypographicBounds
CTLineGetStringIndexForPosition


I should have checked <CoreText/CoreText.h>.

/*!
    @header

    Thread Safety Information

    All functions in this header are thread safe unless otherwise specified.
*/


“Multicore Considerations: All individual functions in Core Text are thread safe. Font objects (CTFont, CTFontDescriptor, and associated objects) can be used simultaneously by multiple operations, work queues, or threads. However, the layout objects (CTTypesetter, CTFramesetter, CTRun, CTLine, CTFrame, and associated objects) should be used in a single operation, work queue, or thread.”

from https://developer.apple.com/library/mac/#documentation/Carbon/Reference/CoreText_Framework_Ref/_index.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜