* grub-core/normal/charset.c (grub_bidi_logical_to_visual): Add
hook pass-through parameter. All users updated and unnested.
This commit is contained in:
parent
74a2742144
commit
19e29ee1a9
4 changed files with 19 additions and 14 deletions
|
@ -52,7 +52,7 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|||
return grub_errno;
|
||||
|
||||
visual_len = grub_bidi_logical_to_visual (logical, logical_len, &visual,
|
||||
0, 0, 0, 0, 0, 0);
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
grub_free (logical);
|
||||
if (visual_len < 0)
|
||||
return grub_errno;
|
||||
|
|
|
@ -512,7 +512,8 @@ static grub_ssize_t
|
|||
bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
||||
struct grub_unicode_glyph *visual,
|
||||
grub_size_t visual_len, unsigned *levels,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
|
||||
void *getcharwidth_arg,
|
||||
grub_size_t maxwidth, grub_size_t startwidth,
|
||||
grub_uint32_t contchar,
|
||||
struct grub_term_pos *pos, int primitive_wrap,
|
||||
|
@ -577,7 +578,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|||
}
|
||||
|
||||
if (getcharwidth && k != visual_len)
|
||||
line_width += last_width = getcharwidth (&visual[k]);
|
||||
line_width += last_width = getcharwidth (&visual[k], getcharwidth_arg);
|
||||
|
||||
if (k != visual_len && (visual[k].base == ' '
|
||||
|| visual[k].base == '\t')
|
||||
|
@ -752,7 +753,8 @@ static grub_ssize_t
|
|||
grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
||||
grub_size_t logical_len,
|
||||
struct grub_unicode_glyph *visual_out,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
|
||||
void *getcharwidth_arg,
|
||||
grub_size_t maxwidth, grub_size_t startwidth,
|
||||
grub_uint32_t contchar,
|
||||
struct grub_term_pos *pos,
|
||||
|
@ -1116,7 +1118,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|||
{
|
||||
grub_ssize_t ret;
|
||||
ret = bidi_line_wrap (visual_out, visual, visual_len, levels,
|
||||
getcharwidth, maxwidth, startwidth, contchar,
|
||||
getcharwidth, getcharwidth_arg, maxwidth, startwidth, contchar,
|
||||
pos, primitive_wrap, log_end);
|
||||
grub_free (levels);
|
||||
grub_free (visual);
|
||||
|
@ -1128,7 +1130,8 @@ grub_ssize_t
|
|||
grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||
grub_size_t logical_len,
|
||||
struct grub_unicode_glyph **visual_out,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
|
||||
void *getcharwidth_arg,
|
||||
grub_size_t max_length, grub_size_t startwidth,
|
||||
grub_uint32_t contchar, struct grub_term_pos *pos, int primitive_wrap)
|
||||
{
|
||||
|
@ -1147,6 +1150,7 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
|||
ptr - line_start,
|
||||
visual_ptr,
|
||||
getcharwidth,
|
||||
getcharwidth_arg,
|
||||
max_length,
|
||||
startwidth,
|
||||
contchar,
|
||||
|
|
|
@ -840,6 +840,12 @@ print_backlog (struct grub_term_output *term,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
getcharwidth (const struct grub_unicode_glyph *c, void *term)
|
||||
{
|
||||
return grub_term_getcharwidth (term, c);
|
||||
}
|
||||
|
||||
static int
|
||||
print_ucs4_real (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
|
@ -881,14 +887,8 @@ print_ucs4_real (const grub_uint32_t * str,
|
|||
int ret;
|
||||
struct grub_unicode_glyph *vptr;
|
||||
|
||||
auto grub_ssize_t getcharwidth (const struct grub_unicode_glyph *c);
|
||||
grub_ssize_t getcharwidth (const struct grub_unicode_glyph *c)
|
||||
{
|
||||
return grub_term_getcharwidth (term, c);
|
||||
}
|
||||
|
||||
visual_len = grub_bidi_logical_to_visual (str, last_position - str,
|
||||
&visual, getcharwidth,
|
||||
&visual, getcharwidth, term,
|
||||
get_maxwidth (term,
|
||||
margin_left,
|
||||
margin_right),
|
||||
|
|
|
@ -240,7 +240,8 @@ grub_ssize_t
|
|||
grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||
grub_size_t logical_len,
|
||||
struct grub_unicode_glyph **visual_out,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
|
||||
void *getcharwidth_arg,
|
||||
grub_size_t max_width,
|
||||
grub_size_t start_width, grub_uint32_t codechar,
|
||||
struct grub_term_pos *pos,
|
||||
|
|
Loading…
Reference in a new issue