Replies: 3 comments
-
There already is, see Bitmap Fonts, it doesn't just support bitmap fonts To make this easier we also have: |
Beta Was this translation helpful? Give feedback.
-
As far as I know, non-monospace fonts are supported in general. It's just that the importer is limited to monospace fonts. But you can use a tool script to generate and save a font resource in the editor, which you can later use in your game. |
Beta Was this translation helpful? Give feedback.
-
As the documentation linked above mentions, non-monospace bitmap fonts are supported but you need to use BMFont to generate them. Image-based font importing is limited to monospace bitmap fonts. godotengine/godot#105543 could make it possible to import non-monospace bitmap fonts with an image, but it would require a lot of manual setup. Perhaps a different solution (e.g. based on colored pixels in certain corners of each glyph) would be better for this use case. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the only kind of bitmap font that can be used is monospaced, and that can be quite limiting for pixel games when they DON'T want to use monospaced fonts. Using .ttf/.otf files for pixel fonts isn't great either, specially if the game runs in a low viewport resolution, because Godot tries to apply anti aliasing and subpixel rendering to the font, and it can be quite annoying to tweak the import settings to make it work properly on pixel games. That's why using bitmap fonts is the recommended approach, but currently there's only support for monospaced.
For non-monospaced fonts, the solution is quite simple: Assign a position and size for each character on a texture, very similar to how a Atlas Texture works, except it assigns each quad to a specific character. And when it comes to drawing, just append the character sprite next to each other. Maybe even add some additional parameters like spacing and scaling.
This is my approach to implementing this feature, and that's also how GameMaker does it, but if anyone knows a better way for implementing this, that's okay, as long as it supports characters with different sizes (in other words, non-monospaced).
EDIT: Sorry, I just found out that there is a way of changing the character spacing for each character. However the texture for the characters still have to be monospaced for Godot to load it properly.
Beta Was this translation helpful? Give feedback.
All reactions