summaryrefslogtreecommitdiff
path: root/editor/editor_properties.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-11-28 09:03:15 +0100
committerGitHub <noreply@github.com>2020-11-28 09:03:15 +0100
commita6751e6c58e73d6b8d04e98bba5fb6e380fdf34f (patch)
treebf22de8b8d89dee6a3b59c22adacff8f62a8d5eb /editor/editor_properties.cpp
parentbd846001327dacd35a84b0759f8b7ca8b892e841 (diff)
parent7e2c0ffd1a19d5806a7fcf57e25d2465f7a8f8b6 (diff)
Merge pull request #41100 from bruvzg/ctl_text_server_interface
[Complex Text Layouts] Implement TextServer interface.
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r--editor/editor_properties.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 1443302f3f..2c4e403a81 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -36,7 +36,7 @@
#include "editor_properties_array_dict.h"
#include "editor_scale.h"
#include "scene/main/window.h"
-#include "scene/resources/dynamic_font.h"
+#include "scene/resources/font.h"
///////////////////// NULL /////////////////////////
@@ -146,7 +146,8 @@ void EditorPropertyMultilineText::_notification(int p_what) {
Ref<Texture2D> df = get_theme_icon("DistractionFree", "EditorIcons");
open_big_text->set_icon(df);
Ref<Font> font = get_theme_font("font", "Label");
- text->set_custom_minimum_size(Vector2(0, font->get_height() * 6));
+ int font_size = get_theme_font_size("font_size", "Label");
+ text->set_custom_minimum_size(Vector2(0, font->get_height(font_size) * 6));
} break;
}
@@ -290,6 +291,7 @@ EditorPropertyPath::EditorPropertyPath() {
HBoxContainer *path_hb = memnew(HBoxContainer);
add_child(path_hb);
path = memnew(LineEdit);
+ path->set_structured_text_bidi_override(Control::STRUCTURED_TEXT_FILE);
path_hb->add_child(path);
path->connect("text_entered", callable_mp(this, &EditorPropertyPath::_path_selected));
path->connect("focus_exited", callable_mp(this, &EditorPropertyPath::_path_focus_exited));
@@ -587,7 +589,8 @@ public:
virtual Size2 get_minimum_size() const override {
Ref<Font> font = get_theme_font("font", "Label");
- return Vector2(0, font->get_height() * 2);
+ int font_size = get_theme_font_size("font_size", "Label");
+ return Vector2(0, font->get_height(font_size) * 2);
}
virtual String get_tooltip(const Point2 &p_pos) const override {
@@ -985,6 +988,7 @@ void EditorPropertyEasing::_draw_easing() {
const float exp = get_edited_object()->get(get_edited_property());
const Ref<Font> f = get_theme_font("font", "Label");
+ int font_size = get_theme_font_size("font_size", "Label");
const Color font_color = get_theme_color("font_color", "Label");
Color line_color;
if (dragging) {
@@ -1022,7 +1026,7 @@ void EditorPropertyEasing::_draw_easing() {
} else {
decimals = 1;
}
- f->draw(ci, Point2(10, 10 + f->get_ascent()), rtos(exp).pad_decimals(decimals), font_color);
+ f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), TS->format_number(rtos(exp).pad_decimals(decimals)), HALIGN_LEFT, -1, font_size, font_color);
}
void EditorPropertyEasing::update_property() {
@@ -1039,7 +1043,7 @@ void EditorPropertyEasing::_set_preset(int p_preset) {
void EditorPropertyEasing::_setup_spin() {
setting = true;
spin->setup_and_show();
- spin->get_line_edit()->set_text(rtos(get_edited_object()->get(get_edited_property())));
+ spin->get_line_edit()->set_text(TS->format_number(rtos(get_edited_object()->get(get_edited_property()))));
setting = false;
spin->show();
}
@@ -1088,7 +1092,7 @@ void EditorPropertyEasing::_notification(int p_what) {
preset->add_icon_item(get_theme_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT);
preset->add_icon_item(get_theme_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN);
}
- easing_draw->set_custom_minimum_size(Size2(0, get_theme_font("font", "Label")->get_height() * 2));
+ easing_draw->set_custom_minimum_size(Size2(0, get_theme_font("font", "Label")->get_height(get_theme_font_size("font_size", "Label")) * 2));
} break;
}
}
@@ -3016,7 +3020,7 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const
} else if (at == "ShaderMaterial") {
allowed_types.append("Shader");
} else if (at == "Font") {
- allowed_types.append("DynamicFontData");
+ allowed_types.append("FontData");
}
}
@@ -3115,9 +3119,9 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
break;
}
- if (at == "Font" && ClassDB::is_parent_class(res->get_class(), "DynamicFontData")) {
- Ref<DynamicFont> font = memnew(DynamicFont);
- font->set_font_data(res);
+ if (at == "Font" && ClassDB::is_parent_class(res->get_class(), "FontData")) {
+ Ref<Font> font = memnew(Font);
+ font->add_data(res);
res = font;
break;
}