]> git.proxmox.com Git - grub2.git/commitdiff
* grub-core/normal/charset.c (grub_bidi_logical_to_visual): Add
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 2 Mar 2013 10:47:59 +0000 (11:47 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 2 Mar 2013 10:47:59 +0000 (11:47 +0100)
hook pass-through parameter. All users updated and unnested.

grub-core/gfxmenu/font.c
grub-core/normal/charset.c
grub-core/normal/term.c
include/grub/unicode.h

index 81a689d6c795b76780c738914f7dc8d1e67354ec..717483786008d10b89af2945c2a9aea467e667a3 100644 (file)
@@ -52,7 +52,7 @@ grub_font_draw_string (const char *str, grub_font_t font,
     return grub_errno;
 
   visual_len = grub_bidi_logical_to_visual (logical, logical_len, &visual,
-                                           0, 0, 0, 0, 0, 0);
+                                           0, 0, 0, 0, 0, 0, 0);
   grub_free (logical);
   if (visual_len < 0)
     return grub_errno;
index bd9fbf4d18ef73b9bb51140f265398742d20008f..ab3101b00327701176cbd4388a4ee53b6da4c371 100644 (file)
@@ -512,7 +512,8 @@ static grub_ssize_t
 bidi_line_wrap (struct grub_unicode_glyph *visual_out,
                struct grub_unicode_glyph *visual,
                grub_size_t visual_len, unsigned *levels,
-               grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
+               grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
+               void *getcharwidth_arg,
                grub_size_t maxwidth, grub_size_t startwidth,
                grub_uint32_t contchar,
                struct grub_term_pos *pos, int primitive_wrap,
@@ -577,7 +578,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
        }
 
       if (getcharwidth && k != visual_len)
-       line_width += last_width = getcharwidth (&visual[k]);
+       line_width += last_width = getcharwidth (&visual[k], getcharwidth_arg);
 
       if (k != visual_len && (visual[k].base == ' '
                              || visual[k].base == '\t')
@@ -752,7 +753,8 @@ static grub_ssize_t
 grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
                                  grub_size_t logical_len,
                                  struct grub_unicode_glyph *visual_out,
-                                 grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
+                                 grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
+                                 void *getcharwidth_arg,
                                  grub_size_t maxwidth, grub_size_t startwidth,
                                  grub_uint32_t contchar,
                                  struct grub_term_pos *pos,
@@ -1116,7 +1118,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
   {
     grub_ssize_t ret;
     ret = bidi_line_wrap (visual_out, visual, visual_len, levels, 
-                         getcharwidth, maxwidth, startwidth, contchar,
+                         getcharwidth, getcharwidth_arg, maxwidth, startwidth, contchar,
                          pos, primitive_wrap, log_end);
     grub_free (levels);
     grub_free (visual);
@@ -1128,7 +1130,8 @@ grub_ssize_t
 grub_bidi_logical_to_visual (const grub_uint32_t *logical,
                             grub_size_t logical_len,
                             struct grub_unicode_glyph **visual_out,
-                            grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
+                            grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
+                            void *getcharwidth_arg,
                             grub_size_t max_length, grub_size_t startwidth,
                             grub_uint32_t contchar, struct grub_term_pos *pos, int primitive_wrap)
 {
@@ -1147,6 +1150,7 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical,
                                                  ptr - line_start,
                                                  visual_ptr,
                                                  getcharwidth,
+                                                 getcharwidth_arg,
                                                  max_length,
                                                  startwidth,
                                                  contchar,
index dc03268aec170b22a4a12383d9087a46fcf0dcb3..ae91071cf77aee230663089a643eb2407b6c6a25 100644 (file)
@@ -840,6 +840,12 @@ print_backlog (struct grub_term_output *term,
   return 0;
 }
 
+static grub_ssize_t
+getcharwidth (const struct grub_unicode_glyph *c, void *term)
+{
+  return grub_term_getcharwidth (term, c);
+}
+
 static int
 print_ucs4_real (const grub_uint32_t * str,
                 const grub_uint32_t * last_position,
@@ -881,14 +887,8 @@ print_ucs4_real (const grub_uint32_t * str,
       int ret;
       struct grub_unicode_glyph *vptr;
 
-      auto grub_ssize_t getcharwidth (const struct grub_unicode_glyph *c);
-      grub_ssize_t getcharwidth (const struct grub_unicode_glyph *c)
-      {
-       return grub_term_getcharwidth (term, c);
-      }
-
       visual_len = grub_bidi_logical_to_visual (str, last_position - str,
-                                               &visual, getcharwidth,
+                                               &visual, getcharwidth, term,
                                                get_maxwidth (term, 
                                                              margin_left,
                                                              margin_right),
index eb5051a4399dc61a91bc3f958b02a7e75a52c84c..5a96a196f409cd53f7eb7ab3e08a71c83920bf5d 100644 (file)
@@ -240,7 +240,8 @@ grub_ssize_t
 grub_bidi_logical_to_visual (const grub_uint32_t *logical,
                             grub_size_t logical_len,
                             struct grub_unicode_glyph **visual_out,
-                            grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
+                            grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
+                            void *getcharwidth_arg,
                             grub_size_t max_width,
                             grub_size_t start_width, grub_uint32_t codechar,
                             struct grub_term_pos *pos,