Repository: godotengine/godot
File: editor/plugins/text_control_editor_plugin.cpp (C++)

Code before:
		ur->add_undo_method(edited_control, "remove_theme_color_override", edited_color);
	}

	ur->add_do_method(this, "_update_control");
	ur->add_undo_method(this, "_update_control");

	ur->commit_action();
}

void TextControlEditor::_outline_color_changed(const Color &p_color) {
	if (!edited_control) {
		return;
	}

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Set Font Outline Color"), UndoRedo::MERGE_ENDS);

	ur->add_do_method(edited_control, "add_theme_color_override", "font_outline_color", p_color);
	if (edited_control->has_theme_color_override("font_outline_color")) {
		ur->add_undo_method(edited_control, "add_theme_color_override", "font_outline_color", edited_control->get_theme_color("font_outline_color"));
	} else {
		ur->add_undo_method(edited_control, "remove_theme_color_override", "font_outline_color");
	}

	ur->add_do_method(this, "_update_control");
	ur->add_undo_method(this, "_update_control");

	ur->commit_action();
}

void TextControlEditor::_clear_formatting() {
	if (!edited_control) {
		return;
	}

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Clear Control Formatting"));

	ur->add_do_method(edited_control, "begin_bulk_theme_override");
	ur->add_undo_method(edited_control, "begin_bulk_theme_override");

	ur->add_do_method(edited_control, "remove_theme_font_override", edited_font);
	if (edited_control->has_theme_font_override(edited_font)) {
		ur->add_undo_method(edited_control, "add_theme_font_override", edited_font, edited_control->get_theme_font(edited_font));
	}

	ur->add_do_method(edited_control, "remove_theme_font_size_override", edited_font_size);
	if (edited_control->has_theme_font_size_override(edited_font_size)) {
		ur->add_undo_method(edited_control, "add_theme_font_size_override", edited_font_size, edited_control->get_theme_font_size(edited_font_size));
	}


Review comment (suggestion):
```suggestion
					ur->add_do_method(edited_control, SNAME("add_theme_font_override"), edited_font, font);
```
etc. for other string literals passed when `StringName` is expected.

Code after:
			edited_font = "normal_font";
		} else {
			edited_font = "font";
		}

		if (font_list->get_selected_id() == FONT_INFO_THEME_DEFAULT) {
			// Remove font override.
			ur->add_do_method(edited_control, "remove_theme_font_override", edited_font);
		} else if (font_list->get_selected_id() == FONT_INFO_USER_CUSTOM) {
			// Restore "custom_font".
			ur->add_do_method(edited_control, "add_theme_font_override", edited_font, custom_font);
		} else {
			// Load new font resource using selected name and style.
			String name = font_list->get_item_text(font_list->get_selected());
			String style = font_style_list->get_item_text(font_style_list->get_selected());
			if (style.is_empty()) {
				style = "Default";
			}

			if (fonts.has(name)) {
				Ref<FontData> fd = ResourceLoader::load(fonts[name][style]);
				if (fd.is_valid()) {
					Ref<Font> font;
					font.instantiate();
					font->add_data(fd);
					ur->add_do_method(edited_control, "add_theme_font_override", edited_font, font);
				}
			}
		}

		if (edited_control->has_theme_font_override(edited_font)) {
			ur->add_undo_method(edited_control, "add_theme_font_override", edited_font, edited_control->get_theme_font(edited_font));
		} else {
			ur->add_undo_method(edited_control, "remove_theme_font_override", edited_font);
		}
	}

	ur->add_do_method(this, "_update_control");
	ur->add_undo_method(this, "_update_control");

	ur->commit_action();
}

void TextControlEditor::_font_size_selected(double p_size) {
	if (edited_controls.is_empty()) {
		return;
	}

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Set Font Size"));