Support for 3 more combining marks types
This commit is contained in:
parent
97ea65d432
commit
82c5d8dcfc
3 changed files with 149 additions and 104 deletions
|
@ -63,3 +63,4 @@ stamp-h1
|
||||||
stamp-h.in
|
stamp-h.in
|
||||||
symlist.c
|
symlist.c
|
||||||
update-grub_lib
|
update-grub_lib
|
||||||
|
unidata.c
|
||||||
|
|
59
font/font.c
59
font/font.c
|
@ -1163,6 +1163,21 @@ grub_font_construct_glyph (grub_font_t hinted_font,
|
||||||
combtype = get_comb_type (glyph_id->combining[i]);
|
combtype = get_comb_type (glyph_id->combining[i]);
|
||||||
switch (combtype)
|
switch (combtype)
|
||||||
{
|
{
|
||||||
|
case GRUB_UNICODE_COMB_OVERLAY:
|
||||||
|
if (height < combining_glyphs[i]->height)
|
||||||
|
{
|
||||||
|
offset_y -= (combining_glyphs[i]->height - height) / 2;
|
||||||
|
height = combining_glyphs[i]->height;
|
||||||
|
}
|
||||||
|
if (width < combining_glyphs[i]->width)
|
||||||
|
{
|
||||||
|
offset_x -= (combining_glyphs[i]->width - width) / 2;
|
||||||
|
width = combining_glyphs[i]->width;
|
||||||
|
}
|
||||||
|
if (device_width < combining_glyphs[i]->width)
|
||||||
|
device_width = combining_glyphs[i]->width;
|
||||||
|
break;
|
||||||
|
|
||||||
case GRUB_UNICODE_STACK_ABOVE:
|
case GRUB_UNICODE_STACK_ABOVE:
|
||||||
{
|
{
|
||||||
grub_int16_t space;
|
grub_int16_t space;
|
||||||
|
@ -1261,40 +1276,45 @@ grub_font_construct_glyph (grub_font_t hinted_font,
|
||||||
for (i = 0; i < glyph_id->ncomb; i++)
|
for (i = 0; i < glyph_id->ncomb; i++)
|
||||||
{
|
{
|
||||||
enum grub_comb_type combtype;
|
enum grub_comb_type combtype;
|
||||||
|
grub_int16_t space = 0;
|
||||||
|
|
||||||
if (!combining_glyphs[i])
|
if (!combining_glyphs[i])
|
||||||
continue;
|
continue;
|
||||||
combtype = get_comb_type (glyph_id->combining[i]);
|
combtype = get_comb_type (glyph_id->combining[i]);
|
||||||
switch (combtype)
|
switch (combtype)
|
||||||
{
|
{
|
||||||
|
case GRUB_UNICODE_COMB_OVERLAY:
|
||||||
|
grub_font_blit_glyph (glyph, combining_glyphs[i],
|
||||||
|
(width - combining_glyphs[i]->width) / 2,
|
||||||
|
(height - combining_glyphs[i]->height) / 2);
|
||||||
|
break;
|
||||||
|
|
||||||
case GRUB_UNICODE_STACK_ABOVE:
|
case GRUB_UNICODE_STACK_ABOVE:
|
||||||
{
|
|
||||||
grub_int16_t space;
|
|
||||||
space = combining_glyphs[i]->offset_y
|
space = combining_glyphs[i]->offset_y
|
||||||
- grub_font_get_xheight (combining_glyphs[i]->font);
|
- grub_font_get_xheight (combining_glyphs[i]->font);
|
||||||
if (space < 0)
|
if (space < 0)
|
||||||
space = 1;
|
space = 1;
|
||||||
|
|
||||||
|
case GRUB_UNICODE_STACK_ATTACHED_ABOVE:
|
||||||
|
|
||||||
curtop += combining_glyphs[i]->height + space;
|
curtop += combining_glyphs[i]->height + space;
|
||||||
grub_font_blit_glyph (glyph, combining_glyphs[i],
|
grub_font_blit_glyph (glyph, combining_glyphs[i],
|
||||||
(width - combining_glyphs[i]->width) / 2,
|
(width - combining_glyphs[i]->width) / 2,
|
||||||
(height + offset_y) - curtop);
|
(height + offset_y) - curtop);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_UNICODE_STACK_BELOW:
|
case GRUB_UNICODE_STACK_BELOW:
|
||||||
{
|
|
||||||
grub_int16_t space;
|
|
||||||
space = -(combining_glyphs[i]->offset_y
|
space = -(combining_glyphs[i]->offset_y
|
||||||
+ combining_glyphs[i]->height);
|
+ combining_glyphs[i]->height);
|
||||||
if (space < 0)
|
if (space < 0)
|
||||||
space = 1;
|
space = 1;
|
||||||
|
|
||||||
|
case GRUB_UNICODE_STACK_ATTACHED_BELOW:
|
||||||
curbottom -= space;
|
curbottom -= space;
|
||||||
grub_font_blit_glyph (glyph, combining_glyphs[i],
|
grub_font_blit_glyph (glyph, combining_glyphs[i],
|
||||||
(width - combining_glyphs[i]->width) / 2,
|
(width - combining_glyphs[i]->width) / 2,
|
||||||
(height + offset_y) - curbottom);
|
(height + offset_y) - curbottom);
|
||||||
curbottom -= combining_glyphs[i]->height;
|
curbottom -= combining_glyphs[i]->height;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1525,6 +1545,8 @@ grub_err_bidi_logical_to_visual (grub_uint32_t *logical,
|
||||||
|
|
||||||
cur_level = base_level;
|
cur_level = base_level;
|
||||||
cur_override = OVERRIDE_NEUTRAL;
|
cur_override = OVERRIDE_NEUTRAL;
|
||||||
|
{
|
||||||
|
unsigned last_comb_pointer = 0;
|
||||||
for (i = 0; i < logical_len; i++)
|
for (i = 0; i < logical_len; i++)
|
||||||
{
|
{
|
||||||
/* Variation selectors >= 17 are outside of BMP and SMP.
|
/* Variation selectors >= 17 are outside of BMP and SMP.
|
||||||
|
@ -1575,8 +1597,14 @@ grub_err_bidi_logical_to_visual (grub_uint32_t *logical,
|
||||||
if (comb_type)
|
if (comb_type)
|
||||||
{
|
{
|
||||||
grub_uint32_t *n;
|
grub_uint32_t *n;
|
||||||
|
unsigned j;
|
||||||
|
|
||||||
if (!visual_len)
|
if (!visual_len)
|
||||||
break;
|
break;
|
||||||
|
if (comb_type == GRUB_UNICODE_COMB_MC
|
||||||
|
|| comb_type == GRUB_UNICODE_COMB_ME
|
||||||
|
|| comb_type == GRUB_UNICODE_COMB_MN)
|
||||||
|
last_comb_pointer = visual[visual_len - 1].ncomb;
|
||||||
n = grub_realloc (visual[visual_len - 1].combining,
|
n = grub_realloc (visual[visual_len - 1].combining,
|
||||||
sizeof (grub_uint32_t)
|
sizeof (grub_uint32_t)
|
||||||
* (visual[visual_len - 1].ncomb + 1));
|
* (visual[visual_len - 1].ncomb + 1));
|
||||||
|
@ -1585,16 +1613,27 @@ grub_err_bidi_logical_to_visual (grub_uint32_t *logical,
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (j = last_comb_pointer;
|
||||||
|
j < visual[visual_len - 1].ncomb; j++)
|
||||||
|
if (get_comb_type (visual[visual_len - 1].combining[j])
|
||||||
|
> comb_type)
|
||||||
|
break;
|
||||||
|
grub_memmove (visual[visual_len - 1].combining + j + 1,
|
||||||
|
visual[visual_len - 1].combining + j,
|
||||||
|
(visual[visual_len - 1].ncomb - j)
|
||||||
|
* sizeof (visual[visual_len - 1].combining[0]));
|
||||||
visual[visual_len - 1].combining = n;
|
visual[visual_len - 1].combining = n;
|
||||||
visual[visual_len - 1].combining[visual[visual_len - 1].ncomb]
|
visual[visual_len - 1].combining[j] = logical[i];
|
||||||
= logical[i];
|
|
||||||
visual[visual_len - 1].ncomb++;
|
visual[visual_len - 1].ncomb++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
last_comb_pointer = 0;
|
||||||
levels[visual_len] = cur_level;
|
levels[visual_len] = cur_level;
|
||||||
if (cur_override != OVERRIDE_NEUTRAL)
|
if (cur_override != OVERRIDE_NEUTRAL)
|
||||||
resolved_types[visual_len] =
|
resolved_types[visual_len] =
|
||||||
(cur_override == OVERRIDE_L) ? GRUB_BIDI_TYPE_L : GRUB_BIDI_TYPE_R;
|
(cur_override == OVERRIDE_L) ? GRUB_BIDI_TYPE_L
|
||||||
|
: GRUB_BIDI_TYPE_R;
|
||||||
else
|
else
|
||||||
resolved_types[visual_len] = type;
|
resolved_types[visual_len] = type;
|
||||||
visual[visual_len].base = logical[i];
|
visual[visual_len].base = logical[i];
|
||||||
|
@ -1606,6 +1645,7 @@ grub_err_bidi_logical_to_visual (grub_uint32_t *logical,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (run_start = 0; run_start < visual_len; run_start = run_end)
|
for (run_start = 0; run_start < visual_len; run_start = run_end)
|
||||||
{
|
{
|
||||||
|
@ -1781,6 +1821,7 @@ grub_err_bidi_logical_to_visual (grub_uint32_t *logical,
|
||||||
if (levels[i] < min_odd_level && (levels[i] & 1))
|
if (levels[i] < min_odd_level && (levels[i] & 1))
|
||||||
min_odd_level = levels[i];
|
min_odd_level = levels[i];
|
||||||
}
|
}
|
||||||
|
/* FIXME: can be optimized. */
|
||||||
for (j = max_level; j >= min_odd_level; j--)
|
for (j = max_level; j >= min_odd_level; j--)
|
||||||
{
|
{
|
||||||
unsigned in = 0;
|
unsigned in = 0;
|
||||||
|
|
|
@ -55,6 +55,9 @@ enum grub_bidi_type
|
||||||
|
|
||||||
enum grub_comb_type
|
enum grub_comb_type
|
||||||
{
|
{
|
||||||
|
GRUB_UNICODE_COMB_OVERLAY = 1,
|
||||||
|
GRUB_UNICODE_STACK_ATTACHED_BELOW = 202,
|
||||||
|
GRUB_UNICODE_STACK_ATTACHED_ABOVE = 214,
|
||||||
GRUB_UNICODE_STACK_BELOW = 220,
|
GRUB_UNICODE_STACK_BELOW = 220,
|
||||||
GRUB_UNICODE_STACK_ABOVE = 230,
|
GRUB_UNICODE_STACK_ABOVE = 230,
|
||||||
/* If combining nature is indicated only by class and
|
/* If combining nature is indicated only by class and
|
||||||
|
|
Loading…
Reference in a new issue