Re: [PATCH] Small unicode problem fix in normal/menu.c
On Tuesday 05 July 2005 22:36, Vincent Pelletier wrote: > I was also wondering about the font format. Does any editor exists ? Or > is it taken from an existing format ? I'm dying to see Japanese chars on > grub menu while playing the tetris theme :] . I described the format here: http://lists.gnu.org/archive/html/grub-devel/2004-05/msg00020.html GRUB 2 contains a script unifont2pff.rb in the directory util. You can use this script to convert unifont to PFF format. Okuji ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Small unicode problem fix in normal/menu.c
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yoshinori K. Okuji wrote: > You can check in this patch, but this is not the right thing to do. So I prefer not checking it in. I had the idea to start a Unicode debate on how to handle this. My first idea would be : unsigned int grub_putcode(...); unsigned int grub_putchar(...); Ignoring the return value would make those function act as they do now. Reading it would give the number of char actualy displayed on screen. 0 = Unicode char incomplete (for putchar only, for putcode might be "invalid Unicode" if applies) 1 = one char written 2 = a char as wide as 2 "usual chars" (I think I read somewhere it exists) (and so on) I was also wondering about the font format. Does any editor exists ? Or is it taken from an existing format ? I'm dying to see Japanese chars on grub menu while playing the tetris theme :] . Vincent Pelletier -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCyu8zFEQoKRQyjtURAiSiAJ98YnZTCJhAFs0nJPj94PNu0tEDCgCgjvmt cal3c1Ca97j3+ARVBoL9vrg= =6pce -END PGP SIGNATURE- ___ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger T\xE9l\xE9chargez cette version sur http://fr.messenger.yahoo.com ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Small unicode problem fix in normal/menu.c
Marco Gerards <[EMAIL PROTECTED]> writes: > Vincent Pelletier <[EMAIL PROTECTED]> writes: > >> There is an alignment problem when menu is drawn with Unicode chars in >> titles : there aren't enough spaces written on the right to make the >> hilight fill horizontaly the menu. > > This sounds like a bug in the terminal to me. In that case it has to > be fixed in the terminal and not corrected in the menu. It seems I was confused. Okuji, thanks for explaining about unicode. As you all know, unicode, i18n, etc still confuse me a lot. :) -- Marco ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
"Yoshinori K. Okuji" <[EMAIL PROTECTED]> writes: > On Monday 04 July 2005 16:45, Vincent Pelletier wrote: >> ncurses-like (not macros !) : >> >> void grub_getyx (unsigned int &y, unsigned int &x) >> void grub_getmaxyx (unsigned int &y, unsigned int &x) /* to get the term >> size */ > > My feeling is that it is not convenient to use pointers. For example, when I > just want to know if the position is 0 or not in the x axis, I can do this in > the current API: > > if (grub_getxy () >> 8) > > But if I need to use a pointer, this becomes: > > unsigned x; > grub_getyx (0, &x); > if (x) > > Well, this might be just a preference. Yeah, personally I prefer pointers to do this. how about adding: inline unsigned grub_getx (void) { return grub_getxy () >> 8; } Or a macro or so which does the same. Thanks, Marco ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Small unicode problem fix in normal/menu.c
Vincent Pelletier <[EMAIL PROTECTED]> writes: > There is an alignment problem when menu is drawn with Unicode chars in > titles : there aren't enough spaces written on the right to make the > hilight fill horizontaly the menu. This sounds like a bug in the terminal to me. In that case it has to be fixed in the terminal and not corrected in the menu. Thanks, Marco ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yoshinori K. Okuji wrote: > My feeling is that it is not convenient to use pointers. Right. My first idea was to use a struct as return type : struct coords { unsigned char x; unsigned char y; }; So it becomes : if (grub_getxy () .x) Or maybe a struct of bitfields... I feel structs as being cleaner to use compared to shifts. If someday we have a terminal that exceeds 255 chars in one or both dimensions, we wouldn't have to grep "grub_getxy ()" to find the shifts... Vincent Pelletier -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCyjDWFEQoKRQyjtURAg5+AKCv+0nJXOMzaiiQ/+ePXVAOhuvvlgCeN88f 40Oy4FUN5ihK0USgAUl7ypE= =M1Xj -END PGP SIGNATURE- ___ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
On Monday 04 July 2005 16:45, Vincent Pelletier wrote: > ncurses-like (not macros !) : > > void grub_getyx (unsigned int &y, unsigned int &x) > void grub_getmaxyx (unsigned int &y, unsigned int &x) /* to get the term > size */ My feeling is that it is not convenient to use pointers. For example, when I just want to know if the position is 0 or not in the x axis, I can do this in the current API: if (grub_getxy () >> 8) But if I need to use a pointer, this becomes: unsigned x; grub_getyx (0, &x); if (x) Well, this might be just a preference. Okuji ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Small unicode problem fix in normal/menu.c
On Sunday 03 July 2005 22:52, Vincent Pelletier wrote: > There is an alignment problem when menu is drawn with Unicode chars in > titles : there aren't enough spaces written on the right to make the > hilight fill horizontaly the menu. You can check in this patch, but this is not the right thing to do. At the moment, it is impossible to know how many columns will be occupied by putting a byte until it is actually putted. This is very bad, and, of course, does not work well in some cases. So, as I described before, it is necessary to implement a new function which returns the width for a given (Unicode) character. For the menu, I think it would be easier to convert all strings to Unicode strings before rendering. Writing bytes is very, very hard. Okuji ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 About the grub_getxy function... Wouldn't it be better to change it ? ncurses-like (not macros !) : void grub_getyx (unsigned int &y, unsigned int &x) void grub_getmaxyx (unsigned int &y, unsigned int &x) /* to get the term size */ Any comment ? Vincent Pelletier -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCyUuKFEQoKRQyjtURAvbHAJ956t5IBtaSiMsVeJTYtfbTyk2RcgCfcfiB J7BWr/ReX2enuBh4DUSe4a0= =lSNu -END PGP SIGNATURE- ___ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH] Small unicode problem fix in normal/menu.c
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 There is an alignment problem when menu is drawn with Unicode chars in titles : there aren't enough spaces written on the right to make the hilight fill horizontaly the menu. 2005-07-03 Vincent Pelletier <[EMAIL PROTECTED]> * normal/menu.c (grub_print_entry): Rely on getxy to get horizontal position. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCyE/4FEQoKRQyjtURAmzYAJwN8/LK9MSCRTnD7lzPvLEsK560BQCfQSHk FFMUG+Zshn0JM1mxxbZMk+o= =yUWs -END PGP SIGNATURE- Index: normal/menu.c === RCS file: /cvsroot/grub/grub2/normal/menu.c,v retrieving revision 1.11 diff -u -p -r1.11 menu.c --- normal/menu.c 27 Feb 2005 21:19:05 - 1.11 +++ normal/menu.c 3 Jul 2005 20:34:45 - @@ -108,7 +108,7 @@ print_entry (int y, int highlight, grub_ for (x = GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1; x < GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH - GRUB_TERM_MARGIN; - x++) + x=grub_getxy()>>8) { if (*title && x <= GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH - GRUB_TERM_MARGIN - 1) { ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel