Use the correct font for subtitle grid column width measurements#11575
Merged
Conversation
The main subtitle DataGrid was assigning SubtitleTextBoxAndGridFontName to the grid itself. That setting was intended for subtitle text content, but it also changed the font family used by AutoFitColumns() when measuring the Show/Hide timing columns. The visible Show/Hide cells still rendered with the UI font because they are plain TextBlocks and the app-level UI font style applies directly to TextBlock controls. Width measurement followed a different path: MeasureShowHideColumnWidth() read SubtitleGrid.FontFamily, so switching the subtitle font to a wider face such as SF Mono produced wider timing columns even though the rendered cells continued to look like the UI font. Remove the grid-level font override and keep the subtitle font scoped to the subtitle text cells and editor controls. This makes Show/Hide and other non-text columns inherit the normal UI font for both rendering and auto-fit measurement, eliminating the extra whitespace while preserving the chosen subtitle font for subtitle text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes sure that auto-sized subtitle grid columns get their width based on the correct font so the inexplicably large white space after the Show and Hide columns is gone.
It was a subtitle grid font-scoping issue where changing the subtitle text font could widen the
Show/Hidecolumns even though those columns were still rendered with the UI font. You can see this in the video below: changing the subtitle text font changes the width of the Show and Hide columns, for no reason.Font.change.mov
Problem
The main subtitle
DataGridwas assigningSubtitleTextBoxAndGridFontNameto the grid itself.That caused two different behaviors:
Show/Hidecells still rendered with the UI font because they are plainTextBlocks and the app-level UI font style applies directly toTextBlock.Show/Hidecolumn auto-fit logic measured width fromSubtitleGrid.FontFamily, so switching to a wider subtitle font such asSF Monoproduced wider timing columns.Result: the rendered cells looked correct, but the measured widths were based on the wrong font.
Fix
DataGridResult
Show/Hidewidths no longer change when only the subtitle text font changesTesting