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

Add MSDF and mipmap generation project settings for the default font #60513

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 25, 2022

This can be used to improve Label3D and scaled Control appearance in prototypes.

This can be used to improve Label3D and scaled Control appearance
in prototypes.
@Calinou Calinou requested review from a team as code owners April 25, 2022 14:48
@Calinou Calinou requested a review from bruvzg April 25, 2022 14:48
@Calinou Calinou added this to the 4.0 milestone Apr 25, 2022
@fire
Copy link
Member

fire commented Apr 25, 2022

I wonder if MSDF can be defaulted on. I forget if mimaps are also able to be used or if it was exclusive.

@Calinou
Copy link
Member Author

Calinou commented Apr 25, 2022

I wonder if MSDF can be defaulted on.

Defaulting to MSDF can be problematic for lower-end devices, as it's not that cheap to render on the GPU. Generating MSDF glyphs also takes a while, so there can be stuttering during gameplay when a character is rendered for the first time. In fact, it might be a good idea to prerender the ASCII range of the default font when the MSDF setting is enabled.

MSDF fonts also tend to look worse at small sizes since they don't make use of hinting during the rendering process.

I forget if mimaps are also able to be used or if it was exclusive.

Mipmaps and MSDF can be used at the same time, as explained in the class reference. It's not essential, but it tends make downscaled fonts look a bit smoother. This can be good for Label3D when the camera moves.

I wouldn't enable mipmaps by default though, as it wastes memory (and mipmap generation time) if fonts are never rendered in a downscaled manner.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say, if MSDF is enabled, it should always pre-render Basic Latin and Alphabetic Presentation Forms (only a few common Latin ligatures, like ffi).

Also, it's probably better to have an extra option to enable the pre-rendering of other glyphs (for the default font it can be just three bitflags to select):

  • Extended Latin (Latin-1 Supplement, Latin Extended-A and a few chars from Latin Extended-B / Latin Extended Additional blocks).
  • Greek and Coptic.
  • Cyrillic (Cyrillic and Cyrillic Supplement blocks).

@akien-mga akien-mga merged commit e9e2aaf into godotengine:master Apr 26, 2022
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

4 participants