Skip to content

Commit

Permalink
Merge pull request #897 from tchapgouv/896-respecter-le-reglage-de-ta…
Browse files Browse the repository at this point in the history
…ille-de-texte-du-systeme

896 respecter le reglage de taille de texte du systeme
  • Loading branch information
NicolasBuquet authored Oct 24, 2023
2 parents 62e1023 + d0a506a commit d2eb063
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Riot/Modules/Common/SectionHeaders/TabListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class TabListView: UIView {
for (index, item) in items.enumerated() {
let button = UIButton(type: .system)
button.titleLabel?.font = itemFont
// Tchap: automatically adjust button font size dynamically when user change the setting.
button.vc_adjustsFontForContentSizeCategory = true
button.setTitle(item.text, for: .normal)
button.setImage(item.icon?.withRenderingMode(.alwaysTemplate), for: .normal)
button.contentEdgeInsets = UIEdgeInsets(top: 0, left: Constants.itemSpacing / 2, bottom: 0, right: Constants.itemSpacing / 2)
Expand Down
26 changes: 26 additions & 0 deletions Riot/Modules/MatrixKit/Views/MXKMessageTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ @interface MXKMessageTextView()

@implementation MXKMessageTextView

// Tchap: automatically adjust message font size dynamically when user change the setting.
- (id)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer
{
self = [super initWithFrame:frame textContainer:textContainer];

if (self) {
[self setAdjustsFontForContentSizeCategory:YES];
}

return self;
}

// Tchap: automatically adjust message font size dynamically when user change the setting.
- (id)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];

if (self) {
[self setAdjustsFontForContentSizeCategory:YES];
}

return self;
}

- (BOOL)canBecomeFirstResponder
{
return NO;
Expand Down Expand Up @@ -78,6 +101,9 @@ - (void)setAttributedText:(NSAttributedString *)attributedText
// forcing the layoutManager to redraw the glyphs at all NSAttachment positions.
[self vc_invalidateTextAttachmentsDisplay];
}

// Tchap: set text type to prefered font to rerspect user text size
self.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
}

- (void)registerPillView:(UIView *)pillView
Expand Down
1 change: 1 addition & 0 deletions changelog.d/896.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Le texte des messages dans un salon respecte le réglage de taille de texte de l’utilisateur (possibilité de zoom)

0 comments on commit d2eb063

Please sign in to comment.