Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 36004

Summary: updated xft patch for fluxbox-0.9.6.ebuild
Product: Gentoo Linux Reporter: Mamoru KOMACHI (RETIRED) <usata>
Component: New packagesAssignee: Commonbox Team <commonbox>
Status: RESOLVED UPSTREAM    
Severity: enhancement CC: ciaran.mccreesh, ktdeeter, nakano
Priority: High Keywords: EBUILD
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: diff to fluxbox-0.9.6.ebuild
fluxbox-0.9.6-xft.patch
new patch

Description Mamoru KOMACHI (RETIRED) gentoo-dev 2003-12-17 09:11:41 UTC
Hi, here is a patch for fluxbox-0.9.6.ebuild to enable xft2.
fluxbox-0.1.14-r2.ebuild applies the patch but it was removed
from fluxbox-0.9.6.ebuild (it didn't apply to 0.9.6 cleanly).

It was originally taken from momonga linux, at
http://www-v4.momonga-linux.org/cvsweb/cvsweb.cgi/pkgs/fluxbox/fluxbox-0.1.14-AA.patch
(it is inluced to Portage as ${FILESDIR}/fluxbox-0.1.14-ja.patch)
and was modified by nakano to apply fluxbox-0.9.6.ebuild (and he
gave it to me).

I will attach the patch and a diff to fluxbox-0.9.6.ebuild using
"unicode" USE flag to apply it, but I'm not sure if this is the
correct USE flag (it could be "cjk" as in fluxbox-0.1.14-r2.ebuild or
"truetype" because it enables xft2 support).
Comment 1 Mamoru KOMACHI (RETIRED) gentoo-dev 2003-12-17 09:12:25 UTC
Created attachment 22360 [details, diff]
diff to fluxbox-0.9.6.ebuild
Comment 2 Mamoru KOMACHI (RETIRED) gentoo-dev 2003-12-17 09:13:22 UTC
Created attachment 22362 [details, diff]
fluxbox-0.9.6-xft.patch
Comment 3 Ciaran McCreesh 2003-12-19 17:30:53 UTC
I've spoken to fluxgen (one of the fluxbox authors) regarding this patch. He
asks:

This patch forces the use of XftDrawStringUtf8 even though one didn't specify
UTF-8 in any LC_* variable. What's the reason to not use locale_to_utf8 in the
first if-statement and use it where m_utf8mode == false...
Comment 4 Ciaran McCreesh 2003-12-19 17:31:58 UTC
Additional comments from fluxgen:

Please use new/delete instead of C function malloc...
Comment 5 Mamoru KOMACHI (RETIRED) gentoo-dev 2003-12-22 08:10:16 UTC
I'm asking to the patch's author if he would rewrite it. If he
won't, I'll do that. (nakano, who gave me the modified patch, 
said he will help me in doing so)
Comment 6 Brandon Hale (RETIRED) gentoo-dev 2004-01-10 21:39:16 UTC
Any progress here?
Comment 7 Mamoru KOMACHI (RETIRED) gentoo-dev 2004-01-11 08:26:58 UTC
Sorry for the delay. nakano knows the author of the patch personally 
and he contacted him. nakano wrote that the author said he would
rewrite it during new year holidays. nakano is on vacation until
Thursday, so I'll ask him when he returns.
Comment 8 Brandon Hale (RETIRED) gentoo-dev 2004-01-11 09:08:41 UTC
Sounds good, thanks for the update.
Comment 9 Ken Deeter 2004-01-11 18:12:09 UTC
Created attachment 23640 [details, diff]
new patch

new version from patch author.
Summary of Changes:
* changed malloc/free to new/delete
* moved locale_to_utf8 to FbTk/StringUtil.cc
* changes to FbTk/XftFontImp.cc are same as before
Comment 10 Ken Deeter 2004-01-11 18:27:04 UTC
As for the XftDrawStringUtf8 issue, here is a translated response from the author.

<start author's comment>
In the original FbTk/XftFontImp.cc around line 94 is the following code:

#ifdef HAVE_XFT_UTF8_STRING
         if (m_utf8mode) {
                 XftDrawStringUtf8(draw,
                         &xftcolor,
                         m_xftfont,
                         x, y,
                         (XftChar8 *)(text), len);
         } else
 #endif // HAVE_XFT_UTF8_STRING
         {       
                 XftDrawString8(draw,
                         &xftcolor,
                         m_xftfont,
                         x, y,
                         (XftChar8 *)(text), len);
         }

When HAVE_XFT_UTF8_STRING is true and a UTF-8 locale is set (m_utf8mode == true) then the text is a utf-8 string so XftDrawStringUtf8() works fine.

However, when m_utf8mode == false, problems arise, because the code assumes non-utf-8 text to be a single byte encoding. In the case of encodings like euc-jp, where characters are represented using two bytes each, XDrawString8 fails to render correctly.

It might be possibel to use XftDrawString16 in this case, but even in euc-jp, the lower ascii characters are represented using one byte only, so there is an extra step to figure out if characters are represented using 8 bits or 16 bits.

Instead of doing all this work, the patch just converts everything to utf-8 (which is a relatively well defined operation) and uses XftDrawStringUtf8
<end author's comment>

As for the second part of the comment, i think the new patch uses locale_to_utf8 only where m_utf8mode == false.
Comment 11 Brandon Hale (RETIRED) gentoo-dev 2004-01-15 07:41:23 UTC
< fluxgen> tseng: could you make a comment...
< tseng> sure.
< fluxgen> tseng: that the utf8 == false doesn't work with swedish letters
< fluxgen> tseng: somethings wrong with the utf-8 conversion

Could one of you give this a look? Thanks.
Comment 12 Brandon Hale (RETIRED) gentoo-dev 2004-01-15 07:44:40 UTC
< fluxgen> tseng: ah it gets EILSEQ add that to the comment

I'm guessing you know what this means, I'm just the middleman ;)
Comment 13 Ken Deeter 2004-01-15 16:57:56 UTC
I wrote an email to confirm with the patch author, however, from my quick look at it, it seems to just be using iconv for hte conversion so my uneducated guess would be that something is wrong with the iconv setup of whoever is testing it.. but I'll write more once the author gets back to me.
Comment 14 Ken Deeter 2004-01-17 20:21:10 UTC
I've recieved confirmation from the patch author that an EILSEQ means that
there is something wrong with the input to the function. Either iconv is not set up right, the locale is not specified correctly, or something in that vein.

from "man iconv"

EILSEQ An invalid multibyte sequence has been encountered in the input.

Comment 15 Brandon Hale (RETIRED) gentoo-dev 2004-03-13 05:21:37 UTC
If you guys are still working on this, please try and get in touch with fluxgen@fluxbox.org, or in #fluxbox on the same name. Adding this to Fluxbox is his call, im not a fan of patching up Gentoo-only sources when the author seems to be willing to work with you. Keep me updated here. TIA