Skip to content

Improve font selection controls#10752

Open
Monstercate wants to merge 1 commit intoSubtitleEdit:mainfrom
Monstercate:improve-font-selection
Open

Improve font selection controls#10752
Monstercate wants to merge 1 commit intoSubtitleEdit:mainfrom
Monstercate:improve-font-selection

Conversation

@Monstercate
Copy link
Copy Markdown
Contributor

Summary

  • Replaces font ComboBoxes in settings and ASS/SSA style editors with searchable AutoCompleteBox controls.
  • Adds localized font name lookup so fonts can be displayed and searched with localized names.
  • Adds live ASS/SSA font preview while hovering font candidates.
  • Improves font dropdown behavior:
    • stable dropdown width
    • full-row hover hit testing
    • mouse wheel scrolling inside dropdown items
    • prevents wheel events from scrolling parent windows
  • Keeps ASS/SSA preview layout stable while changing preview fonts.

Testing

Built successfully with:

dotnet build src\ui\UI.csproj --no-restore -p:RunAnalyzers=false

@niksedk
Copy link
Copy Markdown
Member

niksedk commented Apr 30, 2026

Could you please use a custom control instead of RegisterStableDropDownWidths.

Also please add screenshots when doing UI PRs :)

The UI seems weird some places now, like:

image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves font selection UX across the UI by replacing fixed font ComboBoxes with searchable AutoCompleteBox controls, adding localized font-name mapping for font resolution, and enhancing dropdown/preview behavior (stable widths, wheel scrolling, hover preview).

Changes:

  • Introduces global dropdown-width stabilization and wheel-scrolling support for font dropdown items.
  • Updates settings and ASS/SSA style editors to use searchable font pickers (with hover-based preview in ASS/SSA editors).
  • Expands font-name mapping to include multiple Win32 localized family names (and a typographic-name fallback) for more reliable font resolution.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/ui/Program.cs Registers the new dropdown-width stabilization behavior at app startup.
src/ui/Logic/UiUtil.cs Adds dropdown width stabilization logic and pointer-wheel scrolling helper for dropdown items.
src/ui/Logic/FontHelper.cs Enhances libass-to-Skia font name mapping using multiple localized Win32 family names.
src/ui/Features/Options/Settings/SettingsPage.cs Replaces font ComboBoxes with searchable AutoCompleteBox controls in settings.
src/ui/Features/Options/Settings/CustomContinuationStyleViewModel.cs Replaces a malformed ellipsis glyph with the correct Unicode ellipsis.
src/ui/Features/Files/ImportPlainText/PlainTextSplitter.cs Updates sentence break detection to recognize Unicode ellipsis.
src/ui/Features/Assa/AssaStylesWindow.cs Replaces ASS/SSA style font selector with searchable control + hover preview behavior and preview layout adjustments.
src/ui/Features/Assa/AssaStylesViewModel.cs Adds hover-preview font handling and ensures preview updates immediately on initialization.
src/ui/Features/Assa/AssaSingleStyleWindow.cs Replaces single-style font selector with searchable control + hover preview behavior and preview layout adjustments.
src/ui/Features/Assa/AssaSingleStyleViewModel.cs Adds hover-preview font handling and generates preview bitmaps for the single-style editor.

Comment thread src/ui/Logic/UiUtil.cs
Comment on lines +94 to +114
var width = CalculateDropDownWidth(owner, items);
popup.PlacementTarget = owner;
popup.Placement = PlacementMode.BottomEdgeAlignedLeft;
popup.HorizontalOffset = 0;
popup.Width = width;
popup.MinWidth = width;
popup.MaxWidth = width;

if (popup.Child is Control popupChild)
{
popupChild.Width = width;
popupChild.MinWidth = width;
popupChild.MaxWidth = width;
}

if (remainingAttempts > 0)
{
DispatcherTimer.RunOnce(
() => TryStabilizeDropDownWidth(owner, items, remainingAttempts - 1),
TimeSpan.FromMilliseconds(25));
}
Comment on lines +86 to 91
if (_previewFontName != null)
{
return;
}

_timerUpdatePreview.Stop();
Comment on lines +930 to +952
void OpenDropDown()
{
if (!userActivated)
{
return;
}

UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
Dispatcher.UIThread.Post(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, DispatcherPriority.Background);
DispatcherTimer.RunOnce(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, TimeSpan.FromMilliseconds(10));
DispatcherTimer.RunOnce(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, TimeSpan.FromMilliseconds(50));
Comment on lines +555 to +577
void OpenDropDown()
{
if (!userActivated)
{
return;
}

UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
Dispatcher.UIThread.Post(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, DispatcherPriority.Background);
DispatcherTimer.RunOnce(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, TimeSpan.FromMilliseconds(10));
DispatcherTimer.RunOnce(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, TimeSpan.FromMilliseconds(50));
Comment on lines +229 to +251
void OpenDropDown()
{
if (!userActivated)
{
return;
}

UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
Dispatcher.UIThread.Post(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, DispatcherPriority.Background);
DispatcherTimer.RunOnce(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, TimeSpan.FromMilliseconds(10));
DispatcherTimer.RunOnce(() =>
{
box.IsDropDownOpen = true;
UiUtil.StabilizeDropDownWidth(box, box.ItemsSource);
}, TimeSpan.FromMilliseconds(50));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants