Skip to content

Commit

Permalink
Bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Seng-Jik committed Mar 7, 2022
1 parent 68a7b01 commit 07fdda7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cpymo-backends/3ds/cpymo_backend_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ const static float text_scale_divisor = 28.0f;

float cpymo_backend_text_width(cpymo_parser_stream_span text, float logic_size)
{
return logic_size * cpymo_parser_stream_span_utf8_len(text) / 1.35f;
cpymo_backend_text t = NULL;
float w;
error_t err = cpymo_backend_text_create(&t, &w, text, logic_size);
if (err != CPYMO_ERR_SUCC) {
return logic_size * cpymo_parser_stream_span_utf8_len(text) / 1.35f;
}

cpymo_backend_text_free(t);
return w;
}

error_t cpymo_backend_text_create(cpymo_backend_text *out, float *out_w, cpymo_parser_stream_span utf8_string, float single_character_size_in_logical_screen)
Expand Down Expand Up @@ -90,7 +98,8 @@ error_t cpymo_backend_text_create(cpymo_backend_text *out, float *out_w, cpymo_p
single_character_size_in_logical_screen / text_scale_divisor,
&w, NULL);

*out_w = cpymo_backend_text_width(utf8_string, single_character_size_in_logical_screen);
//*out_w = cpymo_backend_text_width(utf8_string, single_character_size_in_logical_screen);
*out_w = w;

return CPYMO_ERR_SUCC;
}
Expand Down

0 comments on commit 07fdda7

Please sign in to comment.