Skip to content

Commit

Permalink
Merge pull request #148 from CareEvolution/eschramm/fixMDFooter
Browse files Browse the repository at this point in the history
Store originalFont for CEVRK1Label to make updateAppearance idempotent
  • Loading branch information
eschramm authored Sep 3, 2024
2 parents 7277d72 + c9492ae commit cb7ba59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions ORK1Kit/ORK1Kit/Common/CEVRK1Label.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
@interface CEVRK1Label: UILabel

- (NSString * _Nullable)rawText;
- (UIFont * _Nullable)originalFont;

@end
10 changes: 10 additions & 0 deletions ORK1Kit/ORK1Kit/Common/CEVRK1Label.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@

@implementation CEVRK1Label {
NSString *_rawText;
UIFont *_originalFont;
}

- (void)setText:(NSString * _Nullable)text {
_rawText = text;
[self updateAppearance];
}

- (void)setFont:(UIFont *)font {
_originalFont = font;
[super setFont:font];
}

- (NSString * _Nullable)rawText {
return _rawText;
}

- (UIFont *)originalFont {
return _originalFont;
}

- (void)updateAppearance {
// overridden in subclasses
}
Expand Down
1 change: 1 addition & 0 deletions ORK1Kit/ORK1Kit/Common/CEVRK1Theme.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ - (void)updateAppearanceForLabel:(CEVRK1Label *)label ofType:(CEVRK1DisplayTextT
break;
}
NSMutableDictionary *attributes = [self textAttributesForView:label];
attributes[NSFontAttributeName] = label.originalFont;
[self combineIntoAttributes:attributes textStyle:textStyle];
label.attributedText = [[NSAttributedString alloc] initWithMarkdownRepresentation:[label rawText] attributes:attributes];
}
Expand Down

0 comments on commit cb7ba59

Please sign in to comment.