From 4e5a96b02e7561898cee58d7a77c440dfb9f82d2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 11 Jun 2012 00:20:55 +0200 Subject: [PATCH] Remove dor on i and j when combining with above diacritics. * include/grub/unicode.h (GRUB_UNICODE_DOTLESS_LOWERCASE_I): New enum value. (GRUB_UNICODE_DOTLESS_LOWERCASE_J): Likewise. * grub-core/font/font.c (grub_font_construct_dry_run): Replace i and j with dotless variants when any combining above is present. --- ChangeLog | 10 ++++++++++ grub-core/font/font.c | 31 +++++++++++++++++++++---------- include/grub/unicode.h | 2 ++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac15610b1..64fbf7b37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-06-11 Vladimir Serbinenko + + Remove dor on i and j when combining with above diacritics. + + * include/grub/unicode.h (GRUB_UNICODE_DOTLESS_LOWERCASE_I): New enum + value. + (GRUB_UNICODE_DOTLESS_LOWERCASE_J): Likewise. + * grub-core/font/font.c (grub_font_construct_dry_run): Replace i and j + with dotless variants when any combining above is present. + 2012-06-09 Vladimir Serbinenko * tests/grub_script_expansion.in: Explicitly tell grep that we handle diff --git a/grub-core/font/font.c b/grub-core/font/font.c index 1cb2afe1d..fca8c8d00 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -1401,6 +1401,8 @@ grub_font_construct_dry_run (grub_font_t hinted_font, struct grub_font_glyph *main_glyph = NULL; struct grub_font_glyph **combining_glyphs; grub_uint32_t desired_attributes = 0; + unsigned i; + grub_uint32_t base = glyph_id->base; if (combining_glyphs_out) *combining_glyphs_out = NULL; @@ -1411,16 +1413,28 @@ grub_font_construct_dry_run (grub_font_t hinted_font, if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED) desired_attributes |= GRUB_FONT_CODE_LEFT_JOINED; - main_glyph = grub_font_get_glyph_with_fallback (hinted_font, glyph_id->base + + if (base == 'i' || base == 'j') + { + for (i = 0; i < glyph_id->ncomb; i++) + if (glyph_id->combining[i].type == GRUB_UNICODE_STACK_ABOVE) + break; + if (i < glyph_id->ncomb && base == 'i') + base = GRUB_UNICODE_DOTLESS_LOWERCASE_I; + if (i < glyph_id->ncomb && base == 'j') + base = GRUB_UNICODE_DOTLESS_LOWERCASE_J; + } + + main_glyph = grub_font_get_glyph_with_fallback (hinted_font, base | desired_attributes); if (!main_glyph) main_glyph = grub_font_get_glyph_with_fallback (hinted_font, - glyph_id->base); + base); /* Glyph not available in any font. Use ASCII fallback. */ if (!main_glyph) - main_glyph = ascii_glyph_lookup (glyph_id->base); + main_glyph = ascii_glyph_lookup (base); /* Glyph not available in any font. Return unknown glyph. */ if (!main_glyph) @@ -1440,13 +1454,10 @@ grub_font_construct_dry_run (grub_font_t hinted_font, return main_glyph; } - { - unsigned i; - for (i = 0; i < glyph_id->ncomb; i++) - combining_glyphs[i] - = grub_font_get_glyph_with_fallback (main_glyph->font, - glyph_id->combining[i].code); - } + for (i = 0; i < glyph_id->ncomb; i++) + combining_glyphs[i] + = grub_font_get_glyph_with_fallback (main_glyph->font, + glyph_id->combining[i].code); blit_comb (glyph_id, NULL, bounds, main_glyph, combining_glyphs, device_width); diff --git a/include/grub/unicode.h b/include/grub/unicode.h index 22a0df11c..763e25e34 100644 --- a/include/grub/unicode.h +++ b/include/grub/unicode.h @@ -167,6 +167,8 @@ struct grub_unicode_glyph enum { + GRUB_UNICODE_DOTLESS_LOWERCASE_I = 0x0131, + GRUB_UNICODE_DOTLESS_LOWERCASE_J = 0x0237, GRUB_UNICODE_COMBINING_GRAPHEME_JOINER = 0x034f, GRUB_UNICODE_HEBREW_WAW = 0x05d5, GRUB_UNICODE_ARABIC_START = 0x0600,