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

Re: Several X applications refuse to start



On Thu, 28 Oct 2004, Sean Perry wrote:

1) what locale? try C.
tillea@sputnik:~$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C
tillea@sputnik:~$ emacs
X protocol error: BadValue (integer parameter out of range for operation) on protocol request 45
Fatal error (6).Aborted

2) this looks like a font issue (as you mentioned) try forcing the app to load 'fixed' as its font.
I also tend to see the problem in finding the right fonts.  When looking at
the strace output all applications I mentioned (emacs, xdvi, gv) have certain
problems with fonts, but I have neigther an idea how to force fixed fonts
nor how to fix the problem.  Regarding to the things I changed with the fonts
I was following some hints from

   http://www.paulandlesley.org/linux/xfree4_tt.html#FONTS-FILES

which might be summed up in this script:

   MSTTFONTDIR=/usr/share/fonts/truetype/msttcorefonts

   cd ${MSTTFONTDIR}
   ttmkfdir -o fonts.scale
   head -1 fonts.scale > fonts.dir
   tail +2 fonts.scale | tac >> fonts.dir
   cp fonts.dir fonts.scale
   cd /etc/X11/fonts/TrueType
   cp -a ${MSTTFONTDIR}/fonts.dir .
   # the following script was downloaded via the link I mentioned above
   #   because the site has moved it is attached to this mail
   /tmp/download/mkfontalias.py
   grep 'iso8859-1"' fonts.alias > msttcorefonts.alias
   rm -f fonts.dir fonts.alias
   update-fonts-alias TrueType

I had to do this to get MagicPoint working with TrueType fonts.  I hope that
this did not break other important things.

Any font expert here who might see the problem?

Kind regards

        Andreas.
#!/usr/bin/python
#
# This is a short python utility to assist people in de-uglification of 
# their true type fonts. Basically, creates a fonts.alias file from the 
# fonts.dir file found in the directory.
#
# Consider this software to be under GPL.
#
# Roman Sulzhyk, Starmedia Networks, 2000. roman@starmedia.net
# --
# 20.05.2000: Added common MS webfonts as fontnames to map:
# Verdana, Tahoma, Impact, Arial Black, Comic Sans MS, Georgia, Trebuchet MS.
# R.K.Aa. dark@c2i.net 
# --
# 21.05.2000: Added 'cheating' - sizes 6,7 and 8 now map to 9 point fonts.
# --
import sys, string, os

_font_sizes = range(6, 16) + [ 18, 24 ]
_infile = 'fonts.dir'
_outfile = 'fonts.alias'

# Resolution
_res = [ '75', '75' ]

# Do 'cheating' to make sizes 6,7,8 as 9 bit fonts
_cheat_map = { 6 : 9,
               7 : 9,
               8 : 9 }

# The fonts to map. Format name : alias
_font_map = { 'Arial' : 'Arial',
         'Times New Roman' : 'Times New Roman',
         'Verdana' : 'Verdana',
         'Tahoma' : 'Tahoma',
         'Impact' : 'Impact',
         'Arial Black' : 'Arial Black',
         'Comic Sans MS' : 'Comic Sans MS',
         'Georgia' : 'Georgia',
         'Trebuchet MS' : 'Trebuchet MS',
         'Courier New' : 'Courier New' }

# Read in the fonts.
try:
    # Strip the first line
    fonts = open ( _infile ).readlines()[1:]
except IOError, val:
    sys.stderr.write ( 'Cannot read %s (%s) - are you sure you are in the '
                       'fonts directory?\n' % (_infile, val) )
    sys.exit(1)

# Now, create the output
_aliases = []
for line in fonts:
    try:
        # Get rid of the first entry, but mind that other may have 
        # spaces in them
        font = string.strip(string.join ( string.split ( line, ' ' )[1:], ' '))
    except IndexError:
        sys.stderr.write ( 'Cannot parse %s line: %s\n' % (_infile, line ) )
        sys.exit(1)

    entries = string.split ( font, '-' )

    if len(entries) != 15:
        # Seems to be invalid
        sys.stdrr.write ( 'Invalid font: %s\n' % (font) )
        sys.exit(1)

    name = entries[2]

    map = _font_map.get ( name, None )

    if map:
        # Create a bunch of aliases, for each size
        for size in _font_sizes:
            # Do the 'cheating' - fallback to size if not in the cheat map
            real_size = _cheat_map.get ( size, size )

            name = string.join ( entries[:7] + [ str(real_size), 
                                                 str(real_size * 10) ] + 
                                 entries[9:], '-' )

            alias = string.join ( entries[:2] + [map] + entries[3:7] + 
                                 [ str(size), str(size * 10) ] + 
                                  _res + entries[11:], '-' )

            # Add the entry to the aliases
            _aliases.append ( '"%s" "%s"' % (alias, name) )

# Boast
print 'Created %s aliases' % len(_aliases)

# Backup the existing file
_bak = _outfile + '.bak' 
if os.path.exists ( _outfile ) and not os.path.exists ( _bak ):
    try:
        os.rename ( _outfile, _bak )
    except OSError, val:
        sys.stderr.write ( 'Cannot backup %s to %s: %s\n' % (_outfile, _bak, 
                           val) )
        sys.exit(1)
    else:
        print 'Backed up existing %s to %s' % (_outfile, _bak) 

# Ok, write the file
try:
    _out = open ( _outfile, 'w' )
except IOError, val:
    sys.stderr.write ( 'Cannot open %s for writing: %s\n' % (_outfile, val) )
    sys.exit(1)

_out.write ( string.join ( _aliases, '\n' ) )
_out.close()

print 'Wrote aliases to %s' % _outfile

Reply to: