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 Import] Detect pixel fonts and disable subpixel positioning. #94609

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jul 22, 2024

Should prevent issues like #94591 (and previous similar issues).

There's no 100% reliable way to detect pixel fonts, this PR checks if every glyph contours contain only straight horizontal and vertical lines in attempt to detect it.

@bruvzg bruvzg added this to the 4.x milestone Jul 22, 2024
@bruvzg bruvzg requested review from a team as code owners July 22, 2024 07:16
@bruvzg bruvzg force-pushed the pixel_font_detect branch from b354f8c to 719e699 Compare July 22, 2024 13:02
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected.

Testing project: test_pr_94609.zip

Fonts detected as pixel art within the project:

Font file Is pixel art?
bedstead-condensed Non-pixel
bedstead-extended Non-pixel
bedstead-extracondensed Non-pixel
bedstead-semicondensed Non-pixel
bedstead-ultracondensed Non-pixel
CommitMono-400-Italic Non-pixel
CommitMono-400-Regular Non-pixel
CommitMono-700-Italic Non-pixel
CommitMono-700-Regular Non-pixel
Kenney Pixel Square Pixel
Kenney Pixel Pixel
PixelOperator Pixel
PixelOperator-Bold Pixel
PixelOperator8 Pixel
PixelOperator8-Bold Pixel
PixelOperatorHB Pixel
PixelOperatorHB8 Pixel
PixelOperatorHBSC Pixel
PixelOperatorMono Pixel
PixelOperatorMono-Bold Pixel
PixelOperatorMono8 Pixel
PixelOperatorMono8-Bold Pixel
PixelOperatorMonoHB Pixel
PixelOperatorMonoHB8 Pixel
PixelOperatorSC Pixel
PixelOperatorSC-Bold Pixel
TerminusTTF-4.49.3 Pixel
TerminusTTF-Bold-4.49.3 Pixel
TerminusTTF-Bold-Italic-4.49.3 Pixel
TerminusTTF-Italic-4.49.3 Pixel
spleen-12x24 Pixel
spleen-16x32 Pixel
spleen-32x64 Pixel
spleen-6x12 Pixel
spleen-8x16 Pixel
terminal-grotesque Pixel

All detections are OK.

@bruvzg bruvzg force-pushed the pixel_font_detect branch from 719e699 to 32bc1c2 Compare July 23, 2024 17:35
@akien-mga akien-mga merged commit 7865266 into godotengine:master Aug 16, 2024
18 checks passed
@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.

5 participants