diff options
Diffstat (limited to 'modules/text_server_fb')
-rw-r--r-- | modules/text_server_fb/text_server_fb.cpp | 112 | ||||
-rw-r--r-- | modules/text_server_fb/text_server_fb.h | 4 |
2 files changed, 58 insertions, 58 deletions
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 5c06051211..97a53143cf 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -2247,7 +2247,7 @@ bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_te return true; } -bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) { +bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) { ShapedTextData *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2278,7 +2278,7 @@ bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, con return true; } -bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) { +bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) { ShapedTextData *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2346,56 +2346,56 @@ bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : sd->objects) { if ((E.value.pos >= sd->start) && (E.value.pos < sd->end)) { if (sd->orientation == ORIENTATION_HORIZONTAL) { - switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) { - case INLINE_ALIGN_TO_TOP: { + switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { + case INLINE_ALIGNMENT_TO_TOP: { E.value.rect.position.y = -sd->ascent; } break; - case INLINE_ALIGN_TO_CENTER: { + case INLINE_ALIGNMENT_TO_CENTER: { E.value.rect.position.y = (-sd->ascent + sd->descent) / 2; } break; - case INLINE_ALIGN_TO_BASELINE: { + case INLINE_ALIGNMENT_TO_BASELINE: { E.value.rect.position.y = 0; } break; - case INLINE_ALIGN_TO_BOTTOM: { + case INLINE_ALIGNMENT_TO_BOTTOM: { E.value.rect.position.y = sd->descent; } break; } - switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) { - case INLINE_ALIGN_BOTTOM_TO: { + switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { + case INLINE_ALIGNMENT_BOTTOM_TO: { E.value.rect.position.y -= E.value.rect.size.y; } break; - case INLINE_ALIGN_CENTER_TO: { + case INLINE_ALIGNMENT_CENTER_TO: { E.value.rect.position.y -= E.value.rect.size.y / 2; } break; - case INLINE_ALIGN_TOP_TO: { + case INLINE_ALIGNMENT_TOP_TO: { // NOP } break; } full_ascent = MAX(full_ascent, -E.value.rect.position.y); full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y); } else { - switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) { - case INLINE_ALIGN_TO_TOP: { + switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { + case INLINE_ALIGNMENT_TO_TOP: { E.value.rect.position.x = -sd->ascent; } break; - case INLINE_ALIGN_TO_CENTER: { + case INLINE_ALIGNMENT_TO_CENTER: { E.value.rect.position.x = (-sd->ascent + sd->descent) / 2; } break; - case INLINE_ALIGN_TO_BASELINE: { + case INLINE_ALIGNMENT_TO_BASELINE: { E.value.rect.position.x = 0; } break; - case INLINE_ALIGN_TO_BOTTOM: { + case INLINE_ALIGNMENT_TO_BOTTOM: { E.value.rect.position.x = sd->descent; } break; } - switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) { - case INLINE_ALIGN_BOTTOM_TO: { + switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { + case INLINE_ALIGNMENT_BOTTOM_TO: { E.value.rect.position.x -= E.value.rect.size.x; } break; - case INLINE_ALIGN_CENTER_TO: { + case INLINE_ALIGNMENT_CENTER_TO: { E.value.rect.position.x -= E.value.rect.size.x / 2; } break; - case INLINE_ALIGN_TOP_TO: { + case INLINE_ALIGNMENT_TOP_TO: { // NOP } break; } @@ -2498,56 +2498,56 @@ RID TextServerFallback::shaped_text_substr(RID p_shaped, int p_start, int p_leng for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : new_sd->objects) { if ((E.value.pos >= new_sd->start) && (E.value.pos < new_sd->end)) { if (sd->orientation == ORIENTATION_HORIZONTAL) { - switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) { - case INLINE_ALIGN_TO_TOP: { + switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { + case INLINE_ALIGNMENT_TO_TOP: { E.value.rect.position.y = -new_sd->ascent; } break; - case INLINE_ALIGN_TO_CENTER: { + case INLINE_ALIGNMENT_TO_CENTER: { E.value.rect.position.y = (-new_sd->ascent + new_sd->descent) / 2; } break; - case INLINE_ALIGN_TO_BASELINE: { + case INLINE_ALIGNMENT_TO_BASELINE: { E.value.rect.position.y = 0; } break; - case INLINE_ALIGN_TO_BOTTOM: { + case INLINE_ALIGNMENT_TO_BOTTOM: { E.value.rect.position.y = new_sd->descent; } break; } - switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) { - case INLINE_ALIGN_BOTTOM_TO: { + switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { + case INLINE_ALIGNMENT_BOTTOM_TO: { E.value.rect.position.y -= E.value.rect.size.y; } break; - case INLINE_ALIGN_CENTER_TO: { + case INLINE_ALIGNMENT_CENTER_TO: { E.value.rect.position.y -= E.value.rect.size.y / 2; } break; - case INLINE_ALIGN_TOP_TO: { + case INLINE_ALIGNMENT_TOP_TO: { // NOP } break; } full_ascent = MAX(full_ascent, -E.value.rect.position.y); full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y); } else { - switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) { - case INLINE_ALIGN_TO_TOP: { + switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { + case INLINE_ALIGNMENT_TO_TOP: { E.value.rect.position.x = -new_sd->ascent; } break; - case INLINE_ALIGN_TO_CENTER: { + case INLINE_ALIGNMENT_TO_CENTER: { E.value.rect.position.x = (-new_sd->ascent + new_sd->descent) / 2; } break; - case INLINE_ALIGN_TO_BASELINE: { + case INLINE_ALIGNMENT_TO_BASELINE: { E.value.rect.position.x = 0; } break; - case INLINE_ALIGN_TO_BOTTOM: { + case INLINE_ALIGNMENT_TO_BOTTOM: { E.value.rect.position.x = new_sd->descent; } break; } - switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) { - case INLINE_ALIGN_BOTTOM_TO: { + switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { + case INLINE_ALIGNMENT_BOTTOM_TO: { E.value.rect.position.x -= E.value.rect.size.x; } break; - case INLINE_ALIGN_CENTER_TO: { + case INLINE_ALIGNMENT_CENTER_TO: { E.value.rect.position.x -= E.value.rect.size.x / 2; } break; - case INLINE_ALIGN_TOP_TO: { + case INLINE_ALIGNMENT_TOP_TO: { // NOP } break; } @@ -3052,56 +3052,56 @@ bool TextServerFallback::shaped_text_shape(RID p_shaped) { float full_descent = sd->descent; for (KeyValue<Variant, ShapedTextData::EmbeddedObject> &E : sd->objects) { if (sd->orientation == ORIENTATION_HORIZONTAL) { - switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) { - case INLINE_ALIGN_TO_TOP: { + switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { + case INLINE_ALIGNMENT_TO_TOP: { E.value.rect.position.y = -sd->ascent; } break; - case INLINE_ALIGN_TO_CENTER: { + case INLINE_ALIGNMENT_TO_CENTER: { E.value.rect.position.y = (-sd->ascent + sd->descent) / 2; } break; - case INLINE_ALIGN_TO_BASELINE: { + case INLINE_ALIGNMENT_TO_BASELINE: { E.value.rect.position.y = 0; } break; - case INLINE_ALIGN_TO_BOTTOM: { + case INLINE_ALIGNMENT_TO_BOTTOM: { E.value.rect.position.y = sd->descent; } break; } - switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) { - case INLINE_ALIGN_BOTTOM_TO: { + switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { + case INLINE_ALIGNMENT_BOTTOM_TO: { E.value.rect.position.y -= E.value.rect.size.y; } break; - case INLINE_ALIGN_CENTER_TO: { + case INLINE_ALIGNMENT_CENTER_TO: { E.value.rect.position.y -= E.value.rect.size.y / 2; } break; - case INLINE_ALIGN_TOP_TO: { + case INLINE_ALIGNMENT_TOP_TO: { // NOP } break; } full_ascent = MAX(full_ascent, -E.value.rect.position.y); full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y); } else { - switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) { - case INLINE_ALIGN_TO_TOP: { + switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) { + case INLINE_ALIGNMENT_TO_TOP: { E.value.rect.position.x = -sd->ascent; } break; - case INLINE_ALIGN_TO_CENTER: { + case INLINE_ALIGNMENT_TO_CENTER: { E.value.rect.position.x = (-sd->ascent + sd->descent) / 2; } break; - case INLINE_ALIGN_TO_BASELINE: { + case INLINE_ALIGNMENT_TO_BASELINE: { E.value.rect.position.x = 0; } break; - case INLINE_ALIGN_TO_BOTTOM: { + case INLINE_ALIGNMENT_TO_BOTTOM: { E.value.rect.position.x = sd->descent; } break; } - switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) { - case INLINE_ALIGN_BOTTOM_TO: { + switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) { + case INLINE_ALIGNMENT_BOTTOM_TO: { E.value.rect.position.x -= E.value.rect.size.x; } break; - case INLINE_ALIGN_CENTER_TO: { + case INLINE_ALIGNMENT_CENTER_TO: { E.value.rect.position.x -= E.value.rect.size.x / 2; } break; - case INLINE_ALIGN_TOP_TO: { + case INLINE_ALIGNMENT_TOP_TO: { // NOP } break; } diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index 67b08d1eac..f2b33c2afb 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -387,8 +387,8 @@ public: virtual bool shaped_text_get_preserve_control(RID p_shaped) const override; virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override; - virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override; - virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override; + virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override; + virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override; virtual RID shaped_text_get_parent(RID p_shaped) const override; |