|
@@ -13,6 +13,7 @@
|
|
|
|
|
|
|
|
|
#import "VLCTimeNavigationTitleView.h"
|
|
|
+@import CoreText.SFNTLayoutTypes;
|
|
|
|
|
|
@implementation VLCTimeNavigationTitleView
|
|
|
|
|
@@ -21,7 +22,25 @@
|
|
|
self.minimizePlaybackButton.accessibilityLabel = NSLocalizedString(@"MINIMIZE_PLAYBACK_VIEW", nil);
|
|
|
self.aspectRatioButton.accessibilityLabel = NSLocalizedString(@"VIDEO_ASPECT_RATIO_BUTTON", nil);
|
|
|
[self.aspectRatioButton setImage:[UIImage imageNamed:@"ratioIcon"] forState:UIControlStateNormal];
|
|
|
+ [self setupTimeDisplayFont];
|
|
|
|
|
|
[super awakeFromNib];
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ Use a monospace variant for the digits so the label's width does not jitter as the numbers change.
|
|
|
+ */
|
|
|
+- (void)setupTimeDisplayFont
|
|
|
+{
|
|
|
+ UIFontDescriptor *descriptor = self.timeDisplayButton.titleLabel.font.fontDescriptor;
|
|
|
+ NSDictionary *featureSettings = @{
|
|
|
+ UIFontFeatureTypeIdentifierKey: @(kNumberSpacingType),
|
|
|
+ UIFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector)
|
|
|
+ };
|
|
|
+ NSDictionary *attributes = @{ UIFontDescriptorFeatureSettingsAttribute: @[featureSettings] };
|
|
|
+ UIFontDescriptor *newDescriptor = [descriptor fontDescriptorByAddingAttributes: attributes];
|
|
|
+ UIFont *newFont = [UIFont fontWithDescriptor:newDescriptor size:0];
|
|
|
+ self.timeDisplayButton.titleLabel.font = newFont;
|
|
|
+}
|
|
|
+
|
|
|
@end
|