Commit f20983b5 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Add bold to favicon fallback monogram

Screenshot: https://drive.google.com/open?id=1HyMQ4s95UdTZVXdTqawSS4zIM8vDY_uF

Change-Id: I91a2a0e337cb4b43985f1307ff05abbddc3ed71f
Reviewed-on: https://chromium-review.googlesource.com/1133740Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575027}
parent 9eae60a7
......@@ -40,8 +40,13 @@ const CGFloat kDefaultCornerRadius = 3;
_faviconFallbackLabel = [[UILabel alloc] initWithFrame:self.bounds];
_faviconFallbackLabel.textAlignment = NSTextAlignmentCenter;
UIFontDescriptor* baseDescriptor = [UIFontDescriptor
preferredFontDescriptorWithTextStyle:UIFontTextStyleCaption1];
UIFontDescriptor* styleDescriptor = [baseDescriptor
fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold];
// Use a |size| of 0.0 to use the default size for the descriptor.
_faviconFallbackLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
[UIFont fontWithDescriptor:styleDescriptor size:0.0];
_faviconFallbackLabel.isAccessibilityElement = NO;
_faviconFallbackLabel.clipsToBounds = YES;
_faviconFallbackLabel.layer.cornerRadius = kDefaultCornerRadius;
......@@ -85,6 +90,19 @@ const CGFloat kDefaultCornerRadius = 3;
self.faviconFallbackLabel.font = font;
}
- (void)traitCollectionDidChange:(UITraitCollection*)pTC {
if (pTC.preferredContentSizeCategory !=
self.traitCollection.preferredContentSizeCategory) {
UIFontDescriptor* baseDescriptor = [UIFontDescriptor
preferredFontDescriptorWithTextStyle:UIFontTextStyleCaption1];
UIFontDescriptor* styleDescriptor = [baseDescriptor
fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold];
// Use a |size| of 0.0 to use the default size for the descriptor.
_faviconFallbackLabel.font =
[UIFont fontWithDescriptor:styleDescriptor size:0.0];
}
}
#pragma mark - UIView
- (CGSize)intrinsicContentSize {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment