Make comaptible with new nsfont_split expectation. Untested, but code is same as framebuffer front end, so should work.
This commit is contained in:
parent
3148f8a6c3
commit
6bab556827
|
@ -443,8 +443,9 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,
|
|||
last_space_idx = nxtchr;
|
||||
}
|
||||
*actual_x += glyph->advance.x >> 16;
|
||||
if (*actual_x > x) {
|
||||
/* string has exceeded available width return previous space*/
|
||||
if (*actual_x > x && last_space_idx != 0) {
|
||||
/* string has exceeded available width and we've
|
||||
* found a space; return previous space */
|
||||
*actual_x = last_space_x;
|
||||
*char_offset = last_space_idx;
|
||||
return true;
|
||||
|
|
|
@ -118,7 +118,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
|
|||
size_t length,int x, size_t *char_offset, int *actual_x )
|
||||
{
|
||||
const struct fb_font_desc* fb_font = fb_get_font(fstyle);
|
||||
*char_offset = x / fb_font->width;
|
||||
int c_off = *char_offset = x / fb_font->width;
|
||||
if (*char_offset > length) {
|
||||
*char_offset = length;
|
||||
} else {
|
||||
|
@ -127,6 +127,13 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
|
|||
break;
|
||||
(*char_offset)--;
|
||||
}
|
||||
if (*char_offset == 0) {
|
||||
*char_offset = c_off;
|
||||
while (*char_offset < length &&
|
||||
string[*char_offset] != ' ') {
|
||||
(*char_offset)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
*actual_x = *char_offset * fb_font->width;
|
||||
return( 1 );
|
||||
|
|
|
@ -164,7 +164,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
|
|||
last_space_idx = nxtchr;
|
||||
}
|
||||
*actual_x += cellw;
|
||||
if (*actual_x > x) {
|
||||
if (*actual_x > x && last_space_idx != 0) {
|
||||
*actual_x = last_space_x;
|
||||
*char_offset = last_space_idx;
|
||||
//printf("at: %s\n", lstr);
|
||||
|
|
Loading…
Reference in New Issue