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

BMFont ignores draw while font less 2 pixels #90339

Closed
sky94520 opened this issue Apr 7, 2024 · 4 comments · Fixed by #90349
Closed

BMFont ignores draw while font less 2 pixels #90339

sky94520 opened this issue Apr 7, 2024 · 4 comments · Fixed by #90349
Assignees
Milestone

Comments

@sky94520
Copy link

sky94520 commented Apr 7, 2024

Tested versions

Godot 4.3dev4

System information

Mac OS 14.3 - Godot4.3dev4 - Vulkan (Forward+)

Issue description

I use Pixel fonts to generate BMFont and use it in Godot, but I found it exists issue for those chars such as,.-'", and I found those chars all less 2 pixels.

for example, I input the following string to Label:

-+123456789.!`Ii,."

the UI is as follows:
image

Steps to reproduce

  1. Download fusion-pixel-font-10px-monospaced-ttf-v2024.04.05.zip, extracting the zip.
  2. Download fontbm, move usion-pixel-font-10px-monospaced-ttf-v2024.04.05/fusion-pixel-10px-monospaced-zh_hans.ttf to fontbm root directory, compile the source code and execute the following command to generate BM font.
./fontbm --font-file fusion-pixel-10px-monospaced-zh_hans.ttf --font-size 10 --output damage-number

then move damage-number.fnt and damage-number_0.png to Godot project.
3. Create a Label, and set Theme Overrides->Fonts using damage-number.fnt.
4. Input the following string -+123456789.!`Ii,.".

Minimal reproduction project (MRP)

TestBMFont.zip

@bruvzg
Copy link
Member

bruvzg commented Apr 7, 2024

Should be fixed by #90349, for previous version in should be fixable by adding 1px padding on each side (usually adding padding is a good idea, since packing glyphs without it will not work well with texture filtering).

@sky94520 sky94520 closed this as completed Apr 8, 2024
@sky94520
Copy link
Author

sky94520 commented Apr 8, 2024

Hi @bruvzg I do add padding, I use the command to generate a new font file, but it is same as before.

./fontbm --font-file fusion-pixel-10px-monospaced-zh_hans.ttf --font-size 10 --output damage-number --padding-left 1 --padding-right 1

@bruvzg
Copy link
Member

bruvzg commented Apr 8, 2024

I use the command to generate a new font file, but it is same as before.

Vertical padding should be set as well: --padding-up 1 --padding-down 1

@sky94520
Copy link
Author

sky94520 commented Apr 8, 2024

Thank you @bruvzg, I add --padding-left 1 --padding-right --padding-up 1 --padding-down 1 to regenerate font file, it is correct.
image

@akien-mga akien-mga added this to the 4.3 milestone Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants