summaryrefslogtreecommitdiffstats
path: root/scene/resources
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2024-08-14 23:52:19 +0300
committerRémi Verschelde <rverschelde@gmail.com>2024-09-16 16:35:06 +0200
commit79848620ce0850c9311fffbc8ea27729a5348292 (patch)
treec8b86776342eb484925bbc0ff3bcaab639dfb5dc /scene/resources
parent91ed3cd307ca2adb9eb875b346cf058dff0d50ed (diff)
downloadredot-engine-79848620ce0850c9311fffbc8ea27729a5348292.tar.gz
[BMFont] Fix importing fonts with `Match char height` enabled.
(cherry picked from commit e7f215c2c401944892501c158188301a09622842)
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/font.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 104187775d..6b65ea4cfb 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -1482,8 +1482,8 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
switch (block_type) {
case 1: /* info */ {
ERR_FAIL_COND_V_MSG(block_size < 15, ERR_CANT_CREATE, "Invalid BMFont info block size.");
- base_size = f->get_16();
- if (base_size <= 0) {
+ base_size = ABS(static_cast<int16_t>(f->get_16()));
+ if (base_size == 0) {
base_size = 16;
}
uint8_t flags = f->get_8();
@@ -1776,7 +1776,10 @@ Error FontFile::_load_bitmap_font(const String &p_path, List<String> *r_image_fi
if (type == "info") {
if (keys.has("size")) {
- base_size = keys["size"].to_int();
+ base_size = ABS(keys["size"].to_int());
+ if (base_size == 0) {
+ base_size = 16;
+ }
}
if (keys.has("outline")) {
outline = keys["outline"].to_int();