Skip to content
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

Font is rendered different in Label and RichtTextLabel #24570

Closed
letsgamedev opened this issue Dec 23, 2018 · 20 comments
Closed

Font is rendered different in Label and RichtTextLabel #24570

letsgamedev opened this issue Dec 23, 2018 · 20 comments

Comments

@letsgamedev
Copy link

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
Copy link
Contributor

volzhs commented Dec 23, 2018

would you attach the sample project reproduce it?

@letsgamedev
Copy link
Author

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
Copy link

girng commented Dec 23, 2018

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
Copy link
Author

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
Copy link

girng commented Dec 24, 2018

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
Copy link
Contributor

volzhs commented Dec 26, 2018

it's because of default theme.
Default color for RichTextLabel is set here.

theme->set_color("default_color", "RichTextLabel", control_font_color);

and the control_font_color value is here
Color control_font_color = Color::html("e0e0e0");

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

@Chaosus Chaosus added discussion and removed bug labels Dec 26, 2018
@girng
Copy link

girng commented Dec 26, 2018

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
Copy link
Contributor

@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
Copy link
Author

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
Copy link

txigreman commented Mar 28, 2019

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

@txigreman
Copy link

txigreman commented Mar 28, 2019

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

Calinou added a commit to Calinou/godot that referenced this issue Apr 10, 2019
This makes its default color match Label's color, which leads to
a more consistent appearance.

This partially addresses godotengine#24570.
@wagnerfs
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

volzhs commented Aug 13, 2019

I tested this with 3.1.2-devel a5082c0

Peek 2019-08-13 11-28

seems fixed...

@txigreman
Copy link

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
Copy link

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
Copy link
Member

Calinou commented Sep 15, 2019

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
Copy link

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
Copy link
Member

Calinou commented Sep 15, 2019

@wagnerfs Good to know 🙂

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

@Calinou
Copy link
Member

Calinou commented Dec 13, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants