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

Allow using WOFF fonts in DynamicFont #52052

Merged
merged 1 commit into from
Aug 25, 2021

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Aug 24, 2021

This is already supported by FreeType, but it wasn't exposed.

Adding support for WOFF2 would require linking a Brotli decompression library in Godot, so only WOFF1 is exposed here.

WOFF support is already exposed in master, so this PR is only relevant for 3.x. See discussion in godotengine/godot-docs#5194.

Preview

TTF font on the top, WOFF font on the bottom (with different modulation to distinguish it):

image
Font: Fork Awesome

The fonts render exactly the same, but the TTF file weighs 213 KB wheras the WOFF file weighs only 132 KB.

Testing project: woff.zip

@Calinou Calinou requested a review from a team as a code owner August 24, 2021 07:16
@Calinou Calinou added this to the 3.4 milestone Aug 24, 2021
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.

PostScript Type 1 fonts (.pfb, .pfm) should also work perfectly with existing code.

The rest of FreeType supported formats (X11 PCF, BCF, Windows FNT) can be loaded and rendered, but have issues with the font metrics and probably aren't worth supporting anyway.

@Calinou
Copy link
Member Author

Calinou commented Aug 25, 2021

PostScript Type 1 fonts (.pfb, .pfm) should also work perfectly with existing code.

I'm not sure how common these font formats are in the wild. I've never seen those personally 👀

Do these font formats have any upsides that other font formats don't? For instance, WOFF tends to be smaller than equivalent formats, which makes it useful for mobile and web games.

This is already supported by FreeType, but it wasn't exposed.

Adding support for WOFF2 would require linking a Brotli decompression
library in Godot, so only WOFF1 is exposed here.
@bruvzg
Copy link
Member

bruvzg commented Aug 25, 2021

I'm not sure how common these font formats are in the wild.

It's not common and have no upsides, it is a format from 1984, a bunch of old TeX and PostScript printer font are still out there. Adding extensions to the list cost nothing anyway, but doing anything extra definitely not worth it.

@Calinou Calinou merged commit f5e83e7 into godotengine:3.x Aug 25, 2021
@Calinou Calinou deleted the dynamicfont-allow-woff branch August 25, 2021 08:37
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.

3 participants