You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
[Android] Skip non-existing system font files.
This commit is contained in:
@@ -454,6 +454,9 @@ void OS_Android::_load_system_font_config() const {
|
|||||||
Ref<XMLParser> parser;
|
Ref<XMLParser> parser;
|
||||||
parser.instantiate();
|
parser.instantiate();
|
||||||
|
|
||||||
|
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||||
|
String root = String(getenv("ANDROID_ROOT")).path_join("fonts");
|
||||||
|
|
||||||
Error err = parser->open(String(getenv("ANDROID_ROOT")).path_join("/etc/fonts.xml"));
|
Error err = parser->open(String(getenv("ANDROID_ROOT")).path_join("/etc/fonts.xml"));
|
||||||
if (err == OK) {
|
if (err == OK) {
|
||||||
bool in_font_node = false;
|
bool in_font_node = false;
|
||||||
@@ -530,6 +533,7 @@ void OS_Android::_load_system_font_config() const {
|
|||||||
if (in_font_node) {
|
if (in_font_node) {
|
||||||
fi.filename = parser->get_node_data().strip_edges();
|
fi.filename = parser->get_node_data().strip_edges();
|
||||||
fi.font_name = fn;
|
fi.font_name = fn;
|
||||||
|
if (da->file_exists(root.path_join(fi.filename))) {
|
||||||
if (!fb.is_empty() && fn.is_empty()) {
|
if (!fb.is_empty() && fn.is_empty()) {
|
||||||
fi.font_name = fb;
|
fi.font_name = fb;
|
||||||
fi.priority = 2;
|
fi.priority = 2;
|
||||||
@@ -546,6 +550,7 @@ void OS_Android::_load_system_font_config() const {
|
|||||||
font_names.insert(fi.font_name);
|
font_names.insert(fi.font_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END) {
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END) {
|
||||||
in_font_node = false;
|
in_font_node = false;
|
||||||
if (parser->get_node_name() == "font") {
|
if (parser->get_node_name() == "font") {
|
||||||
|
|||||||
Reference in New Issue
Block a user