Skip to content

Don't use deprecated FontButton#1421

Merged
cameronwhite merged 2 commits into
PintaProject:masterfrom
UrtsiSantsi:master
May 8, 2025
Merged

Don't use deprecated FontButton#1421
cameronwhite merged 2 commits into
PintaProject:masterfrom
UrtsiSantsi:master

Conversation

@UrtsiSantsi
Copy link
Copy Markdown
Contributor

No description provided.

@UrtsiSantsi
Copy link
Copy Markdown
Contributor Author

I'm not sure why the formatting is failing, even on lines I didn't change, like line 1

@Lehonti
Copy link
Copy Markdown
Contributor

Lehonti commented May 7, 2025

I'm not sure that the formatting issues are on the lines indicated by the log, but I know that formatting conventions are enforced relatively strictly.

In the case of these changes, I think the problem comes from the new method calls (_, __) => HandleFontChanged() and font_button.FontDesc!.ToString()!. By convention, a space is needed before the parentheses. Since these changes don't have it, the formatting check fails.

If you are using Visual Studio, you could try following these steps and seeing if the problem is fixed:

  • Press Ctrl+K and then Ctrl+D. This formats the code automatically according to the project's particular conventions
  • At the bottom-right corner of the editor you can see what the line endings are. Mine are usually MIXED after automatically formatting. Click on it and normalize them to LF.

Copy link
Copy Markdown
Member

@cameronwhite cameronwhite left a comment

Choose a reason for hiding this comment

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

Yeah, I think the format check is failing from things like HandleFontChanged() which are missing the space before the parentheses. The output from dotnet format --verify-no-changes is always pretty cryptic for some reason ..

Running dotnet format from the command line should also work

Comment thread Pinta.Tools/Tools/TextTool.cs Outdated

if (font_button == null) {
font_button = new Gtk.FontButton {
var fontDialog = new Gtk.FontDialog {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor suggestion for coding style - we prefer using Gtk.FontDialog fontDialog = new { ... };

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor Author

@UrtsiSantsi UrtsiSantsi May 8, 2025

Choose a reason for hiding this comment

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

I used format selection, instead of format document, that's why I initially missed some cases 😅

@cameronwhite
Copy link
Copy Markdown
Member

The changes look good to me otherwise - thanks for working on this!

BTW for future deprecation fixes, we are targeting a minimum of GTK 4.12 right now so that's something to be careful about checking. The FontDialogButton was added in 4.10 so this is fine

@UrtsiSantsi
Copy link
Copy Markdown
Contributor Author

BTW for future deprecation fixes, we are targeting a minimum of GTK 4.12 right now so that's something to be careful about checking. The FontDialogButton was added in 4.10 so this is fine

Does it mean libadwaita 1.12?

@cameronwhite
Copy link
Copy Markdown
Member

BTW for future deprecation fixes, we are targeting a minimum of GTK 4.12 right now so that's something to be careful about checking. The FontDialogButton was added in 4.10 so this is fine

Does it mean libadwaita 1.12?

For libadwaita we're targeting a minimum of 1.4 (https://github.com/PintaProject/Pinta/blob/master/configure.ac#L50)

@cameronwhite
Copy link
Copy Markdown
Member

For the fallback font, I tested on macOS and it selects AppleSystemUIFont Regular 12 which seems reasonable and works fine
I can do a quick test on Windows too

@cameronwhite
Copy link
Copy Markdown
Member

On Windows it selected Segoe UI 9 so this seems to work pretty well

@cameronwhite cameronwhite linked an issue May 8, 2025 that may be closed by this pull request
@cameronwhite cameronwhite merged commit 7e9174b into PintaProject:master May 8, 2025
12 checks passed
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.

Fallback font may not exist on host system

3 participants