Repository: godotengine/godot
File: scene/gui/rich_text_label.cpp (C++)

Code before:
					img_size = _get_image_size(img->image, img->width_in_percent ? (p_width * img->rq_size.width / 100.f) : img->rq_size.width, img->height_in_percent ? (p_width * img->rq_size.height / 100.f) : img->rq_size.height, img->region);
					l.text_buf->resize_object(it->rid, img_size, img->inline_align);
					if (l.text_buf_disp.is_valid() && l.text_buf_disp->has_object(it->rid)) {
						l.text_buf_disp->resize_object(it->rid, img_size, img->inline_align);
					}
				}
			} break;
			case ITEM_TABLE: {
				ItemTable *table = static_cast<ItemTable *>(it);
				int col_count = table->columns.size();

				for (int i = 0; i < col_count; i++) {
					table->columns[i].width = 0;
				}

				// Compute width for each column.
				const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * col_count;
				_update_table_column_width(table, available_width);

				// Resize for elements in the table.
				int idx = 0;
				for (Item *E : table->subitems) {
					ERR_CONTINUE(E->type != ITEM_FRAME); // Children should all be frames.
					ItemFrame *frame = static_cast<ItemFrame *>(E);

					const int frame_padding_space = std::ceil(frame->padding.position.x + frame->padding.size.x);

					int column = idx % col_count;
					float prev_h = 0;
					for (int i = 0; i < (int)frame->lines.size(); i++) {
						MutexLock sub_lock(frame->lines[i].text_buf->get_mutex());
						int w = table->columns[column].width - frame_padding_space;
						w = MAX(w, _find_margin(frame->lines[i].from, p_base_font, p_base_font_size) + 1);
						prev_h = _resize_line(frame, i, p_base_font, p_base_font_size, w, prev_h);
					}
					idx++;
				}

				// Compute size and offset for each element in the table.
				_update_table_size(table);

				int row_idx = (table->align_to_row < 0) ? table->rows_baseline.size() - 1 : table->align_to_row;
				if (table->rows_baseline.size() != 0 && row_idx < (int)table->rows_baseline.size()) {
					l.text_buf->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, Math::round(table->rows_baseline[row_idx]));
					if (l.text_buf_disp.is_valid() && l.text_buf_disp->has_object(it->rid)) {
						l.text_buf_disp->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, Math::round(table->rows_baseline[row_idx]));
					}
				} else {
					l.text_buf->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align);
					if (l.text_buf_disp.is_valid() && l.text_buf_disp->has_object(it->rid)) {
						l.text_buf_disp->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align);

Review comment (suggestion):
```suggestion
					const int frame_padding_space = Math::ceil(frame->padding.position.x + frame->padding.size.x);
```

Code after:
					img_size = _get_image_size(img->image, img->width_in_percent ? (p_width * img->rq_size.width / 100.f) : img->rq_size.width, img->height_in_percent ? (p_width * img->rq_size.height / 100.f) : img->rq_size.height, img->region);
					l.text_buf->resize_object(it->rid, img_size, img->inline_align);
					if (l.text_buf_disp.is_valid() && l.text_buf_disp->has_object(it->rid)) {
						l.text_buf_disp->resize_object(it->rid, img_size, img->inline_align);
					}
				}
			} break;
			case ITEM_TABLE: {
				ItemTable *table = static_cast<ItemTable *>(it);
				int col_count = table->columns.size();

				for (int i = 0; i < col_count; i++) {
					table->columns[i].width = 0;
				}

				// Compute width for each column.
				const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * col_count;
				_update_table_column_width(table, available_width);

				// Resize for elements in the table.
				int idx = 0;
				for (Item *E : table->subitems) {
					ERR_CONTINUE(E->type != ITEM_FRAME); // Children should all be frames.
					ItemFrame *frame = static_cast<ItemFrame *>(E);

					const int frame_padding_space = Math::ceil(frame->padding.position.x + frame->padding.size.x);

					int column = idx % col_count;
					float prev_h = 0;
					for (int i = 0; i < (int)frame->lines.size(); i++) {
						MutexLock sub_lock(frame->lines[i].text_buf->get_mutex());
						int w = table->columns[column].width - frame_padding_space;
						w = MAX(w, _find_margin(frame->lines[i].from, p_base_font, p_base_font_size) + 1);
						prev_h = _resize_line(frame, i, p_base_font, p_base_font_size, w, prev_h);
					}
					idx++;
				}

				// Compute size and offset for each element in the table.
				_update_table_size(table);

				int row_idx = (table->align_to_row < 0) ? table->rows_baseline.size() - 1 : table->align_to_row;
				if (table->rows_baseline.size() != 0 && row_idx < (int)table->rows_baseline.size()) {
					l.text_buf->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, Math::round(table->rows_baseline[row_idx]));
					if (l.text_buf_disp.is_valid() && l.text_buf_disp->has_object(it->rid)) {
						l.text_buf_disp->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, Math::round(table->rows_baseline[row_idx]));
					}
				} else {
					l.text_buf->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align);
					if (l.text_buf_disp.is_valid() && l.text_buf_disp->has_object(it->rid)) {
						l.text_buf_disp->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align);