* [PATCH] Small unicode problem fix in normal/menu.c
@ 2005-07-03 20:52 Vincent Pelletier
2005-07-04 14:45 ` [Bulk] " Vincent Pelletier
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Vincent Pelletier @ 2005-07-03 20:52 UTC (permalink / raw)
To: Grub-devel
[-- Attachment #1: Type: text/plain, Size: 555 bytes --]
-----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 <subdino2004@yahoo.fr>
* 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-----
[-- Attachment #2: menu_unicode.diff --]
[-- Type: text/plain, Size: 633 bytes --]
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 -0000 1.11
+++ normal/menu.c 3 Jul 2005 20:34:45 -0000
@@ -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)
{
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
2005-07-03 20:52 [PATCH] Small unicode problem fix in normal/menu.c Vincent Pelletier
@ 2005-07-04 14:45 ` Vincent Pelletier
2005-07-04 23:10 ` Yoshinori K. Okuji
2005-07-04 22:42 ` Yoshinori K. Okuji
2005-07-05 9:58 ` Marco Gerards
2 siblings, 1 reply; 10+ messages in thread
From: Vincent Pelletier @ 2005-07-04 14:45 UTC (permalink / raw)
To: The development of GRUB 2
-----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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Small unicode problem fix in normal/menu.c
2005-07-03 20:52 [PATCH] Small unicode problem fix in normal/menu.c Vincent Pelletier
2005-07-04 14:45 ` [Bulk] " Vincent Pelletier
@ 2005-07-04 22:42 ` Yoshinori K. Okuji
2005-07-05 20:36 ` Vincent Pelletier
2005-07-05 9:58 ` Marco Gerards
2 siblings, 1 reply; 10+ messages in thread
From: Yoshinori K. Okuji @ 2005-07-04 22:42 UTC (permalink / raw)
To: The development of GRUB 2
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
2005-07-04 14:45 ` [Bulk] " Vincent Pelletier
@ 2005-07-04 23:10 ` Yoshinori K. Okuji
2005-07-05 7:03 ` Vincent Pelletier
2005-07-05 10:07 ` Marco Gerards
0 siblings, 2 replies; 10+ messages in thread
From: Yoshinori K. Okuji @ 2005-07-04 23:10 UTC (permalink / raw)
To: The development of GRUB 2
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
2005-07-04 23:10 ` Yoshinori K. Okuji
@ 2005-07-05 7:03 ` Vincent Pelletier
2005-07-05 10:07 ` Marco Gerards
1 sibling, 0 replies; 10+ messages in thread
From: Vincent Pelletier @ 2005-07-05 7:03 UTC (permalink / raw)
To: The development of GRUB 2
-----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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Small unicode problem fix in normal/menu.c
2005-07-03 20:52 [PATCH] Small unicode problem fix in normal/menu.c Vincent Pelletier
2005-07-04 14:45 ` [Bulk] " Vincent Pelletier
2005-07-04 22:42 ` Yoshinori K. Okuji
@ 2005-07-05 9:58 ` Marco Gerards
2005-07-05 10:46 ` Marco Gerards
2 siblings, 1 reply; 10+ messages in thread
From: Marco Gerards @ 2005-07-05 9:58 UTC (permalink / raw)
To: The development of GRUB 2
Vincent Pelletier <subdino2004@yahoo.fr> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c
2005-07-04 23:10 ` Yoshinori K. Okuji
2005-07-05 7:03 ` Vincent Pelletier
@ 2005-07-05 10:07 ` Marco Gerards
1 sibling, 0 replies; 10+ messages in thread
From: Marco Gerards @ 2005-07-05 10:07 UTC (permalink / raw)
To: The development of GRUB 2
"Yoshinori K. Okuji" <okuji@enbug.org> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Small unicode problem fix in normal/menu.c
2005-07-05 9:58 ` Marco Gerards
@ 2005-07-05 10:46 ` Marco Gerards
0 siblings, 0 replies; 10+ messages in thread
From: Marco Gerards @ 2005-07-05 10:46 UTC (permalink / raw)
To: The development of GRUB 2
Marco Gerards <metgerards@student.han.nl> writes:
> Vincent Pelletier <subdino2004@yahoo.fr> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Small unicode problem fix in normal/menu.c
2005-07-04 22:42 ` Yoshinori K. Okuji
@ 2005-07-05 20:36 ` Vincent Pelletier
2005-07-09 7:01 ` Yoshinori K. Okuji
0 siblings, 1 reply; 10+ messages in thread
From: Vincent Pelletier @ 2005-07-05 20:36 UTC (permalink / raw)
To: The development of GRUB 2
-----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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Small unicode problem fix in normal/menu.c
2005-07-05 20:36 ` Vincent Pelletier
@ 2005-07-09 7:01 ` Yoshinori K. Okuji
0 siblings, 0 replies; 10+ messages in thread
From: Yoshinori K. Okuji @ 2005-07-09 7:01 UTC (permalink / raw)
To: The development of GRUB 2
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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-07-09 7:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-03 20:52 [PATCH] Small unicode problem fix in normal/menu.c Vincent Pelletier
2005-07-04 14:45 ` [Bulk] " Vincent Pelletier
2005-07-04 23:10 ` Yoshinori K. Okuji
2005-07-05 7:03 ` Vincent Pelletier
2005-07-05 10:07 ` Marco Gerards
2005-07-04 22:42 ` Yoshinori K. Okuji
2005-07-05 20:36 ` Vincent Pelletier
2005-07-09 7:01 ` Yoshinori K. Okuji
2005-07-05 9:58 ` Marco Gerards
2005-07-05 10:46 ` Marco Gerards
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.