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

Buttons disappear on window resize due to font oversampling #37242

Closed
drmar opened this issue Mar 23, 2020 · 11 comments · Fixed by #37260
Closed

Buttons disappear on window resize due to font oversampling #37242

drmar opened this issue Mar 23, 2020 · 11 comments · Fixed by #37260

Comments

@drmar
Copy link

drmar commented Mar 23, 2020

Godot version:
3.2.1

OS/device including version:
macOS Catalina 10.15.3 / MacBookPro11,1

Issue description:
Buttons seem to disappear when the window is resized vertically.
Check the attached video.

Godot-_Bug.mov.zip

Steps to reproduce:
Control Node -> Center Container -> Vertical Box Container -> Button_1, Button_2...

Minimal reproduction project:

@Calinou
Copy link
Member

Calinou commented Mar 23, 2020

@drmar Please upload a minimal reproduction project to make this easier to troubleshoot.

Also, which stretch mode settings did you use in the project?

@drmar
Copy link
Author

drmar commented Mar 23, 2020

Also, which stretch mode settings did you use in the project?

Stretch Mode: 2d
Stretch Aspect: keep

Please upload a minimal reproduction project to make this easier to troubleshoot.

I will do this shortly.

@drmar
Copy link
Author

drmar commented Mar 23, 2020

Minimal reproduction project:

Godot Bug.zip

@Janglee123
Copy link
Contributor

I can reproduce this on Godot 3.2.

@Calinou
Copy link
Member

Calinou commented Mar 23, 2020

I can reproduce this on Godot 3.2 on Linux. It happens whenever you resize the window width or height to be 1 pixel wide.

You can work around this by defining a minimum window size in any script:

func _ready():
	OS.min_window_size = Vector2(64, 64)

I wonder if we should set a minimum window size by default to prevent this bug. This is fairly common in applications after all.

@drmar
Copy link
Author

drmar commented Mar 23, 2020

I actually don't think that the bug happens necessarily when the window is 1px by itself.
I believe something else has to happen in conjunction with the window resize for the bug to appear.
I will do more testing tomorrow.

@Calinou
Copy link
Member

Calinou commented Mar 23, 2020

This doesn't occur if you set the stretch mode to disabled or viewport. It only occurs when setting the stretch mode to 2d with font oversampling enabled. If you disable Rendering > Quality > Dynamic Fonts > Use Oversampling in the project settings, it won't occur when using the 2d stretch mode.

This means it's yet another bug related to font oversampling.

@Janglee123
Copy link
Contributor

Janglee123 commented Mar 24, 2020

The size and position of the button node increase unacceptably, and it gets out of the window. This only happens to buttons.

Here is the demo. Resize the window to the smallest size and restore it, and You can see the size of the play button increases.

Edit: It's because of custom fonts. without custom font it works fine as drmar said.

@drmar
Copy link
Author

drmar commented Mar 24, 2020

This means it's yet another bug related to font oversampling.

I also believe that it has something to do with custom fonts. It you recreate my minimal project that I uploaded initially without custom fonts, the buttons will NOT disappear, even when the window is resized to 1px.

@Calinou
Copy link
Member

Calinou commented Mar 24, 2020

@drmar The default font is a BitmapFont. BitmapFonts don't make use of font oversampling, which is why this bug doesn't occur with BitmapFonts.

@drmar
Copy link
Author

drmar commented Mar 24, 2020

@Calinou Thanks for the info!

@Calinou Calinou changed the title Buttons disappear on window resize Buttons disappear on window resize due to font oversampling Mar 17, 2021
Calinou added a commit to Calinou/godot that referenced this issue Aug 22, 2021
The minimum window size can still be set to `Vector2(0, 0)` in a script
if needed.

This closes godotengine#37242.
@akien-mga akien-mga added this to the 4.0 milestone Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants