parts: use bold width for text layout

Fixes the remaining issues with item descriptions in Rance 9.
This commit is contained in:
Nunuhara Cabbage
2026-08-14 10:48:07 -07:00
parent 4e20a499d4
commit 5cbc697f23
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ void StoatSpriteEngine_SP_SetTextSpriteColor(int r, int g, int b)
void StoatSpriteEngine_SP_SetTextSpriteBoldWeight(float weight)
{
//NOTICE("StoatSpriteEngine.SP_SetTextSpriteBoldWeight(%f)", weight);
text_sprite_ts.bold_width = weight;
}
void StoatSpriteEngine_SP_SetTextSpriteEdgeWeight(float weight)
+2 -1
View File
@@ -90,7 +90,7 @@ static const char *parts_text_append_char(struct parts_text *t, const char *str)
ch->advance = gfx_render_textf(&ch->t, 0, 0, ch->ch, &t->ts, false);
line->width += ch->advance;
line->height = max(line->height, height);
line->height = max(line->height, height + ceilf(t->ts.bold_width)*2);
return str + len;
}
@@ -205,6 +205,7 @@ bool PE_SetFont(int parts_no, int type, int size, int r, int g, int b, float bol
text->ts.weight = bold_weight * 1000;
text->ts.edge_color = (SDL_Color) { edge_r, edge_g, edge_b, 255 };
text_style_set_edge_width(&text->ts, edge_weight);
text->ts.bold_width = bold_weight;
parts_text_rerender(parts, text);
return true;
}
+1 -1
View File
@@ -174,7 +174,7 @@ float gfx_size_text(struct text_style *ts, const char *text)
{
struct font_size *size = text_style_font_size(ts);
float edge_advance = gfx_text_advance_edges
? ts->edge_left + ts->edge_right + ceilf(ts->bold_width)
? ts->edge_left + ts->edge_right + ceilf(ts->bold_width)*2
: 0.0f;
float x = 0.0f;
while (*text) {