LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 11-06-2012, 10:37 AM   #1
Soderlund
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: Slackware
Posts: 119

Rep: Reputation: 50
Problems with TWM + UTF-8


I know UTF-8 isn't fully supported, but I found a work-around (on a NetBSD mailing list) for the bug where TWM would instantly crash when you attempt to start it after enabling UTF-8 (saying "unable to open fontset").

Starting X without TWM does not cause a crash, by the way. It only happens with TWM. The rest of the system -- and X -- work fine with UTF-8.

The work-around

LC_CTYPE should be a non-UTF-8 locale.

Code:
$ cat .xinitrc
...
exec env LC_CTYPE=en_US /usr/bin/twm
This starts TWM, but UTF-8 does not work. If you open files with vim, it says [converted]. echo $LC_CTYPE in XTerm returns en_US, so that's expected.

Enabling UTF-8 in a non-UTF-8 TWM

From X, after starting it that way:

Code:
LC_CTYPE='' xterm
This launches an XTerm with UTF-8, and vim properly handles UTF-8 files. Any other xterms started normally have the LC_CTYPE variable set to "en_US", so...

Setting LC_CTYPE only for TWM

I tried this:

Code:
$ cat .profile
LC_CTYPE=''; export LC_CTYPE
$ cat .bashrc
LC_CTYPE=''
What I want to achieve with this is:
  • TWM starts with LC_CTYPE=en_US without crashing. Check.
  • Every other application launched from TWM has an empty LC_CTYPE, and should therefore use UTF-8 (falling back $LANG?), as if you would have started XTerm using LC_CTYPE='' xterm. Fail.

If I start X with those modifications to .profile and .bashrc, then TWM starts, and LC_CTYPE is empty when you open an XTerm normally, but those XTerms do not use UTF-8. Any UTF-8-files opened in vim contain funky symbols and you can't even enter .

Everything (keyboard and encoding) works fine if you start an XTerm with LC_CTYPE='' xterm, but not otherwise, even though the LC_CTYPE variable is empty in both cases!

Why does it behave like this? I just want LC_CTYPE to be "en_US" for TWM, but not for any other program. That would fix the whole thing.

Thanks in advance.

By the way, the original NetBSD post -- which must be the same bug -- is here:
http://gnats.netbsd.org/41129
 
Old 11-06-2012, 01:30 PM   #2
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
I tested in generic (no extra packagaes) full install of 14.0 in VirtualBox and twm works nicely. I even remember running it under en_US.UTF-8 under 13.37 without a hitch.

What version of Slack?
Attached Images
File Type: png twm-14.0.png (29.0 KB, 31 views)
 
1 members found this post helpful.
Old 11-06-2012, 05:24 PM   #3
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
I've set de_DE.utf8 and twm runs without problems here. Slackware64-14.0.

Are you sure that the errormessage "unable to open fontset" does explicitely depend on using utf8? couldn't it help just to configure for another fontset?

Markus
 
1 members found this post helpful.
Old 11-07-2012, 08:20 AM   #4
Soderlund
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: Slackware
Posts: 119

Original Poster
Rep: Reputation: 50
I use version 14.0 x86.

I've even tried "-*-*-*-*-*--*-*-*-*-*-*-*-*".

I didn't do a full install, so there must be some package missing. I didn't install:
  • KDE
  • KDEI
  • XFCE
  • teTeX
  • emacs
  • Most of the XAP packages

I figured I can't possibly have to install KDE to run TWM, I was going to get texlive, there were no fonts in XAP, and it can't depend on emacs. But since I'm the only one having problems, that must be it.

I see now that teTeX indeed has the Computer Modern fonts, so I'll try that one. It seems odd since everything else works though.

What fonts do you use in your .twmrcs, by the way?

I appreciate the help.
 
Old 11-07-2012, 08:31 AM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Quote:
Originally Posted by Soderlund View Post
...
...
I see now that teTeX indeed has the Computer Modern fonts, so I'll try that one. It seems odd since everything else works though.

What fonts do you use in your .twmrcs, by the way?

I appreciate the help.
I don't have a .twmrc at all. I'd recommend to remove the .twmrc file temporarily (simply mv .twmrc .twmrc.bkp) so that it cannot be read by twm and then start twm. It's possible that you've messed things up with your .twmrc.

