summaryrefslogtreecommitdiff
path: root/scene/gui/rich_text_label.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-25 23:17:59 +0200
committerGitHub <noreply@github.com>2019-10-25 23:17:59 +0200
commitc39238c7d2da1a65edd2b082984902bb0a5545fc (patch)
treef8fb1f9d4d9019fdc65a50d4d043f2be0f5426c5 /scene/gui/rich_text_label.cpp
parentc43c3747cfbb21385c09e887d93f6808f9a5bc6d (diff)
parent47000f88603e493e1d4083b7d9a7ea354f91f3cd (diff)
Merge pull request #32870 from bergmannf/27850_rtl_bold_italic
Add push_* methods for fonts in rich_text_label
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
-rw-r--r--scene/gui/rich_text_label.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 8c19255fd0..0331046492 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1721,6 +1721,41 @@ void RichTextLabel::push_font(const Ref<Font> &p_font) {
_add_item(item, true);
}
+void RichTextLabel::push_normal() {
+ Ref<Font> normal_font = get_font("normal_font");
+ ERR_FAIL_COND(normal_font.is_null());
+
+ push_font(normal_font);
+}
+
+void RichTextLabel::push_bold() {
+ Ref<Font> bold_font = get_font("bold_font");
+ ERR_FAIL_COND(bold_font.is_null());
+
+ push_font(bold_font);
+}
+
+void RichTextLabel::push_bold_italics() {
+ Ref<Font> bold_italics_font = get_font("bold_italics_font");
+ ERR_FAIL_COND(bold_italics_font.is_null());
+
+ push_font(bold_italics_font);
+}
+
+void RichTextLabel::push_italics() {
+ Ref<Font> italics_font = get_font("italics_font");
+ ERR_FAIL_COND(italics_font.is_null());
+
+ push_font(italics_font);
+}
+
+void RichTextLabel::push_mono() {
+ Ref<Font> mono_font = get_font("mono_font");
+ ERR_FAIL_COND(mono_font.is_null());
+
+ push_font(mono_font);
+}
+
void RichTextLabel::push_color(const Color &p_color) {
ERR_FAIL_COND(current->type == ITEM_TABLE);
@@ -2636,6 +2671,11 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("newline"), &RichTextLabel::add_newline);
ClassDB::bind_method(D_METHOD("remove_line", "line"), &RichTextLabel::remove_line);
ClassDB::bind_method(D_METHOD("push_font", "font"), &RichTextLabel::push_font);
+ ClassDB::bind_method(D_METHOD("push_normal"), &RichTextLabel::push_normal);
+ ClassDB::bind_method(D_METHOD("push_bold"), &RichTextLabel::push_bold);
+ ClassDB::bind_method(D_METHOD("push_bold_italics"), &RichTextLabel::push_bold_italics);
+ ClassDB::bind_method(D_METHOD("push_italics"), &RichTextLabel::push_italics);
+ ClassDB::bind_method(D_METHOD("push_mono"), &RichTextLabel::push_mono);
ClassDB::bind_method(D_METHOD("push_color", "color"), &RichTextLabel::push_color);
ClassDB::bind_method(D_METHOD("push_align", "align"), &RichTextLabel::push_align);
ClassDB::bind_method(D_METHOD("push_indent", "level"), &RichTextLabel::push_indent);