From 2cb04fa1b7224ab60ff7ee2f769f3b2e50ae2f66 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Fri, 24 Oct 2025 14:08:28 -0400 Subject: [PATCH] feature: add support for song title and artist font size automatic adjustment --- .../AlbumArtLayoutSettingsControl.xaml | 30 +++++++++++++------ .../Controls/LyricsSettingsControl.xaml | 2 +- .../Controls/LyricsWindowSettingsControl.xaml | 5 +++- .../Models/Settings/AlbumArtLayoutSettings.cs | 2 ++ .../Strings/en-US/Resources.resw | 5 +--- .../Strings/ja-JP/Resources.resw | 7 ++--- .../Strings/ko-KR/Resources.resw | 9 ++---- .../Strings/zh-CN/Resources.resw | 9 ++---- .../Strings/zh-TW/Resources.resw | 9 ++---- .../LyricsRendererViewModel.Messages.cs | 4 +++ .../LyricsRendererViewModel.Update.cs | 22 ++++++++++---- 11 files changed, 60 insertions(+), 44 deletions(-) diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml index f2c2520..2e1e655 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml @@ -23,7 +23,7 @@ Glyph=}" IsExpanded="True"> - + @@ -67,14 +67,26 @@ - - - + + + + + + + + + + - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml index a3e583e..918fe0e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml @@ -144,7 +144,10 @@ IsExpanded="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAdaptToEnvironment, Mode=OneWay}"> - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/AlbumArtLayoutSettings.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/AlbumArtLayoutSettings.cs index 3a8df56..d40a3ae 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/AlbumArtLayoutSettings.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/AlbumArtLayoutSettings.cs @@ -13,6 +13,7 @@ namespace BetterLyrics.WinUI3.Models.Settings [ObservableProperty][NotifyPropertyChangedRecipients] public partial TextAlignmentType SongInfoAlignmentType { get; set; } = TextAlignmentType.Left; [ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverImageRadius { get; set; } = 12; // 12 % of the cover image size [ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverImageShadowAmount { get; set; } = 12; + [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsAutoSongInfoFontSize { get; set; } = true; [ObservableProperty][NotifyPropertyChangedRecipients] public partial int SongInfoFontSize { get; set; } = 18; [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool ShowTitle { get; set; } = true; [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool ShowArtists { get; set; } = true; @@ -28,6 +29,7 @@ namespace BetterLyrics.WinUI3.Models.Settings SongInfoAlignmentType = this.SongInfoAlignmentType, CoverImageRadius = this.CoverImageRadius, CoverImageShadowAmount = this.CoverImageShadowAmount, + IsAutoSongInfoFontSize = this.IsAutoSongInfoFontSize, SongInfoFontSize = this.SongInfoFontSize, ShowTitle = this.ShowTitle, ShowArtists = this.ShowArtists, diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw index f8983c8..164b054 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw @@ -520,9 +520,6 @@ If you encounter any problems, please go to the Settings page, About tab, and vi Apply - - Automatic resizing - Automatic startup @@ -625,7 +622,7 @@ If you encounter any problems, please go to the Settings page, About tab, and vi Draggable area - + Automatic adjustment diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw index 20caec1..7ff11c9 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw @@ -520,8 +520,8 @@ 適用する - - 自動サイズ変更 + + 自動調整 自動起動 @@ -625,9 +625,6 @@ ドラッグ可能 - - 自動調整 - アニメーションタイプを緩和します diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw index b9bc8c0..4107dcc 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw @@ -488,7 +488,7 @@ 앨범 표지 소스를 구성합니다 - 앨범아트 + 앨범 아트 크기 앨범 아트 소스 @@ -520,8 +520,8 @@ 적용하다 - - 자동 크기 조정 + + 자동 조정 자동 시작 @@ -625,9 +625,6 @@ 드래그 가능 - - 자동 조정 - 애니메이션 유형 완화 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw index 5bc179d..120aafb 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw @@ -488,7 +488,7 @@ 配置专辑封面源 - 专辑封面 + 专辑封面尺寸 专辑封面源 @@ -520,8 +520,8 @@ 应用 - - 自动调整尺寸 + + 自动调整 自动启动 @@ -625,9 +625,6 @@ 可拖拽区域 - - 自动调整 - 缓动动画类型 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw index 263cc15..d2477b1 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw @@ -488,7 +488,7 @@ 配置專輯封面源 - 專輯封面 + 相簿藝術尺寸 專輯封面來源 @@ -520,8 +520,8 @@ 應用 - - 自動調整大小 + + 自動調整 自動啟動 @@ -625,9 +625,6 @@ 拖動 - - 自動調整 - 緩動動畫類型 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs index 902e412..d794cf9 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs @@ -85,6 +85,10 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel { _isAlbumArtSizeChanged = true; } + else if (message.PropertyName == nameof(AlbumArtLayoutSettings.IsAutoSongInfoFontSize)) + { + UpdateSongInfoFontSize(); + } } else if (message.Sender is LyricsBackgroundSettings) { diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs index 522e295..702a875 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs @@ -160,6 +160,8 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel if (_isCanvasWidthChanged || _isCanvasHeightChanged) { + UpdateSongInfoFontSize(); + _isCoverAcrylicEffectAmountChanged = true; _effect?.Properties["Width"] = (float)control.ConvertDipsToPixels((float)_canvasWidth, CanvasDpiRounding.Round); @@ -409,16 +411,16 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel _lyricsXTransition.Update(_elapsedTime); _lyricsYTransition.Update(_elapsedTime); - + _albumArtXTransition.Update(_elapsedTime); _albumArtYTransition.Update(_elapsedTime); - + _lyricsOpacityTransition.Update(_elapsedTime); _albumArtOpacityTransition.Update(_elapsedTime); - + _immersiveBgOpacityTransition.Update(_elapsedTime); _immersiveBgColorTransition.Update(_elapsedTime); - + _albumArtAccentColor1Transition.Update(_elapsedTime); _albumArtAccentColor2Transition.Update(_elapsedTime); _albumArtAccentColor3Transition.Update(_elapsedTime); @@ -783,8 +785,16 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel private void UpdateSongInfoFontSize() { - _titleTextFormat.FontSize = _liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.SongInfoFontSize; - _artistTextFormat.FontSize = _liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.SongInfoFontSize - 2; + if (_liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.IsAutoSongInfoFontSize) + { + _titleTextFormat.FontSize = (int)Math.Clamp(Math.Min(_canvasHeight, _canvasWidth) / 20, 8, 72); + } + else + { + _titleTextFormat.FontSize = _liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.SongInfoFontSize; + } + + _artistTextFormat.FontSize = (int)(_titleTextFormat.FontSize * 0.8); _isSongInfoFontSizeChanged = true; }