mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-06 05:48:04 +03:00
Handle explicitly set char spacing
Handle char spacing set up by SACT2.SP_SetTextCharSpace and DrawGraph.SetFontSpace.
This commit is contained in:
+1
-2
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user