summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--editor/import/resource_importer_imagefont.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/editor/import/resource_importer_imagefont.cpp b/editor/import/resource_importer_imagefont.cpp
index 0c87176a13..22223bda94 100644
--- a/editor/import/resource_importer_imagefont.cpp
+++ b/editor/import/resource_importer_imagefont.cpp
@@ -291,10 +291,29 @@ Error ResourceImporterImageFont::import(const String &p_source_file, const Strin
WARN_PRINT(vformat("Invalid kerning pairs string: \"%s\"", kp));
continue;
}
+ String from_tokens;
+ for (int i = 0; i < kp_tokens[0].length(); i++) {
+ if (i <= kp_tokens[0].length() - 6 && kp_tokens[0][i] == '\\' && kp_tokens[0][i + 1] == 'u') {
+ char32_t charcode = kp_tokens[0].substr(i + 2, 4).hex_to_int();
+ from_tokens += charcode;
+ } else {
+ from_tokens += kp_tokens[0][i];
+ }
+ }
+ String to_tokens;
+ for (int i = 0; i < kp_tokens[1].length(); i++) {
+ if (i <= kp_tokens[1].length() - 6 && kp_tokens[1][i] == '\\' && kp_tokens[1][i + 1] == 'u') {
+ char32_t charcode = kp_tokens[1].substr(i + 2, 4).hex_to_int();
+ to_tokens += charcode;
+ } else {
+ to_tokens += kp_tokens[1][i];
+ }
+ }
int offset = kp_tokens[2].to_int();
- for (int a = 0; a < kp_tokens[0].length(); a++) {
- for (int b = 0; b < kp_tokens[1].length(); b++) {
- font->set_kerning(0, chr_height, Vector2i(kp_tokens[0].unicode_at(a), kp_tokens[1].unicode_at(b)), Vector2(offset, 0));
+
+ for (int a = 0; a < from_tokens.length(); a++) {
+ for (int b = 0; b < to_tokens.length(); b++) {
+ font->set_kerning(0, chr_height, Vector2i(from_tokens.unicode_at(a), to_tokens.unicode_at(b)), Vector2(offset, 0));
}
}
}