Markus
 
1 members found this post helpful.
Old 11-07-2012, 09:05 AM   #6
Soderlund
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: Slackware
Posts: 119

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by markush View Post
I don't have a .twmrc at all. I'd recommend to remove the .twmrc file temporarily (simply mv .twmrc .twmrc.bkp) so that it cannot be read by twm and then start twm. It's possible that you've messed things up with your .twmrc.

Markus
It didn't work; I got the same error, but about the default font.

teTeX didn't solve it either.
 
Old 11-07-2012, 09:11 AM   #7
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Well, what I would do then is rebuild twm from source, the source is in the source-tree from Slackware in x/X11, use the SlackBuild.script.

BTW: I don't believe that the missing series you've mentioned above can be responsible for your issue with twm. If there where packages from l or x missing, I would recommend to install the complete l and x series.

Markus
 
1 members found this post helpful.
Old 11-07-2012, 12:17 PM   #8
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
Quote:
Originally Posted by Soderlund View Post
I figured I can't possibly have to install KDE to run TWM, I was going to get texlive, there were no fonts in XAP, and it can't depend on emacs. But since I'm the only one having problems, that must be it.

I see now that teTeX indeed has the Computer Modern fonts, so I'll try that one. It seems odd since everything else works though.
You don't need *tex or KDE. As Markus said most probably the problem is somewhere else.

Niether is the problem with .twmrc. I don't remember any options to set fonts in twmrc. But you might check the contents of your .Xresources. If you use the default xinitrc for twm, it starts three xterms. It quits when you exit one of the them. It might be the problem with xterm, not twm directly. Ie: if xterm exits, twm will too.

Also, have you installed all the fonts from /x disk set?
 
1 members found this post helpful.
Old 11-08-2012, 09:54 AM   #9
Soderlund
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: Slackware
Posts: 119

Original Poster
Rep: Reputation: 50
Getting rid of the .xinitrc worked! This turned out to be the criminal:

