summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2023-02-08 18:29:26 +0100
committerGitHub <noreply@github.com>2023-02-08 18:29:26 +0100
commitccd4caa3de9e89376f339aa76219941d1c83a482 (patch)
tree96d7f800b1e4ecf28f7bcf25111456884cd55bc1
parentc4fb119f03477ad9a494ba6cdad211b35a8efcce (diff)
parent504ca3940cf058a6ad2ad2094e812ef26196da5e (diff)
Merge pull request #72887 from bruvzg/bmp_count
[Bitmap Font] Fix character count check.
-rw-r--r--editor/import/resource_importer_imagefont.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/editor/import/resource_importer_imagefont.cpp b/editor/import/resource_importer_imagefont.cpp
index a3f595ddfc..e6ba84294a 100644
--- a/editor/import/resource_importer_imagefont.cpp
+++ b/editor/import/resource_importer_imagefont.cpp
@@ -147,6 +147,7 @@ Error ResourceImporterImageFont::import(const String &p_source_file, const Strin
continue;
}
for (int32_t idx = start; idx <= end; idx++) {
+ ERR_FAIL_COND_V_MSG(pos >= count, ERR_CANT_CREATE, "Too many characters in range, should be " + itos(columns * rows));
int x = pos % columns;
int y = pos / columns;
font->set_glyph_advance(0, chr_height, idx, Vector2(chr_width, 0));
@@ -155,7 +156,6 @@ Error ResourceImporterImageFont::import(const String &p_source_file, const Strin
font->set_glyph_uv_rect(0, Vector2i(chr_height, 0), idx, Rect2(img_margin.position.x + chr_cell_width * x + char_margin.position.x, img_margin.position.y + chr_cell_height * y + char_margin.position.y, chr_width, chr_height));
font->set_glyph_texture_idx(0, Vector2i(chr_height, 0), idx, 0);
pos++;
- ERR_FAIL_COND_V_MSG(pos >= count, ERR_CANT_CREATE, "Too many characters in range, should be " + itos(columns * rows));
}
}
font->set_cache_ascent(0, chr_height, 0.5 * chr_height);