grub_uint32_t code;
enum grub_comb_type type;
} *combining;
+ /* Hint by unicode subsystem how wide this character usually is.
+ Real width is determined by font. Set only in UTF-8 stream. */
+ int estimated_width;
};
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR 0x1
grub_unicode_glyph_from_code (grub_uint32_t code)
{
struct grub_unicode_glyph *ret;
- ret = grub_malloc (sizeof (*ret));
+ ret = grub_zalloc (sizeof (*ret));
if (!ret)
return NULL;
ret->base = code;
- ret->variant = 0;
- ret->attributes = 0;
- ret->ncomb = 0;
- ret->combining = 0;
return ret;
}
.variant = 0,
.attributes = 0,
.ncomb = 0,
- .combining = 0
+ .combining = 0,
+ .estimated_width = 1
};
if (code == '\t' && term->getxy)
out->variant = 0;
out->attributes = 0;
out->ncomb = 0;
+ out->estimated_width = 1;
out->combining = NULL;
}
return ptr - in;
.variant = 0,
.attributes = 0,
.ncomb = 0,
- .combining = 0
+ .combining = 0,
+ .estimated_width = 1
};
if (c->base == '\t' && term->getxy)
== GRUB_TERM_CODE_TYPE_UTF8_VISUAL)
{
int i;
+ c2.estimated_width = 1;
for (i = -1; i < (int) c->ncomb; i++)
{
grub_uint8_t u8[20], *ptr;
{
c2.base = *ptr;
(term->putchar) (&c2);
+ c2.estimated_width = 0;
}
}
+ c2.estimated_width = 1;
}
else
(term->putchar) (c);
.variant = 0,
.attributes = 0,
.ncomb = 0,
- .combining = 0
+ .combining = 0,
+ .estimated_width = 1
};
c.base = map_code (code, term);
.variant = 0,
.attributes = 0,
.ncomb = 0,
- .combining = 0
+ .combining = 0,
+ .estimated_width = 1
};
x += grub_term_getcharwidth (term, &pseudo_glyph);
}
serial_hw_put ('\r');
serial_hw_put ('\n');
}
- xpos++;
+ xpos += c->estimated_width;
break;
}
}