|
@@ -4941,11 +4941,11 @@ bool TextServerAdvanced::_shaped_text_resize_object(const RID &p_shaped, const V
|
|
if (sd->orientation == ORIENTATION_HORIZONTAL) {
|
|
if (sd->orientation == ORIENTATION_HORIZONTAL) {
|
|
sd->objects[key].rect.position.x = sd->width;
|
|
sd->objects[key].rect.position.x = sd->width;
|
|
sd->width += sd->objects[key].rect.size.x;
|
|
sd->width += sd->objects[key].rect.size.x;
|
|
- sd->glyphs.write[i].advance = sd->objects[key].rect.size.x;
|
|
|
|
|
|
+ sd->glyphs[i].advance = sd->objects[key].rect.size.x;
|
|
} else {
|
|
} else {
|
|
sd->objects[key].rect.position.y = sd->width;
|
|
sd->objects[key].rect.position.y = sd->width;
|
|
sd->width += sd->objects[key].rect.size.y;
|
|
sd->width += sd->objects[key].rect.size.y;
|
|
- sd->glyphs.write[i].advance = sd->objects[key].rect.size.y;
|
|
|
|
|
|
+ sd->glyphs[i].advance = sd->objects[key].rect.size.y;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (gl.font_rid.is_valid()) {
|
|
if (gl.font_rid.is_valid()) {
|
|
@@ -5331,12 +5331,12 @@ double TextServerAdvanced::_shaped_text_fit_to_width(const RID &p_shaped, double
|
|
// Trim spaces.
|
|
// Trim spaces.
|
|
while ((start_pos < end_pos) && ((sd->glyphs[start_pos].flags & GRAPHEME_IS_SOFT_HYPHEN) != GRAPHEME_IS_SOFT_HYPHEN) && ((sd->glyphs[start_pos].flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE || (sd->glyphs[start_pos].flags & GRAPHEME_IS_BREAK_HARD) == GRAPHEME_IS_BREAK_HARD || (sd->glyphs[start_pos].flags & GRAPHEME_IS_BREAK_SOFT) == GRAPHEME_IS_BREAK_SOFT)) {
|
|
while ((start_pos < end_pos) && ((sd->glyphs[start_pos].flags & GRAPHEME_IS_SOFT_HYPHEN) != GRAPHEME_IS_SOFT_HYPHEN) && ((sd->glyphs[start_pos].flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE || (sd->glyphs[start_pos].flags & GRAPHEME_IS_BREAK_HARD) == GRAPHEME_IS_BREAK_HARD || (sd->glyphs[start_pos].flags & GRAPHEME_IS_BREAK_SOFT) == GRAPHEME_IS_BREAK_SOFT)) {
|
|
justification_width -= sd->glyphs[start_pos].advance * sd->glyphs[start_pos].repeat;
|
|
justification_width -= sd->glyphs[start_pos].advance * sd->glyphs[start_pos].repeat;
|
|
- sd->glyphs.write[start_pos].advance = 0;
|
|
|
|
|
|
+ sd->glyphs[start_pos].advance = 0;
|
|
start_pos += sd->glyphs[start_pos].count;
|
|
start_pos += sd->glyphs[start_pos].count;
|
|
}
|
|
}
|
|
while ((start_pos < end_pos) && ((sd->glyphs[end_pos].flags & GRAPHEME_IS_SOFT_HYPHEN) != GRAPHEME_IS_SOFT_HYPHEN) && ((sd->glyphs[end_pos].flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE || (sd->glyphs[end_pos].flags & GRAPHEME_IS_BREAK_HARD) == GRAPHEME_IS_BREAK_HARD || (sd->glyphs[end_pos].flags & GRAPHEME_IS_BREAK_SOFT) == GRAPHEME_IS_BREAK_SOFT)) {
|
|
while ((start_pos < end_pos) && ((sd->glyphs[end_pos].flags & GRAPHEME_IS_SOFT_HYPHEN) != GRAPHEME_IS_SOFT_HYPHEN) && ((sd->glyphs[end_pos].flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE || (sd->glyphs[end_pos].flags & GRAPHEME_IS_BREAK_HARD) == GRAPHEME_IS_BREAK_HARD || (sd->glyphs[end_pos].flags & GRAPHEME_IS_BREAK_SOFT) == GRAPHEME_IS_BREAK_SOFT)) {
|
|
justification_width -= sd->glyphs[end_pos].advance * sd->glyphs[end_pos].repeat;
|
|
justification_width -= sd->glyphs[end_pos].advance * sd->glyphs[end_pos].repeat;
|
|
- sd->glyphs.write[end_pos].advance = 0;
|
|
|
|
|
|
+ sd->glyphs[end_pos].advance = 0;
|
|
end_pos -= sd->glyphs[end_pos].count;
|
|
end_pos -= sd->glyphs[end_pos].count;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -5369,7 +5369,7 @@ double TextServerAdvanced::_shaped_text_fit_to_width(const RID &p_shaped, double
|
|
if ((elongation_count > 0) && p_jst_flags.has_flag(JUSTIFICATION_KASHIDA)) {
|
|
if ((elongation_count > 0) && p_jst_flags.has_flag(JUSTIFICATION_KASHIDA)) {
|
|
double delta_width_per_kashida = (p_width - justification_width) / elongation_count;
|
|
double delta_width_per_kashida = (p_width - justification_width) / elongation_count;
|
|
for (int i = start_pos; i <= end_pos; i++) {
|
|
for (int i = start_pos; i <= end_pos; i++) {
|
|
- Glyph &gl = sd->glyphs.write[i];
|
|
|
|
|
|
+ Glyph &gl = sd->glyphs[i];
|
|
if (gl.count > 0) {
|
|
if (gl.count > 0) {
|
|
if (((gl.flags & GRAPHEME_IS_ELONGATION) == GRAPHEME_IS_ELONGATION) && (gl.advance > 0)) {
|
|
if (((gl.flags & GRAPHEME_IS_ELONGATION) == GRAPHEME_IS_ELONGATION) && (gl.advance > 0)) {
|
|
if ((i > 0) && ((sd->glyphs[i - 1].flags & GRAPHEME_IS_ELONGATION) != GRAPHEME_IS_ELONGATION)) {
|
|
if ((i > 0) && ((sd->glyphs[i - 1].flags & GRAPHEME_IS_ELONGATION) != GRAPHEME_IS_ELONGATION)) {
|
|
@@ -5391,7 +5391,7 @@ double TextServerAdvanced::_shaped_text_fit_to_width(const RID &p_shaped, double
|
|
double delta_width_per_space = (p_width - justification_width) / space_count;
|
|
double delta_width_per_space = (p_width - justification_width) / space_count;
|
|
double adv_remain = 0;
|
|
double adv_remain = 0;
|
|
for (int i = start_pos; i <= end_pos; i++) {
|
|
for (int i = start_pos; i <= end_pos; i++) {
|
|
- Glyph &gl = sd->glyphs.write[i];
|
|
|
|
|
|
+ Glyph &gl = sd->glyphs[i];
|
|
if (gl.count > 0) {
|
|
if (gl.count > 0) {
|
|
if ((gl.flags & GRAPHEME_IS_SOFT_HYPHEN) != GRAPHEME_IS_SOFT_HYPHEN && (gl.flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE && (gl.flags & GRAPHEME_IS_PUNCTUATION) != GRAPHEME_IS_PUNCTUATION) {
|
|
if ((gl.flags & GRAPHEME_IS_SOFT_HYPHEN) != GRAPHEME_IS_SOFT_HYPHEN && (gl.flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE && (gl.flags & GRAPHEME_IS_PUNCTUATION) != GRAPHEME_IS_PUNCTUATION) {
|
|
double old_adv = gl.advance;
|
|
double old_adv = gl.advance;
|
|
@@ -5459,7 +5459,7 @@ double TextServerAdvanced::_shaped_text_tab_align(const RID &p_shaped, const Pac
|
|
delta = -1;
|
|
delta = -1;
|
|
}
|
|
}
|
|
|
|
|
|
- Glyph *gl = sd->glyphs.ptrw();
|
|
|
|
|
|
+ Glyph *gl = sd->glyphs.ptr();
|
|
|
|
|
|
for (int i = start; i != end; i += delta) {
|
|
for (int i = start; i != end; i += delta) {
|
|
if ((gl[i].flags & GRAPHEME_IS_TAB) == GRAPHEME_IS_TAB) {
|
|
if ((gl[i].flags & GRAPHEME_IS_TAB) == GRAPHEME_IS_TAB) {
|
|
@@ -5668,7 +5668,7 @@ void TextServerAdvanced::_shaped_text_overrun_trim_to_width(const RID &p_shaped_
|
|
bool enforce_ellipsis = p_trim_flags.has_flag(OVERRUN_ENFORCE_ELLIPSIS);
|
|
bool enforce_ellipsis = p_trim_flags.has_flag(OVERRUN_ENFORCE_ELLIPSIS);
|
|
bool justification_aware = p_trim_flags.has_flag(OVERRUN_JUSTIFICATION_AWARE);
|
|
bool justification_aware = p_trim_flags.has_flag(OVERRUN_JUSTIFICATION_AWARE);
|
|
|
|
|
|
- Glyph *sd_glyphs = sd->glyphs.ptrw();
|
|
|
|
|
|
+ Glyph *sd_glyphs = sd->glyphs.ptr();
|
|
|
|
|
|
if ((p_trim_flags & OVERRUN_TRIM) == OVERRUN_NO_TRIM || sd_glyphs == nullptr || p_width <= 0 || !(sd->width > p_width || enforce_ellipsis)) {
|
|
if ((p_trim_flags & OVERRUN_TRIM) == OVERRUN_NO_TRIM || sd_glyphs == nullptr || p_width <= 0 || !(sd->width > p_width || enforce_ellipsis)) {
|
|
sd->overrun_trim_data.trim_pos = -1;
|
|
sd->overrun_trim_data.trim_pos = -1;
|
|
@@ -6039,17 +6039,17 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) {
|
|
sd->break_ops_valid = true;
|
|
sd->break_ops_valid = true;
|
|
}
|
|
}
|
|
|
|
|
|
- Vector<Glyph> glyphs_new;
|
|
|
|
|
|
+ LocalVector<Glyph> glyphs_new;
|
|
|
|
|
|
bool rewrite = false;
|
|
bool rewrite = false;
|
|
int sd_shift = 0;
|
|
int sd_shift = 0;
|
|
int sd_size = sd->glyphs.size();
|
|
int sd_size = sd->glyphs.size();
|
|
- Glyph *sd_glyphs = sd->glyphs.ptrw();
|
|
|
|
|
|
+ Glyph *sd_glyphs = sd->glyphs.ptr();
|
|
Glyph *sd_glyphs_new = nullptr;
|
|
Glyph *sd_glyphs_new = nullptr;
|
|
|
|
|
|
if (sd->break_inserts > 0) {
|
|
if (sd->break_inserts > 0) {
|
|
glyphs_new.resize(sd->glyphs.size() + sd->break_inserts);
|
|
glyphs_new.resize(sd->glyphs.size() + sd->break_inserts);
|
|
- sd_glyphs_new = glyphs_new.ptrw();
|
|
|
|
|
|
+ sd_glyphs_new = glyphs_new.ptr();
|
|
rewrite = true;
|
|
rewrite = true;
|
|
} else {
|
|
} else {
|
|
sd_glyphs_new = sd_glyphs;
|
|
sd_glyphs_new = sd_glyphs;
|
|
@@ -6165,7 +6165,7 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) {
|
|
}
|
|
}
|
|
|
|
|
|
if (sd->break_inserts > 0) {
|
|
if (sd->break_inserts > 0) {
|
|
- sd->glyphs = glyphs_new;
|
|
|
|
|
|
+ sd->glyphs = std::move(glyphs_new);
|
|
}
|
|
}
|
|
|
|
|
|
sd->line_breaks_valid = true;
|
|
sd->line_breaks_valid = true;
|
|
@@ -6311,7 +6311,7 @@ bool TextServerAdvanced::_shaped_text_update_justification_ops(const RID &p_shap
|
|
sd->sort_valid = false;
|
|
sd->sort_valid = false;
|
|
sd->glyphs_logical.clear();
|
|
sd->glyphs_logical.clear();
|
|
|
|
|
|
- Glyph *sd_glyphs = sd->glyphs.ptrw();
|
|
|
|
|
|
+ Glyph *sd_glyphs = sd->glyphs.ptr();
|
|
int sd_size = sd->glyphs.size();
|
|
int sd_size = sd->glyphs.size();
|
|
if (!sd->jstops.is_empty()) {
|
|
if (!sd->jstops.is_empty()) {
|
|
for (int i = 0; i < sd_size; i++) {
|
|
for (int i = 0; i < sd_size; i++) {
|
|
@@ -6349,7 +6349,7 @@ bool TextServerAdvanced::_shaped_text_update_justification_ops(const RID &p_shap
|
|
|
|
|
|
// Update write pointer and size.
|
|
// Update write pointer and size.
|
|
sd_size = sd->glyphs.size();
|
|
sd_size = sd->glyphs.size();
|
|
- sd_glyphs = sd->glyphs.ptrw();
|
|
|
|
|
|
+ sd_glyphs = sd->glyphs.ptr();
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -6389,7 +6389,7 @@ bool TextServerAdvanced::_shaped_text_update_justification_ops(const RID &p_shap
|
|
|
|
|
|
// Update write pointer and size.
|
|
// Update write pointer and size.
|
|
sd_size = sd->glyphs.size();
|
|
sd_size = sd->glyphs.size();
|
|
- sd_glyphs = sd->glyphs.ptrw();
|
|
|
|
|
|
+ sd_glyphs = sd->glyphs.ptr();
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|