Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: the Mod Settings row takes the font of Spotify's row titles, not a 13 pt badge's (#140)
My-Name-Is-Jeff7160ec6fe1a3
diff --git a/tweak/Sources/App/ModSettings.x b/tweak/Sources/App/ModSettings.xindex 4953fef3..f103d49e 100644--- a/tweak/Sources/App/ModSettings.x+++ b/tweak/Sources/App/ModSettings.x@@ -156,7 +156,7 @@ static UIViewController *modSettingsPage(void) {- (void)layoutSubviews {[super layoutSubviews];- _title.font = SGSpotifyListFont();+ _title.font = SGSpotifyListFont(self.drawer);CGFloat width = self.bounds.size.width, height = self.bounds.size.height, lead = self.drawer ? 4 : 0;_icon.frame = CGRectMake(12 + lead, (height - 24) / 2, 24, 24);_title.frame = CGRectMake(48 + lead, 0, width - 96, height);@@ -211,7 +211,8 @@ void SGOpenModSettings(UIView *source) {// At the end of the settings list, or above the first row of the drawer's, with the inset for it// added again whenever Spotify resets the inset.static void placeRow(UICollectionView *list, SGModSettingsRow *row) {- SGAdoptFonts(list, row);+ // The row took the fallback font if it laid out before the list had rows to read.+ if (SGAdoptFonts(list, row, row.drawer)) [row setNeedsLayout];CGFloat bottom = list.contentSize.height;row.hidden = !row.drawer && bottom <= 0;row.frame = CGRectMake(0, row.drawer ? -kRowHeight : bottom, list.bounds.size.width, kRowHeight);diff --git a/tweak/Sources/Settings/SGPageStyle.h b/tweak/Sources/Settings/SGPageStyle.hindex ea789f35..3d8eb715 100644--- a/tweak/Sources/Settings/SGPageStyle.h+++ b/tweak/Sources/Settings/SGPageStyle.h@@ -22,10 +22,11 @@ BOOL SGAccessibilityTextSize(void); // an accessibility size, where a row's va// layout returns the y under the text; the height is the same text measured at the same width.CGFloat SGSliderTextHeight(NSString *title, NSString *subtitle, CGFloat width);CGFloat SGLayOutSliderText(UILabel *title, UILabel *value, UILabel *subtitle, CGFloat x, CGFloat y, CGFloat width);-// Takes the 13pt title font off Spotify's own settings list, once, for the Mod Settings row the mod adds to it-// (App/ModSettings.x), which reads as one of Spotify's rows; SGSpotifyListFont hands it out.-void SGAdoptFonts(UIView *list, UIView *exclude);-UIFont *SGSpotifyListFont(void);+// Takes the rows' title font off Spotify's own settings list or side drawer, once for each, for the Mod Settings row+// the mod adds to it (App/ModSettings.x), which reads as one of Spotify's rows; SGSpotifyListFont hands it out. YES+// on the call that found it.+BOOL SGAdoptFonts(UIView *list, UIView *exclude, BOOL drawer);+UIFont *SGSpotifyListFont(BOOL drawer);UIImageView *SGSymbolView(NSString *name, CGFloat size, UIImageSymbolWeight weight, CGFloat box);// A white symbol on a rounded square of `color`, the leading icon of a row; SGTileImage's square is gray.diff --git a/tweak/Sources/Settings/SGPageStyle.m b/tweak/Sources/Settings/SGPageStyle.mindex 569bd1b5..fc58c4d7 100644--- a/tweak/Sources/Settings/SGPageStyle.m+++ b/tweak/Sources/Settings/SGPageStyle.m@@ -1,7 +1,8 @@#import "SGPageStyle.h"#import "Core/SGCore.h"-static UIFont *sg_spotifyFont;+// The rows' title font of Spotify's settings list ([0]) and of its side drawer ([1]).+static UIFont *sg_spotifyFont[2];// The dark appearance's secondary label, fixed rather than dynamic so a view that is not set dark reads it too.UIColor *SGGrey(void) { return [UIColor colorWithRed:0xEB / 255.0 green:0xEB / 255.0 blue:0xF5 / 255.0 alpha:0.6]; }@@ -62,7 +63,7 @@ CGFloat SGLayOutSliderText(UILabel *title, UILabel *value, UILabel *subtitle, CGreturn y;}-UIFont *SGSpotifyListFont(void) { return sg_spotifyFont ?: [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; }+UIFont *SGSpotifyListFont(BOOL drawer) { return sg_spotifyFont[drawer] ?: [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; }UIImageView *SGSymbolView(NSString *name, CGFloat size, UIImageSymbolWeight weight, CGFloat box) {UIImage *image = [UIImage systemImageNamed:name withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:size weight:weight]];@@ -267,14 +268,30 @@ UITableViewCell *SGDequeueCell(UITableView *table, NSString *identifier) {?: [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];}-// Spotify's list titles carry its typeface at 13pt.-void SGAdoptFonts(UIView *list, UIView *row) {- if (sg_spotifyFont) return;+// The rows' titles are the font most of the list's labels between 13 and 18 pt have: 13 pt in 9.1.78's settings+// list (App/ModSettings.x), larger in the drawer and in 9.1.90's, where the 13 pt subtitles are as many as the+// titles, so a tie goes to the larger. The drawer's 13 pt labels count only when it has no larger one: the+// first 13 pt label, which it once took, was there a badge another tweak adds, bold, and the row read smaller and+// heavier than its neighbours (the phone, 2026-10-23).+BOOL SGAdoptFonts(UIView *list, UIView *row, BOOL drawer) {+ if (sg_spotifyFont[drawer]) return NO;+ NSCountedSet<UIFont *> *titles = [NSCountedSet set];+ __block UIFont *best = nil, *small = nil;SGForEachView(list, ^(UIView *v) {- if (sg_spotifyFont || ![v isKindOfClass:UILabel.class] || SGIsInside(v, row)) return;+ if (![v isKindOfClass:UILabel.class] || SGIsInside(v, row)) return;UILabel *label = (UILabel *)v;- if (label.text.length >= 2 && label.font.pointSize == 13) sg_spotifyFont = label.font;+ CGFloat size = label.font.pointSize;+ if (label.text.length < 2 || size < 13 || size > 18) return;+ if (drawer && size < 14) {+ if (!small) small = label.font;+ return;+ }+ [titles addObject:label.font];+ NSUInteger count = [titles countForObject:label.font], most = [titles countForObject:best];+ if (!best || count > most || (count == most && size > best.pointSize)) best = label.font;});+ sg_spotifyFont[drawer] = best ?: small;+ return sg_spotifyFont[drawer] != nil;}UIViewController *SGTopController(void) {