Shape arabic code when on UTF-8 visual
This commit is contained in:
parent
a6ab5fb2cf
commit
a82890fffc
3 changed files with 44 additions and 3 deletions
|
@ -222,5 +222,7 @@ grub_unicode_glyph_from_code (grub_uint32_t code)
|
|||
|
||||
grub_uint32_t
|
||||
grub_unicode_mirror_code (grub_uint32_t in);
|
||||
grub_uint32_t
|
||||
grub_unicode_shape_code (grub_uint32_t in, grub_uint8_t attr);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1227,3 +1227,39 @@ grub_unicode_mirror_code (grub_uint32_t in)
|
|||
return grub_unicode_bidi_pairs[i].replace;
|
||||
return in;
|
||||
}
|
||||
|
||||
grub_uint32_t
|
||||
grub_unicode_shape_code (grub_uint32_t in, grub_uint8_t attr)
|
||||
{
|
||||
int i;
|
||||
if (!(in >= GRUB_UNICODE_ARABIC_START
|
||||
&& in < GRUB_UNICODE_ARABIC_END))
|
||||
return in;
|
||||
|
||||
for (i = 0; grub_unicode_arabic_shapes[i].code; i++)
|
||||
if (grub_unicode_arabic_shapes[i].code == in)
|
||||
{
|
||||
grub_uint32_t out;
|
||||
switch (attr & (GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED
|
||||
| GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED))
|
||||
{
|
||||
case 0:
|
||||
out = grub_unicode_arabic_shapes[i].isolated;
|
||||
break;
|
||||
case GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED:
|
||||
out = grub_unicode_arabic_shapes[i].right_linked;
|
||||
break;
|
||||
case GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED:
|
||||
out = grub_unicode_arabic_shapes[i].left_linked;
|
||||
break;
|
||||
case GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED
|
||||
|GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED:
|
||||
out = grub_unicode_arabic_shapes[i].both_linked;
|
||||
break;
|
||||
}
|
||||
if (out)
|
||||
return out;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
|
|
@ -392,9 +392,12 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term)
|
|||
{
|
||||
code = c->base;
|
||||
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
== GRUB_TERM_CODE_TYPE_UTF8_VISUAL
|
||||
&& (c->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR))
|
||||
code = grub_unicode_mirror_code (code);
|
||||
== GRUB_TERM_CODE_TYPE_UTF8_VISUAL)
|
||||
{
|
||||
if ((c->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR))
|
||||
code = grub_unicode_mirror_code (code);
|
||||
code = grub_unicode_shape_code (code, c->attributes);
|
||||
}
|
||||
}
|
||||
else
|
||||
code = c->combining[i].code;
|
||||
|
|
Loading…
Reference in a new issue