- Rename source module from RDReaderView to RDEpubReaderView - Move all source files from Sources/RDReaderView/ to Sources/RDEpubReaderView/ - Update podspec: RDReaderView.podspec -> RDEpubReaderView.podspec - Update Podfile, demo project, and CocoaPods config for new pod name - Delete old RDReaderView pod support files from ReadViewDemo/Pods - Add new RDEpubReaderView pod support files - Update documentation (API ref, architecture, UML, conventions, etc.) - Add FixedLayoutRotationTests - Update .gitignore: exclude .DS_Store, manual unpack backups, _ssoft-output
20 lines
614 B
Swift
20 lines
614 B
Swift
import CoreText
|
|
import UIKit
|
|
|
|
extension NSAttributedString {
|
|
|
|
func rd_paginatedFrames(
|
|
size: CGSize,
|
|
fragmentOffsets: [String: Int] = [:],
|
|
config: RDEPUBTextLayoutConfig = .default
|
|
) -> [RDEPUBTextLayoutFrame] {
|
|
let factory = RDEPUBCoreTextPageFrameFactory(attributedString: self, pageSize: size, config: config)
|
|
let counter = RDEPUBChapterPageCounter(factory: factory)
|
|
return counter.layoutFrames(fragmentOffsets: fragmentOffsets)
|
|
}
|
|
|
|
func ss_pageRanges(size: CGSize) -> [NSRange] {
|
|
rd_paginatedFrames(size: size).map(\.contentRange)
|
|
}
|
|
}
|