[Text Server] Add support for user defined punctuation list, used for word breaking.
This commit is contained in:
parent
928c002f22
commit
daa613333e
13 changed files with 165 additions and 12 deletions
|
|
@ -38,6 +38,11 @@ void TextParagraph::_bind_methods() {
|
|||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "direction", PROPERTY_HINT_ENUM, "Auto,Light-to-right,Right-to-left"), "set_direction", "get_direction");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_custom_punctuation", "custom_punctuation"), &TextParagraph::set_custom_punctuation);
|
||||
ClassDB::bind_method(D_METHOD("get_custom_punctuation"), &TextParagraph::get_custom_punctuation);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "custom_punctuation"), "set_custom_punctuation", "get_custom_punctuation");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_orientation", "orientation"), &TextParagraph::set_orientation);
|
||||
ClassDB::bind_method(D_METHOD("get_orientation"), &TextParagraph::get_orientation);
|
||||
|
||||
|
|
@ -304,6 +309,15 @@ TextServer::Direction TextParagraph::get_direction() const {
|
|||
return TS->shaped_text_get_direction(rid);
|
||||
}
|
||||
|
||||
void TextParagraph::set_custom_punctuation(const String &p_punct) {
|
||||
TS->shaped_text_set_custom_punctuation(rid, p_punct);
|
||||
lines_dirty = true;
|
||||
}
|
||||
|
||||
String TextParagraph::get_custom_punctuation() const {
|
||||
return TS->shaped_text_get_custom_punctuation(rid);
|
||||
}
|
||||
|
||||
void TextParagraph::set_orientation(TextServer::Orientation p_orientation) {
|
||||
TS->shaped_text_set_orientation(rid, p_orientation);
|
||||
TS->shaped_text_set_orientation(dropcap_rid, p_orientation);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ public:
|
|||
|
||||
void set_bidi_override(const Array &p_override);
|
||||
|
||||
void set_custom_punctuation(const String &p_punct);
|
||||
String get_custom_punctuation() const;
|
||||
|
||||
bool set_dropcap(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Rect2 &p_dropcap_margins = Rect2(), const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "");
|
||||
void clear_dropcap();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue