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

How to organize font oversampling for scaled control? #21797

Closed
R3D9477 opened this issue Sep 6, 2018 · 12 comments
Closed

How to organize font oversampling for scaled control? #21797

R3D9477 opened this issue Sep 6, 2018 · 12 comments
Labels

Comments

@R3D9477
Copy link

R3D9477 commented Sep 6, 2018

Hi. Is it possible to organize font oversampling for scaled control?
Stretch Mode is Disabled and Use Oversampling is Checked.

Now font doesn't changes:
1
2

Thanks.

@Calinou
Copy link
Member

Calinou commented Sep 6, 2018

Font oversampling uses a global scale factor (determined by window size when using the 2d stretch mode), whereas Control scaling is local by definition — it can be applied to specific controls, each with their individual scale property. Therefore, I doubt it is possible.

@R3D9477
Copy link
Author

R3D9477 commented Sep 6, 2018

@Calinou if I'll try to handle "resize" event of control to change size (if it possible in Godot) of dynamic font - will it be a good and possible solution?

@Calinou
Copy link
Member

Calinou commented Sep 6, 2018

@r3d9u11 I don't think that would work, since the DynamicFont will not be aware of the Control's scale. Besides, the same DynamicFont resource can be used in different Controls, each of them using their own scaling value — what would be done in this case?

@R3D9477
Copy link
Author

R3D9477 commented Sep 7, 2018

@Calinouin that case font size will be automatically changed for all similar controls, and controls, who uses another scaling value also should use also other dynamic font, I think.

But as I see, currently Godot conception doesn't allow to change font size on the fly.
As workaround I should to make separated scenes and themes for each needed display resolution.

Am I to understand that correctly?

@Calinou
Copy link
Member

Calinou commented Sep 7, 2018

As workaround I should to make separated scenes and themes for each needed display resolution.

You don't have to, just use the 2d stretch mode as explained in Multiple resolutions. If the automatically-applied scale is too large (or too small) for a specific display, you'll have to wait for this pull request to be merged to be able to customize the scale.

@R3D9477
Copy link
Author

R3D9477 commented Sep 7, 2018

@Calinou Yep, it is a good and fast solution, and game scene looks nice. But I trying to escape it globally.

I tried to use game scene in the fullscreen mode: Stretch Mode: 2D, Aspect: Ignore.
Game scene looks nice, but popup menu and buttons looks ugly, because its proportions are violated.

Or if I use Stretch Mode: 2D, Aspect: keep the popup menu and main menu with controls are looks nice, but game scene will not stretched to the full screen (black bars will be displayed because it will save proportions for the game scene, too).

Finally I want to stretch game scene to the full screen, but popup menu I want stretch to current desktop resolution and save proportions (and place it to the cetnter of the screen).

I read some posts about multiresolution theme:
https://godotengine.org/qa/9947/responsive-to-fit-multiple-resolutions
https://godotengine.org/qa/1084/resolution-strech-mode-2d-vs-viewport
https://www.reddit.com/r/godot/comments/48dfzm/good_methods_for_handling_different_aspect_ratios/
I think that current standard stretching is not a good stuff for me, I'm looking for more smart way (stretching (with different stretching mode for different nodes) + usage of textures with different resolution for sprites/backgrounds and changing size of font on the fly).

@R3D9477
Copy link
Author

R3D9477 commented Sep 7, 2018

@Calinou well, I found a similar issue, but solution with "scale" property looks bit ugly :-|

Original size:
1
Scaled via Stratch-Mode: 2D + Font Oversampling (font looks nice)
2
Scaled via property "Rect_Scale" + Font Oversampling (font looks ugly)
3
Why font oversampling doesn't work with scaled control? (when Stretching is disabled)

Well, for the controls and labels I see one solution: use anchors + manually Import font for each screen resolution.

@Calinou
Copy link
Member

Calinou commented Sep 7, 2018

@r3d9u11 To support multiple aspect ratios without distortion or black bars, use the expand stretch aspect property instead of ignore or keep (it was added in 3.0).

@R3D9477
Copy link
Author

R3D9477 commented Sep 7, 2018

@Calinou sorry, Yes, I used mode "expand" to keep proportions. But I want to use stretch behavior for different nodes. Shortly: I want to stretch background to full screen (and distort proportions), but in that time I want to stretch controls and save its proportions.

Currently with global flag "Stretch" it is not possible. I should to implement this logic manually.

@Calinou
Copy link
Member

Calinou commented Sep 7, 2018

Currently with global flag "Stretch" it is not possible. I should to implement this logic manually.

Have you tried setting a TextureRect's anchor to Full Rect (while making sure the root Control node is also anchored as Full Rect)? This should make it cover the whole screen regardless of its aspect ratio.

@R3D9477
Copy link
Author

R3D9477 commented Sep 11, 2018

@Calinou thanks for hint! I'll check this solution soon.

@R3D9477
Copy link
Author

R3D9477 commented Sep 14, 2018

@Calinou many-many thanks!!! I should to use "Node/Node2D" as a Root node + Layout/Anchors settings for controls + Stretch:2d/Expand for project. Works fine and looks nice with different resolutions 😊

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

No branches or pull requests

3 participants