Code:
xrandr -s 800x600 --rate 60
/usr/bin/twm &
exec /usr/bin/xterm
With this, twm always complains missing fonts, but only when using an UTF-8 LC_CTYPE (not if it's c or en_US). The fix is:

Code:
/usr/bin/twm &
sleep 2
xrandr -s 800x600 --rate 60
exec /usr/bin/xterm
I don't know if sleep is necessary, but apparently TWM doesn't like to be started in 800x600 resolution.

The fonts are a bit big now actually, so I guess they are configured for 1600x1200. But I'll sort that out.

Thanks a lot for the help.
 
Old 11-19-2012, 12:21 AM   #10
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
I have to apologies to op. I checked my config several days after responding to this thread and I made two wrong statements.

1. I did use something like this in my xinirc.twm in 13.37:

Code:
LC_CTYPE=en_US /usr/bin/twm
According to GNU Lib C documentation:
Quote:
LC_CTYPE - This category applies to classification and conversion of characters, and to multibyte and wide characters
And it worked, so it seems there was a bug in twm character/string handling. Btw, it seems the bug has been fixed because it works nicely without that in 14.0.

2. There is a section on fonts in twmrc:

Code:
# Fonts
TitleFont       "-*-dejavu sans-bold-*-*-*-12-*-*-*-*-*-*-*"
MenuFont        "-*-dejavu sans-bold-*-*-*-12-*-*-*-*-*-*-*"
IconFont        "-*-dejavu sans-bold-*-*-*-12-*-*-*-*-*-*-*"
IconManagerFont "-*-dejavu sans-bold-*-*-*-12-*-*-*-*-*-*-*"
ResizeFont      "-*-dejavu sans-bold-*-*-*-12-*-*-*-*-*-*-*"
To make up to the author, I'm posting my (tested and working) configs for 14.0.
http://pastebin.com/2UkvNRVK
http://pastebin.com/Di783JB4

And sorry for misleading you with the wrong answer. Memory is a bitch.
 
1 members found this post helpful.
Old 11-19-2012, 08:32 AM   #11
Soderlund
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: Slackware
Posts: 119

Original Poster
Rep: Reputation: 50
No worries. Thanks for posting your configs. I tried them and they work.

But when I inserted "xrandr -s 800x600" before starting twm in your .xinitrc, it says it can't find the fontset.

Code:
xrandr -s 800x600 # Doesn't work
/usr/bin/twm &

/usr/bin/xsetroot -solid $ROOTBGCOLOR -cursor_name $CURSOR &
exec /usr/bin/uxterm -geometry 80x25+0+0
Code:
/usr/bin/twm &
sleep 2; xrandr -s 800x600 # Works

/usr/bin/xsetroot -solid $ROOTBGCOLOR -cursor_name $CURSOR &
exec /usr/bin/uxterm -geometry 80x25+0+0
I don't have this problem in Debian 6, which uses TWM version 1.0.4. Since you had to set LC_CTYPE in Slackware 13.37 (which uses the same TWM version as Wheezy: 1.0.6), I bet this work-around will be required for TWM in Wheezy too.
 
Old 11-19-2012, 11:52 AM   #12
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
Start it in the background (put an ampersand after the command). For example:
Code:
xrandr -s 800x600 &
Btw, if you use my config, you might want to delete the part that defines custom bitmaps. Or replace them with your own.

Code:
# Title bar buttons
ForceIcons
IconDirectory "/home/bocke/.icons/twm"
LeftTitleButton "menu.xbm"=f.menu "winops"
RightTitleButton "iconify.xbm"=f.iconify
RightTitleButton "maximize.xbm"=f.fullzoom
RightTitleButton "close.xbm"=f.delete
There is also a menu item you might want to customize:
Code:
"Play                           "       f.exec "mocp -l /home/bocke/Music/* &"


---------- Post added 11-19-12 at 06:53 PM ----------

Anyway, what's the exact error message? Do you have Dejavu Sans installed on your Debian box?
 
1 members found this post helpful.
Old 11-22-2012, 05:10 AM   #13
Soderlund
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: Slackware
Posts: 119

Original Poster
Rep: Reputation: 50
Does it work for you to start it in the background? I tried and I get the same error.

The error message says:
Code:
twm:  unable to open fontset x
Where "x" is any font.

I tested a few other things, and got some interesting results. This is done from X, after starting it without invoking Xrandr from .xinitrc (thus starting in 1600x1200).

Code:
# 1: Quit TWM, so that no window manager is running
xrandr -s 800x600
xrandr -s 1600x1200
twm &               # Success
Code:
# 1: Quit TWM
xrandr -s 800x600
twm &               # Fails: "Unable to open fontset"
xrandr -s 1600x1200
twm &               # Fails: "Unable to open fontset"
Notice the difference: if I set the resolution to 800x600 and then back to 1600x1200, then TWM starts. But If I set it to 800x600, try to start TWM (which fails), and then switch back 1600x1200, then TWM does not start. It's as if starting TWM in the "wrong" resolution sets some flag somewhere that makes it unable to start for the duration of the X session.

I don't know if I have Dejavu Sans on the Debian partition, but I've tried dozens of fonts and they all give the same error, even though they are in xfontsel.

By the way, xfontsel also says: "Warning: Unable to load any usable fontset"; all fonts show up in xfontsel though.

I appreciate you trying to help me with this, but I think it's hopeless. It must be a bug somewhere, probably in TWM. I see that they have messed with the font setting code recently.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to input non-utf characters from utf-8 linux enviroment? jadas Linux - General 6 02-07-2009 03:20 PM
Converting UTF-16 files to another encoding (such as UTF-8) crisostomo_enrico Solaris / OpenSolaris 3 03-25-2008 05:30 PM
im getting UTF-8 to STRING: Could not open converter from 'UTF-8' to 'ISO-8859-1' jabka Linux - Newbie 2 11-24-2006 05:44 AM
[Enter] in text documents diffrent on Windows and Linux? UTF-8/UTF-16 problem or? brynjarh Linux - General 1 11-24-2004 05:20 AM
X11 / UTF-8 locale seems missing 'fr_FR.UTF-8' chrsitophermann Debian 11 07-17-2004 02:04 PM


All times are GMT -5. The time now is 07:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration