← Back to context

Comment by favorited

3 days ago

If you'd like an example of how this can be done, Swift's AttributedString type is exactly that. It manages the association of runs of attributes (font, kerning, color, etc.) with Unicode text, and its backing storage uses a rope type provided by the swift-collections package. (The rope module itself isn't stabilized yet, so it's really only used for AttributedString at this point, AFAIK.)

https://github.com/swiftlang/swift-foundation/tree/main/Sour...

https://github.com/apple/swift-collections/tree/main/Sources...