-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Font configuration and import UI, and Font resources [with font size]. #61473
Conversation
5d512f8
to
171bb1d
Compare
171bb1d
to
29833ac
Compare
81adb2d
to
5ae989d
Compare
5ae989d
to
a0079be
Compare
838c354
to
1650e87
Compare
Regarding implementation wise, there are some things I don't quite get, which are a bit broad to put as code review so here are my doubts:
|
Everything in the For some controls, it makes sense for font settings more accessible, there's another PR for this - #61991, but I do not see any reason to use different ways to set the same things. |
@bruvzg I understand this, but the way I see this, its still very annoying because you are forcing the allocation of a FontConfig every time you want to draw something. I would suggest the following reorganization of the font resources: Font
FontVariation
FontSettings
With this, we have just a single Font class that does everything. A FontVariation class that you can use in the rare use cases where you need this, without forcing it to the user, and a FontSettings class that is only used for some few controls where you want to override and ignore theme. |
How do we communicate to the user that out of all resources this one cannot be shared for some reason? My main concern is that changing a font size should be just that - changing the size. It's the most frustrating part of working with fonts in 3.x to our users that they have to work with resources to do that. It's not intuitive, not how people treat fonts at all. Remember, this is a replacement to a toolbar that already meets the expectations of an average user who has ever worked with fonts in any other application. In that toolbar changing font properties, however foreign to Godot's vision it was, was intuitive and familiar. This suggestion complicates things, even if it makes it neater for our internal design and logic. IMO user's expectations should come first and our internal concerns should come second. So, to reiterate, changing a size of a font is a highly used operation that should be accessible. It should be as simple as changing a numeric value. If you want to have it stored in a resource internally, fine, but it should not require copying of resources on the user side. And as a sidebar, if we do have a flag to implicitly copy a resource instead of sharing, we need to communicate it very well to the user, because this is also not the expected behavior anywhere in Godot. |
I do not see any control that won't need, it's pretty much an essential feature. Absence of it will make any variable font or font collection unusable. Otherwise, I'm not sure what's so special with |
@YuriSizov IMO this touches on a different problem that I was about to open a proposal for discussion about to get feedback, but the bottom line is that most users are completely unaware that, when duplicating, internal subresources are shared. For this is is actually unexpected (because its very hard to track) and led us to having the usage flag above as a hack. On the other side, users only understand well that its the resources saved to a file that you are sharing. So, in this specific case, if they wanted to actually share it they would save it to a file. |
I guess another option would be to do exactly the opposite, keep Text draw functions stay in the |
@bruvzg The problem to me is that, in practice, a control can use multiple fonts and sizes for different things and mix and match them, but changing the variation is very rare or very context specific so I am not entirely sure that having it as a theme property will be of much use. This is why I suggested only exposing it as a regular property in controls that may make sense to use, or even in Control if you want to override for the whole control. |
Ok, the sharing part we can discuss in a separate proposal, but I still advocate for a better font editor tool that would work intuitively, even if internally it's turtles and duplicated resources all the way down. |
Changing variations (and the same for font collections) is just a much more convenient way to have multiple fonts. So if I for example want to use normal and bold fonts, I can have a single variable font file instead of two files (which also will take less space). And I won't need to replace files (or event compile new fonts, if the preferred one is not available by default) if I want to change the thickness of the bold font, for example. Also, if we will ever have support for using system fonts (which I'm planning to add), there are not many options, many of the system fonts are shipped as collections. |
For that reason, we really need an indicator of unique vs shared status, as I asked 2 years ago in godotengine/godot-proposals#904 |
@Zireael07 Put this up instead, which is hopefully a simpler solution - godotengine/godot-proposals#4672 |
@bruvzg The problem is that, in most cases, users just download font packs that come with the different intensities, so its rare to change the boldness via parameter in general. How about this then? FontVariation can inherit Font too (or FontBase), and it contains both a Font property and the variation properties. So you can still use it as a variation of an existing font. IMO this should be the simplest way to solve the problem. |
Well, I understand it's a less common option, but I do not like an idea of arbitrary restricting a feature to the
Hm, I like this option, it should work. So, something like this:
This is probably the most logical way to do it indeed. |
@bruvzg Yeah I think that requires the least code change and hacks and it should just simply work transparently with all the existing code. |
I fully agree, but I think if we solve the shared duplication problem, then for users it will be very obvious that its not shared by default, so there is no need to have a separate font size setting. And if they do want to share, they can simply save the font setting to disk and reuse it wherever they want. |
So I guess there are 3 separate issues:
|
Sounds good!
Definitely out of the scope of this.
I think the way it is now in theme is ok because it does what it has to do. The only problem is the cases where you want to have a custom outline. IMO of this we can also add the outline setting to FontVariation, since its kinda the same thing as with Font/FontData.
All the above is solved by FontSetting. I know it may seem counterintuitive, but to me that is the right solution. This is what we discussed originally, the actual use cases that you want to solve are:
|
Well, I do not think it's the best solution, but it's non-intrusive and won't break anything, and if we'll have something better, it's replacing it will be easy, so I guess why not. |
@bruvzg I agree its no the cleanest, but its very simple and solves the problem at hand. We can eventually do something better if we figure out what at some point. |
#62108 - a new PR with |
Alternative version of #61406, the same changes but with
font_size
left as a separate theme property.