diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-14 11:12:17 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-14 11:12:17 +0100 |
commit | 33e65f275444744b0e346be19c94674788803f05 (patch) | |
tree | 7d221d4c3290f0d698344f3d2ae2efd550966e3e /scene/resources | |
parent | 19f21e2434728d5bc60509b780dd2e7d667a0e79 (diff) | |
parent | 01b4e53e8056cc42f1f918c9362b7c50be2d2219 (diff) |
Merge pull request #68582 from bruvzg/inv_gd3_bmp_font
Add a special case for importing bitmap fonts designed for Godot 3.
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/font.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 185b6f4bdc..79ca87e9d6 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -1788,7 +1788,10 @@ Error FontFile::load_bitmap_font(const String &p_path) { ERR_FAIL_V_MSG(ERR_CANT_CREATE, RTR("Unsupported BMFont texture format.")); } } else { - if ((ch[0] == 0) && (ch[1] == 0) && (ch[2] == 0) && (ch[3] == 0)) { // RGBA8 color, no outline + if ((ch[3] == 0) && (ch[0] == 4) && (ch[1] == 4) && (ch[2] == 4) && img->get_format() == Image::FORMAT_RGBA8) { // might be RGBA8 color, no outline (color part of the image should be sold white, but some apps designed for Godot 3 generate color fonts with this config) + outline = 0; + set_texture_image(0, Vector2i(base_size, 0), page, img); + } else if ((ch[0] == 0) && (ch[1] == 0) && (ch[2] == 0) && (ch[3] == 0)) { // RGBA8 color, no outline outline = 0; ERR_FAIL_COND_V_MSG(img->get_format() != Image::FORMAT_RGBA8, ERR_FILE_CANT_READ, RTR("Unsupported BMFont texture format.")); set_texture_image(0, Vector2i(base_size, 0), page, img); |