Skip to content

Commit 580a87a

Browse files
authored
Inline code in heaidngs fix (#165)
Makes inline code properly use font sizes dictated by the headings.
1 parent 43d3c08 commit 580a87a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ios/styles/InlineCodeStyle.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ - (void)addAttributes:(NSRange)range {
4242
usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
4343
UIFont *font = (UIFont *)value;
4444
if(font != nullptr) {
45-
UIFont *newFont = [[_input->config monospacedFont] withFontTraits:font];
45+
UIFont *newFont = [[[_input->config monospacedFont] withFontTraits:font] setSize:font.pointSize];
4646
[_input->textView.textStorage addAttribute:NSFontAttributeName value:newFont range:range];
4747
}
4848
}
@@ -60,7 +60,7 @@ - (void)addTypingAttributes {
6060
newTypingAttrs[NSStrikethroughColorAttributeName] = [_input->config inlineCodeFgColor];
6161
UIFont* currentFont = (UIFont *)newTypingAttrs[NSFontAttributeName];
6262
if(currentFont != nullptr) {
63-
newTypingAttrs[NSFontAttributeName] = [[_input->config monospacedFont] withFontTraits:currentFont];
63+
newTypingAttrs[NSFontAttributeName] = [[[_input->config monospacedFont] withFontTraits:currentFont] setSize:currentFont.pointSize];
6464
}
6565
_input->textView.typingAttributes = newTypingAttrs;
6666
}
@@ -76,7 +76,7 @@ - (void)removeAttributes:(NSRange)range {
7676
usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
7777
UIFont *font = (UIFont *)value;
7878
if(font != nullptr) {
79-
UIFont *newFont = [[_input->config primaryFont] withFontTraits:font];
79+
UIFont *newFont = [[[_input->config primaryFont] withFontTraits:font] setSize:font.pointSize];
8080
[_input->textView.textStorage addAttribute:NSFontAttributeName value:newFont range:range];
8181
}
8282
}
@@ -93,7 +93,7 @@ - (void)removeTypingAttributes {
9393
newTypingAttrs[NSStrikethroughColorAttributeName] = [_input->config primaryColor];
9494
UIFont* currentFont = (UIFont *)newTypingAttrs[NSFontAttributeName];
9595
if(currentFont != nullptr) {
96-
newTypingAttrs[NSFontAttributeName] = [[_input->config primaryFont] withFontTraits:currentFont];
96+
newTypingAttrs[NSFontAttributeName] = [[[_input->config primaryFont] withFontTraits:currentFont] setSize:currentFont.pointSize];
9797
}
9898
_input->textView.typingAttributes = newTypingAttrs;
9999
}

0 commit comments

Comments
 (0)