Handle initial position in bidi
This commit is contained in:
parent
05c15154a2
commit
97b3fbb872
3 changed files with 13 additions and 7 deletions
|
@ -50,7 +50,8 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
||||||
if (logical_len < 0)
|
if (logical_len < 0)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
visual_len = grub_bidi_logical_to_visual (logical, logical_len, &visual, 0, 0);
|
visual_len = grub_bidi_logical_to_visual (logical, logical_len, &visual,
|
||||||
|
0, 0, 0);
|
||||||
grub_free (logical);
|
grub_free (logical);
|
||||||
if (visual_len < 0)
|
if (visual_len < 0)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
|
@ -104,7 +104,8 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||||
grub_size_t logical_len,
|
grub_size_t logical_len,
|
||||||
struct grub_unicode_glyph **visual_out,
|
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),
|
||||||
grub_size_t max_length);
|
grub_size_t max_width,
|
||||||
|
grub_size_t start_width);
|
||||||
|
|
||||||
enum grub_comb_type
|
enum grub_comb_type
|
||||||
grub_unicode_get_comb_type (grub_uint32_t c);
|
grub_unicode_get_comb_type (grub_uint32_t c);
|
||||||
|
|
|
@ -548,7 +548,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
||||||
grub_size_t logical_len,
|
grub_size_t logical_len,
|
||||||
struct grub_unicode_glyph *visual_out,
|
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),
|
||||||
grub_size_t maxwidth)
|
grub_size_t maxwidth, grub_size_t startwidth)
|
||||||
{
|
{
|
||||||
enum grub_bidi_type type = GRUB_BIDI_TYPE_L;
|
enum grub_bidi_type type = GRUB_BIDI_TYPE_L;
|
||||||
enum override_status {OVERRIDE_NEUTRAL = 0, OVERRIDE_R, OVERRIDE_L};
|
enum override_status {OVERRIDE_NEUTRAL = 0, OVERRIDE_R, OVERRIDE_L};
|
||||||
|
@ -861,7 +861,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
||||||
{
|
{
|
||||||
struct grub_unicode_glyph *outptr = visual_out;
|
struct grub_unicode_glyph *outptr = visual_out;
|
||||||
unsigned line_start = 0;
|
unsigned line_start = 0;
|
||||||
grub_ssize_t line_width = 0;
|
grub_ssize_t line_width = startwidth;
|
||||||
unsigned k;
|
unsigned k;
|
||||||
|
|
||||||
for (k = 0; k <= visual_len; k++)
|
for (k = 0; k <= visual_len; k++)
|
||||||
|
@ -925,7 +925,7 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||||
grub_size_t logical_len,
|
grub_size_t logical_len,
|
||||||
struct grub_unicode_glyph **visual_out,
|
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),
|
||||||
grub_size_t max_length)
|
grub_size_t max_length, grub_size_t startwidth)
|
||||||
{
|
{
|
||||||
const grub_uint32_t *line_start = logical, *ptr;
|
const grub_uint32_t *line_start = logical, *ptr;
|
||||||
struct grub_unicode_glyph *visual_ptr;
|
struct grub_unicode_glyph *visual_ptr;
|
||||||
|
@ -940,7 +940,10 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||||
ptr - line_start,
|
ptr - line_start,
|
||||||
visual_ptr,
|
visual_ptr,
|
||||||
getcharwidth,
|
getcharwidth,
|
||||||
max_length);
|
max_length,
|
||||||
|
startwidth);
|
||||||
|
startwidth = 0;
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
grub_free (*visual_out);
|
grub_free (*visual_out);
|
||||||
|
@ -1095,7 +1098,8 @@ grub_print_ucs4 (const grub_uint32_t * str,
|
||||||
last_position - str,
|
last_position - str,
|
||||||
&visual,
|
&visual,
|
||||||
term->getcharwidth,
|
term->getcharwidth,
|
||||||
grub_term_width (term));
|
grub_term_width (term),
|
||||||
|
(term->getxy () >> 8) & 0xff);
|
||||||
if (visual_len < 0)
|
if (visual_len < 0)
|
||||||
{
|
{
|
||||||
grub_print_error ();
|
grub_print_error ();
|
||||||
|
|
Loading…
Reference in a new issue