[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] multistring support in gui_label

From: Vladimir Testov
Subject: Re: [PATCH] multistring support in gui_label
Date: Tue, 16 Apr 2013 13:04:28 +0400
User-agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; )

>Please don't use // comments.
O.k. I won't.
>This code completely forgets the cases
>when even the first word doesn't fit in the available space.

Mmm. It can handle this case actually.

>The code as whole breaks some unicode concepts like e.g. bidi stack.

Didn't get what you mean.

>Could you reuse the already available line-vreaking algorithm in
>normal/term.c and normal/charset.c ? Since the line-breaking is
>artificially disabled for labels it should require only minor
>adjustments to be reenabled.

Yep! Here it is (patch included)!

Nevertheless, two problems appeared and I don't sure how exactly should I fix 
1) Handling of some long word. If this word is not first in line and it's 
length is more than label's width
then the length of the first fragment of the word will be counted as if it will 
be drawn on the same line,
but actually it will be printed on the next line.
2) There is funny handling of UTF-8 symbols. Each symbol have "device_width" 
which is used in calculation of string's length. But, when we are going to 
actually print a symbol,
it's length (with spaces) is calculated in other way. First, all symbols that 
have special connection with
current symbol are looked through. Then device_width is replaced with maximum 
of printed lengths in all cases.
So, for some special symbols (eg "`", used in @KEYMAP_LONG@) actual length 
will be more than pre-counted.

How should I fix these problems?
1st one - for example, I can slightly update line-breaking mechanism.
2nd one - more interesting, harder. I suggest utf-8 printing mechanism 
(charset.c unicode.c etc) should be remade. So symbol connections will be 
counted in more intelligent way (e.g. while counting spaces - take into 
consideration nearby symbols). It is interesting. :) I can do it. Would be 
happy, if someone could give me some advices.

text = "@KEYMAP_LONG@"
t is misprinted

text = "short short short 
See how the line-breaking works.

With best regards,
Vladimir Testov, ROSA Laboratory.

Attachment: Problem1.png
Description: PNG image

Attachment: problem2.png
Description: PNG image

Attachment: grub-2.00-label-multistring.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]