Playlist View: Now using monospaced numbers on all fields

CQTexperiment
Christopher Snowhill 2022-01-20 17:26:30 -08:00
parent b317bfcdc2
commit 8c63e8fde3
1 changed files with 16 additions and 4 deletions

View File

@ -304,13 +304,25 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
if (view) { if (view) {
NSTableCellView * cellView = (NSTableCellView *) view; NSTableCellView * cellView = (NSTableCellView *) view;
NSRect frameRect = cellView.frame; NSRect frameRect = cellView.frame;
frameRect.origin.y = 1; frameRect.origin.y = cellView.imageView ? 0 : 1;
frameRect.size.height = tableView.rowHeight; frameRect.size.height = tableView.rowHeight;
cellView.frame = frameRect; cellView.frame = frameRect;
if (cellView.textField) { if (cellView.textField) {
NSFont * sysFont = [NSFont systemFontOfSize:fontSize];
NSFont * font = [NSFont systemFontOfSize:fontSize]; NSFontDescriptor * fontDesc = [sysFont fontDescriptor];
NSDictionary *fontFeatureSettings = @{NSFontFeatureTypeIdentifierKey: @(kNumberSpacingType),
NSFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector)
};
NSDictionary *fontFeatureAttributes = @{NSFontFeatureSettingsAttribute: @[ fontFeatureSettings ] };
fontDesc = [fontDesc fontDescriptorByAddingAttributes:fontFeatureAttributes];
NSFont * font = [NSFont fontWithDescriptor:fontDesc size:fontSize];
cellView.textField.font = font; cellView.textField.font = font;
cellView.textField.stringValue = cellText; cellView.textField.stringValue = cellText;
@ -332,7 +344,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
NSRect cellFrameRect = cellView.imageView.frame; NSRect cellFrameRect = cellView.imageView.frame;
cellFrameRect.size.height = frameRect.size.height; cellFrameRect.size.height = frameRect.size.height;
cellFrameRect.origin.y = 1; cellFrameRect.origin.y = 0;
cellView.imageView.frame = cellFrameRect; cellView.imageView.frame = cellFrameRect;
} }