Skip to content

[Text tool] Allow granular selection of font weight#1967

Open
pedropaulosuzuki wants to merge 18 commits intoPintaProject:masterfrom
pedropaulosuzuki:master
Open

[Text tool] Allow granular selection of font weight#1967
pedropaulosuzuki wants to merge 18 commits intoPintaProject:masterfrom
pedropaulosuzuki:master

Conversation

@pedropaulosuzuki
Copy link
Contributor

@pedropaulosuzuki pedropaulosuzuki commented Feb 3, 2026

Currently, it's only possible to select 'bold' or 'normal' for font-weight, even if the font-family has multiple available weights. This MR fixes that by implementing font-weight for all supported weights in Pango. Ctrl+B works as expected.

Screencast.from.03-02-2026.13.30.06.webm

Partially fixes: #1965

Please squash the commits.

TODO: Only show font-weights supported by the font-family. Will keep this one for a future Merge Request.

Currently, it's only possible to select 'bold' or 'normal' for font-weight, even if the font-family has multiple available weights. This commit implements font-weight for [all supported weights in Pango](https://docs.gtk.org/Pango/enum.Weight.html).

TODO:

1. Handle 'CTRL + B' shortcut.
1. Only show [font-weights supported by the font-family](https://docs.gtk.org/Pango/method.FontFamily.list_faces.html).
@pedropaulosuzuki
Copy link
Contributor Author

@cameronwhite I tried to put the font-weight value (100, 200, 300, and so on) on the ToolBarItem inside parenthesis, however it failed, probably due to the Action name being invalid. (The options were unable to be selected). We probably should fix this so that we can put any text inside any ToolBarDropDownButton's ToolBarItem.

@pedropaulosuzuki pedropaulosuzuki marked this pull request as ready for review February 3, 2026 15:55
Copy link
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.

Seems good to me overall 👍
I also ran into issues with testing fonts that didn't support all of the weights, so should make sure to file a bug about this if we're leaving it for a future PR

Index 4 (book) was used in `weight_btn.SelectedIndex > 7 ? 5 : 8`, instead of correct index 5 (normal).
cameronwhite pushed a commit that referenced this pull request Feb 10, 2026
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.

[Text tool] Font face is ignored

3 participants