godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.9k stars 21.04k forks source link

Font is rendered different in Label and RichtTextLabel #24570

Closed letsgamedev closed 4 years ago

letsgamedev commented 5 years ago

Godot version: v3.1.alpha.calinou.10e9221

OS/device including version: Mac 10.14.1

Issue description: Okay, in total this is a lot of stuff, I guess. But first things first.

bildschirmfoto 2018-12-23 um 19 04 03

The upper one is a Label and the lower one is a RichTextLabel. Both with the same Font but there looking different. Font size is the same and af far as I know every font related is the same (default values)

I really like the Line Skipped param in the Label, but that is not available in the RichTextLabel. On the other side, I want to colorize words with [color=red]foo[/color] but bb_code is only possible on RichTextLabels.

Also, are there some plans to integrate some of those special Text effects like Game Maker Studio show here?

Looks like this is more a feature request than a bug report.

volzhs commented 5 years ago

would you attach the sample project reproduce it?

letsgamedev commented 5 years ago

GitHubExample_fonts.zip

In this clean example, the font doesn't look so odd as in my screenshot above. But it looks different in detail.

girng commented 5 years ago

odd. this is how it looks on w10, 64-bit, gtx 950. regarding your bbcode effect question, this has a possibility of being merged image

letsgamedev commented 5 years ago

The lower has a different white tone. Or is there a different default text color for RichTextLabels? But the more important: The text effects from the other tickets are great! Exactly what we looked for!

girng commented 5 years ago

The lower has a different white tone. Or is there a different default text color for RichTextLabels? But the more important: The text effects from the other tickets are great! Exactly what we looked for!

yeah seems like the label version (top) is a bit brighter. font settings are exactly the same on each... weird

volzhs commented 5 years ago

it's because of default theme. Default color for RichTextLabel is set here. https://github.com/godotengine/godot/blob/10e9221c49eddc05cb36c0b582060cac9e4c8cef/scene/resources/default_theme/default_theme.cpp#L796 and the control_font_color value is here https://github.com/godotengine/godot/blob/10e9221c49eddc05cb36c0b582060cac9e4c8cef/scene/resources/default_theme/default_theme.cpp#L180

seems not a bug but prefer settings for default theme. you can see the same white text when setting Custom Colors > Default Color to white.

screenshot_20181226_233925

girng commented 5 years ago

thanks @volzhs

@letsgamedev looks like the letter spacing thing might still be a bug. but i don't have a mac and can't replicate that issue on windows

Eoin-ONeill-Yokai commented 5 years ago

@letsgamedev There's a patch currently on the works (my own) that was linked above. ( #23658 ) It's still under development and consideration -- any feedback or visual resources for effects that might be desired would be useful for me to try to improve the api. Scaling (like in the video above) is not currently in my patch, for instance. I will look into adding features like that in the near future. Please provide any more examples of interesting text effects in my pull request.

It is worth noting that some text rendering attributes in Label vs RichTextLabel are different, so things like wrapping and kerning can have some differences between the two classes. To be blunt, I think that the RichTextLabel class does need to have some work done to it in order to improve the rendering to be more consistent and cleaner. A general clean up of the class would be nice, but is not urgent.

letsgamedev commented 5 years ago

Whats about the Lines Skipped feature like in the Label Element? Shall I make an extra Feature request for that. For me this is very handy to use in Textboxes.

txigreman commented 5 years ago

I've uploaded a Sample Project to the bug report #25127 where the spacing issue can be seen clearly.

txigreman commented 5 years ago

In case it helps: I noticed that, in my attached demo project, Label and RichTextLabel behave the same if font size is set to 7:

image

If I set the font size to any smaller number the mess begins:

image

With a bigger size they do not look as bad as before, but they still do not look the same:

image

wagnerfs commented 5 years ago

Just curious about this one still, I had to stop my game since I need bbcode going and the resolution is too small and make this bug a hell to work with. I suppose I could also fool around with the RichTextLabel implementation to see if I can get a fix for it, just asking to check if someone else already gave it some thoughts.

Eoin-ONeill-Yokai commented 5 years ago

I just got back from an overseas trip to the Krita sprint in the Netherlands. While I prepare my pr with necessary revisions, I will promise to investigate this a little bit.

My guess would be that the font renderer "instance" is configured slightly differently between the two classes. I can't make any promises that I'll find the specific issue, but I'll try to see if there's anything that stands out.

volzhs commented 5 years ago

I tested this with 3.1.2-devel a5082c010

Peek 2019-08-13 11-28

seems fixed...

txigreman commented 5 years ago

I've tried it out in the nighly build from hugo.pro and the problem still persists.

bug

Both components behave the same in the editor, but they do behave different when running the project.

wagnerfs commented 5 years ago

Same here, still goes crazy while running, even a working font size will freak out once you dynamically (or set a custom size even) resize the window. What's intriguing is that it used to work normally on 3.0 and even 2.1.5.

Calinou commented 5 years ago

Same here, still goes crazy while running, even a working font size will freak out once you dynamically (or set a custom size even) resize the window. What's intriguing is that it used to work normally on 3.0 and even 2.1.5.

This could be due to font oversampling, which is enabled by default since 3.1. Does disabling Rendering > Quality > Dynamic Fonts > Use Oversampling solve the issue?

wagnerfs commented 5 years ago

Same here, still goes crazy while running, even a working font size will freak out once you dynamically (or set a custom size even) resize the window. What's intriguing is that it used to work normally on 3.0 and even 2.1.5.

This could be due to font oversampling, which is enabled by default since 3.1. Does disabling Rendering > Quality > Dynamic Fonts > Use Oversampling solve the issue?

Yeah, it fixed the issue completely, so it was probably that all along, thanks a bunch, I can finally resume the game!

Calinou commented 5 years ago

@wagnerfs Good to know :slightly_smiling_face:

I believe the bug related to font oversampling is tracked in #22580.

Calinou commented 4 years ago

I'll close this in favor of #22580, as it tracks the remaining issue with RichTextLabel sizing when font oversampling is enabled.