diff --git a/Bypass/BPAttributedTextVisitor.h b/Bypass/BPAttributedTextVisitor.h index 7335791..20948b4 100644 --- a/Bypass/BPAttributedTextVisitor.h +++ b/Bypass/BPAttributedTextVisitor.h @@ -33,6 +33,7 @@ OBJC_EXPORT NSString* const BPLinkTitleAttributeName; @property (nonatomic, readonly) NSMutableAttributedString* attributedText; @property (nonatomic, strong) BPDisplaySettings *displaySettings; +- (id)initWithDisplaySettings:(BPDisplaySettings *)displaySettings; - (void)resetAttributedText; @end diff --git a/Bypass/BPAttributedTextVisitor.m b/Bypass/BPAttributedTextVisitor.m index 1e7c50b..ebded49 100644 --- a/Bypass/BPAttributedTextVisitor.m +++ b/Bypass/BPAttributedTextVisitor.m @@ -42,6 +42,22 @@ - (id)init return self; } +- (id)initWithDisplaySettings:(BPDisplaySettings *)displaySettings +{ + self = [super init]; + + if (self != nil) { + _attributedText = [[NSMutableAttributedString alloc] init]; + if(displaySettings != nil) { + _displaySettings = displaySettings; + } else { + _displaySettings = [[BPDisplaySettings alloc] init]; + } + } + + return self; +} + - (void)resetAttributedText { _attributedText = [[NSMutableAttributedString alloc] init]; diff --git a/Bypass/BPMarkdownView.m b/Bypass/BPMarkdownView.m index 7448cdc..3ff88ca 100644 --- a/Bypass/BPMarkdownView.m +++ b/Bypass/BPMarkdownView.m @@ -54,6 +54,7 @@ */ static CFArrayRef BPCreatePageFrames(BPDocument *document, + BPDisplaySettings *displaySettings, CGSize pageSize, CGSize *suggestedContentSizeOut, NSAttributedString **attributedTextOut, @@ -61,7 +62,7 @@ id accessibilityContainer) { BPElementWalker* walker = [[BPElementWalker alloc] init]; - BPAttributedTextVisitor* textVisitor = [[BPAttributedTextVisitor alloc] init]; + BPAttributedTextVisitor* textVisitor = [[BPAttributedTextVisitor alloc] initWithDisplaySettings:displaySettings]; [walker addElementVisitor:textVisitor]; BPAccessibilityVisitor* accessVisitor = [[BPAccessibilityVisitor alloc] initWithAccessibilityContainer:accessibilityContainer]; @@ -258,7 +259,7 @@ - (void)renderMarkdownWithDuration:(NSTimeInterval)duration NSArray* accessElements; CGSize contentSize; - CFArrayRef pageFrames = BPCreatePageFrames(_document, pageSize, &contentSize, &attributedText, &accessElements, self); + CFArrayRef pageFrames = BPCreatePageFrames(_document, _displaySettings, pageSize, &contentSize, &attributedText, &accessElements, self); _attributedText = attributedText; accessibleElements = accessElements;