目前阅读稳定版本,需要修改图片阅读方式

This commit is contained in:
shen
2026-05-23 15:50:53 +08:00
parent d7339aa255
commit 3e2669d8a8
7 changed files with 450 additions and 9 deletions
@@ -77,18 +77,27 @@ public struct RDEPUBDTCoreTextRenderer: RDEPUBTextRenderer {
options: dtOptions(request: request),
documentAttributes: nil
)
builder?.willFlushCallback = { element in
guard let element else { return }
RDEPUBTextRendererSupport.prepareHTMLElementForReaderRendering(
element,
style: request.style
)
}
return builder?.generatedAttributedString()
}
private func dtOptions(request: RDEPUBTextChapterRenderRequest) -> [AnyHashable: Any] {
let style = request.style
let screenBounds = UIScreen.main.bounds.insetBy(dx: 20, dy: 28)
var options: [AnyHashable: Any] = [
NSTextSizeMultiplierDocumentOption: 1.0,
DTDefaultFontFamily: style.font.familyName,
DTDefaultFontName: style.font.fontName,
DTDefaultFontSize: style.font.pointSize,
DTDefaultLineHeightMultiplier: max((style.font.lineHeight + style.lineSpacing) / max(style.font.lineHeight, 1), 1),
DTUseiOS6Attributes: true
DTUseiOS6Attributes: true,
DTMaxImageSize: NSValue(cgSize: screenBounds.size)
]
if let baseURL = request.context.baseURL {