aboutsummaryrefslogtreecommitdiff
path: root/scene/resources/font.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2018-01-16 17:57:36 -0300
committerJuan Linietsky2018-01-16 17:58:04 -0300
commit4de84f4c0a53fdaf72e16715b77b8a93bc8f220a (patch)
tree39365cb18fabb1782dc48fad718d29c6fb4d0bf3 /scene/resources/font.cpp
parent1968cc445cc3f9dfaa96adc9671c025e0d7b743e (diff)
downloadgodot-4de84f4c0a53fdaf72e16715b77b8a93bc8f220a.tar.gz
godot-4de84f4c0a53fdaf72e16715b77b8a93bc8f220a.tar.zst
godot-4de84f4c0a53fdaf72e16715b77b8a93bc8f220a.zip
BMFont loading direct support from .fnt files.
Diffstat (limited to 'scene/resources/font.cpp')
-rw-r--r--scene/resources/font.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 026bcea27..6fc5778dd 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -596,3 +596,42 @@ BitmapFont::~BitmapFont() {
clear();
}
+
+////////////
+
+RES ResourceFormatLoaderBMFont::load(const String &p_path, const String &p_original_path, Error *r_error) {
+
+ if (r_error)
+ *r_error = ERR_FILE_CANT_OPEN;
+
+ Ref<BitmapFont> font;
+ font.instance();
+
+ Error err = font->create_from_fnt(p_path);
+
+ if (err) {
+ if (r_error)
+ *r_error = err;
+ return RES();
+ }
+
+ return font;
+}
+
+void ResourceFormatLoaderBMFont::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("fnt");
+}
+
+bool ResourceFormatLoaderBMFont::handles_type(const String &p_type) const {
+
+ return (p_type == "BitmapFont");
+}
+
+String ResourceFormatLoaderBMFont::get_resource_type(const String &p_path) const {
+
+ String el = p_path.get_extension().to_lower();
+ if (el == "fnt")
+ return "BitmapFont";
+ return "";
+}