Commit dd54f1dd authored by Zev Eisenberg's avatar Zev Eisenberg Committed by Carola Nitz

Use monospace digits for time label. Fixes #351.

(cherry picked from commit b7d92721)
parent f2979219
......@@ -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
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