diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index 5eddf1a..fe0e1a3 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -81,7 +81,6 @@ void gfx_prepare_job(struct gfx_render_job *job); void gfx_run_job(struct gfx_render_job *job); void gfx_render(struct gfx_render_job *job); void gfx_render_texture(struct texture *t, Rectangle *r); -int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm); // texture management void gfx_init_texture_blank(struct texture *t, int w, int h); @@ -173,7 +172,7 @@ bool gfx_get_font_strikeout(void); int gfx_get_font_space(void); SDL_Color gfx_get_font_color(void); -int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm); +int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm, int char_space); void gfx_draw_text_to_amap(Texture *dst, int x, int y, char *text); void gfx_draw_text_to_pmap(Texture *dst, int x, int y, char *text); diff --git a/src/sact_graphics.c b/src/sact_graphics.c index b483059..bf17c57 100644 --- a/src/sact_graphics.c +++ b/src/sact_graphics.c @@ -503,7 +503,7 @@ int _sact_SP_TextDraw(int sp_no, struct string *text, struct text_metrics *tm) gfx_init_texture_with_color(&sp->text.texture, sp->rect.w, sp->rect.h, c); } - sp->text.pos.x += gfx_render_text(&sp->text.texture, sp->text.pos, text->text, tm); + sp->text.pos.x += gfx_render_text(&sp->text.texture, sp->text.pos, text->text, tm, sp->text.char_space); return 1; } diff --git a/src/text.c b/src/text.c index 2522109..728b6df 100644 --- a/src/text.c +++ b/src/text.c @@ -332,7 +332,7 @@ static int extract_sjis_char(char *src, char *dst) return 1; } -int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm) +int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm, int char_space) { char c[4]; @@ -340,7 +340,7 @@ int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm) while (*msg) { int len = extract_sjis_char(msg, c); _gfx_render_text(dst, pos, c, tm); - pos.x += len == 2 ? tm->size : tm->size / 2; + pos.x += (len == 2 ? tm->size : tm->size / 2) + char_space; msg += len; } return pos.x - original_x; @@ -362,7 +362,7 @@ static void gfx_draw_text(Texture *dst, int x, int y, char *text) free(conv); // move next pos - pos.x += len == 2 ? font->size : font->size / 2; + pos.x += (len == 2 ? font->size : font->size / 2) + font_metrics.space; text += len; } }