How ph4zel/persiantextedit works
This project is a Godot Engine plugin designed to enhance text editing capabilities in Persian by adding custom nodes (PersianTextEdit, PersianLabel, and PersianButton) along with additional resources like custom fonts, styles, and supporting scenes. The asset’s purpose is clearly defined in the README and is supported by the file structure, which adheres to Godot’s plugin conventions.
Main Components
• Godot Engine: The runtime environment in which the plugin operates.
• Plugin Loader/Manager: Represented by the “plugin.cfg” and the project settings that load the plugin.
• Plugin Core ("PersianTextEdit"): Contains all the custom nodes and scripts.
• Nodes:
• PersianTextEdit: Custom text editing node with signal (text_chaged) and logic for Persian text processing.
• PersianLabel: Displays Persian text with additional options (like right-to-left text formatting and reloading behavior).
• PersianButton: Custom button node inheriting functionality from PersianLabel.
• Supporting Resources:
• Scripts: All the custom GDscript files (CustomTextEdit.gd, Persian.gd, PersianButton.gd, etc.) implementing behaviors.
• Child Scenes: Under the “Childs” directory are scene files like RichTextLabel.tscn and TextEdit.tscn which serve as templates or extended controls.
• Fonts and Styles: Resources in the “Fonts” and “Style” folders which provide configurations for the asset’s visual appearance.
• Example Scene: A demonstration (Example.tscn) showing an implementation of the plugin.
Relationships and Interactions
• The Godot Engine initializes the project and reads the “project.godot” and “default_env.tres” configurations.
• The Plugin Manager in the engine triggers the loading of “plugin.cfg” found in the addons/PersianTextEdit folder.
• Upon activation, the custom nodes (PersianTextEdit, PersianLabel, PersianButton) become available in the Node creation list.
• When a developer adds one of these nodes to a scene, the associated scripts (located in the Scripts folder) are invoked to handle behavior such as text input processing, RTL (right-to-left) formatting, and signal emission.
• The Childs subdirectory provides alternative or customizable scene templates that can be used to alter the default behavior or appearance.
• Fonts and Style resources are loaded dynamically by the nodes based on settings, ensuring the Persian text is rendered correctly.