Most hebrew diacritics support (except dagesh and final kaf rules)

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-23 21:50:27 +01:00
parent 7624beba47
commit 832d13705c
2 changed files with 64 additions and 6 deletions

View file

@ -1180,7 +1180,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
for (i = 0; i < glyph_id->ncomb; i++) for (i = 0; i < glyph_id->ncomb; i++)
{ {
grub_int16_t space = 0; grub_int16_t space = 0;
grub_int16_t centerx = (bounds.width - combining_glyphs[i]->width) / 2 /* Center by default. */
grub_int16_t targetx = (bounds.width - combining_glyphs[i]->width) / 2
+ bounds.x; + bounds.x;
if (!combining_glyphs[i]) if (!combining_glyphs[i])
@ -1192,7 +1193,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
{ {
case GRUB_UNICODE_COMB_OVERLAY: case GRUB_UNICODE_COMB_OVERLAY:
do_blit (combining_glyphs[i], do_blit (combining_glyphs[i],
centerx, targetx,
(bounds.height - combining_glyphs[i]->height) / 2 (bounds.height - combining_glyphs[i]->height) / 2
-(bounds.height + bounds.y)); -(bounds.height + bounds.y));
if (min_devwidth < combining_glyphs[i]->width) if (min_devwidth < combining_glyphs[i]->width)
@ -1222,20 +1223,59 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
below_rightx += combining_glyphs[i]->width; below_rightx += combining_glyphs[i]->width;
break; break;
case GRUB_UNICODE_COMB_HEBREW_HOLAM:
if (glyph_id->base != GRUB_UNICODE_HEBREW_WAW)
targetx = main_glyph->offset_x - combining_glyphs[i]->width - (combining_glyphs[i]->width + 3) / 4;
goto above_on_main;
case GRUB_UNICODE_COMB_HEBREW_SIN_DOT:
targetx = main_glyph->offset_x + combining_glyphs[i]->width / 4;
goto above_on_main;
case GRUB_UNICODE_COMB_HEBREW_SHIN_DOT:
targetx = main_glyph->width + main_glyph->offset_x - combining_glyphs[i]->width;
above_on_main:
space = combining_glyphs[i]->offset_y
- grub_font_get_xheight (combining_glyphs[i]->font) - 1;
if (space <= 0)
space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
do_blit (combining_glyphs[i], targetx,
-(main_glyph->height + main_glyph->offset_y + space
+ combining_glyphs[i]->height));
if (min_devwidth < combining_glyphs[i]->width)
min_devwidth = combining_glyphs[i]->width;
break;
case GRUB_UNICODE_COMB_HEBREW_RAFE:
case GRUB_UNICODE_STACK_ABOVE: case GRUB_UNICODE_STACK_ABOVE:
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) - 1;
if (space < 0) if (space <= 0)
space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
case GRUB_UNICODE_STACK_ATTACHED_ABOVE: case GRUB_UNICODE_STACK_ATTACHED_ABOVE:
do_blit (combining_glyphs[i], centerx, do_blit (combining_glyphs[i], targetx,
-(bounds.height + bounds.y + space -(bounds.height + bounds.y + space
+ combining_glyphs[i]->height)); + combining_glyphs[i]->height));
if (min_devwidth < combining_glyphs[i]->width) if (min_devwidth < combining_glyphs[i]->width)
min_devwidth = combining_glyphs[i]->width; min_devwidth = combining_glyphs[i]->width;
break; break;
case GRUB_UNICODE_COMB_HEBREW_SHEVA:
case GRUB_UNICODE_COMB_HEBREW_HIRIQ:
case GRUB_UNICODE_COMB_HEBREW_QAMATS:
case GRUB_UNICODE_COMB_HEBREW_TSERE:
case GRUB_UNICODE_COMB_HEBREW_SEGOL:
/* ,
GRUB_UNICODE_COMB_HEBREW_DAGESH = 21*/
/* TODO: placement in final kaf and under reish. */
case GRUB_UNICODE_COMB_HEBREW_HATAF_SEGOL:
case GRUB_UNICODE_COMB_HEBREW_HATAF_PATAH:
case GRUB_UNICODE_COMB_HEBREW_HATAF_QAMATS:
case GRUB_UNICODE_COMB_HEBREW_PATAH:
case GRUB_UNICODE_COMB_HEBREW_QUBUTS:
case GRUB_UNICODE_COMB_HEBREW_METEG:
/* I don't know how ypogegrammeni differs from subscript. */ /* I don't know how ypogegrammeni differs from subscript. */
case GRUB_UNICODE_COMB_YPOGEGRAMMENI: case GRUB_UNICODE_COMB_YPOGEGRAMMENI:
case GRUB_UNICODE_STACK_BELOW: case GRUB_UNICODE_STACK_BELOW:
@ -1245,7 +1285,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8; space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
case GRUB_UNICODE_STACK_ATTACHED_BELOW: case GRUB_UNICODE_STACK_ATTACHED_BELOW:
do_blit (combining_glyphs[i], centerx, do_blit (combining_glyphs[i], targetx,
-(bounds.y - space)); -(bounds.y - space));
if (min_devwidth < combining_glyphs[i]->width) if (min_devwidth < combining_glyphs[i]->width)
min_devwidth = combining_glyphs[i]->width; min_devwidth = combining_glyphs[i]->width;

View file

@ -65,6 +65,23 @@ enum grub_comb_type
{ {
GRUB_UNICODE_COMB_NONE = 0, GRUB_UNICODE_COMB_NONE = 0,
GRUB_UNICODE_COMB_OVERLAY = 1, GRUB_UNICODE_COMB_OVERLAY = 1,
GRUB_UNICODE_COMB_HEBREW_SHEVA = 10,
GRUB_UNICODE_COMB_HEBREW_HATAF_SEGOL = 11,
GRUB_UNICODE_COMB_HEBREW_HATAF_PATAH = 12,
GRUB_UNICODE_COMB_HEBREW_HATAF_QAMATS = 13,
GRUB_UNICODE_COMB_HEBREW_HIRIQ = 14,
GRUB_UNICODE_COMB_HEBREW_TSERE = 15,
GRUB_UNICODE_COMB_HEBREW_SEGOL = 16,
GRUB_UNICODE_COMB_HEBREW_PATAH = 17,
GRUB_UNICODE_COMB_HEBREW_QAMATS = 18,
GRUB_UNICODE_COMB_HEBREW_HOLAM = 19,
GRUB_UNICODE_COMB_HEBREW_QUBUTS = 20,
GRUB_UNICODE_COMB_HEBREW_DAGESH = 21,
GRUB_UNICODE_COMB_HEBREW_METEG = 22,
GRUB_UNICODE_COMB_HEBREW_RAFE = 23,
GRUB_UNICODE_COMB_HEBREW_SHIN_DOT = 24,
GRUB_UNICODE_COMB_HEBREW_SIN_DOT = 25,
GRUB_UNICODE_COMB_HEBREW_VARIKA = 26,
GRUB_UNICODE_STACK_ATTACHED_BELOW = 202, GRUB_UNICODE_STACK_ATTACHED_BELOW = 202,
GRUB_UNICODE_STACK_ATTACHED_ABOVE = 214, GRUB_UNICODE_STACK_ATTACHED_ABOVE = 214,
GRUB_UNICODE_COMB_ATTACHED_ABOVE_RIGHT = 216, GRUB_UNICODE_COMB_ATTACHED_ABOVE_RIGHT = 216,
@ -103,6 +120,7 @@ struct grub_unicode_glyph
#define GRUB_UNICODE_VARIATION_SELECTOR_16 0xfe0f #define GRUB_UNICODE_VARIATION_SELECTOR_16 0xfe0f
#define GRUB_UNICODE_VARIATION_SELECTOR_17 0xe0100 #define GRUB_UNICODE_VARIATION_SELECTOR_17 0xe0100
#define GRUB_UNICODE_VARIATION_SELECTOR_256 0xe01ef #define GRUB_UNICODE_VARIATION_SELECTOR_256 0xe01ef
#define GRUB_UNICODE_HEBREW_WAW 0x05d5
extern struct grub_unicode_compact_range grub_unicode_compact[]; extern struct grub_unicode_compact_range grub_unicode_compact[];
extern struct grub_unicode_bidi_pair grub_unicode_bidi_pairs[]; extern struct grub_unicode_bidi_pair grub_unicode_bidi_pairs[];