2008-06-10 by sourpoi in misc, tagged: xterm vim arabic

The issue was that vim -A did not work in Fedora 9 using xterm (in Blackbox). Assuming this font is available, a solution is:

xterm -u8 -fn '-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1' &

The journey follows..

  1. Find fonts matching a pattern:
xlsfonts -fn '*arabic*'

-mutt-clearlyu arabic-medium-r-normal--17-120-100-100-p-93-iso10646-1
  1. Page through a particular font to see if it works:
xfd -fn "-mutt-clearlyu arabic-medium-r-normal--17-120-100-100-p-93-iso10646-1"
  1. Choose a font and start xterm with it.

Unfortunately, calling xterm with the limited list of fonts that explicitly included arabic in their name resulted in a huge, blank terminal.

Font names that included arabic also included iso10646. ISO 10646 fonts are related to Unicode fonts, so I decided to search for happines here:

xlsfonts -fn '*iso10646*'

The results were manageable by brute force after pruning bold and non-fixed fonts.

Perhaps more frustrating than finding the a working font was documenting the fix, because I'm unaware of a nice way to determine which package provides a font (as displayed by xlsfonts). Specifically, freefont for Fedora added some ISO 10646 fonts, but there was no clear relationship between the files included and the fonts provided, and every font type in /usr/share/fonts/ seems to have a unique way of declaring itself.

  • Use screen -U and screen -Ux to initiate and reattach to Unicode-enabled GNU screen sessions.

  • From http://www.maruko.ca/i18n:

    vim "+set encoding=utf-8"

    ..or if you are already editing the file:

    :set enc=utf-8
  • If your terminal's encoding differs from the file's encoding, set tenc in vim. For example, if you are using a non-UTF-8 xterm but would like to edit a UTF-8 file containing characters in the Latin-1 range:

    :set tenc=latin-1

    Note the :help mbyte docs and the link to http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz.

  • In case you need to include fonts outside the normal locations, make a directory of fonts available:

    mkfontdir /usr/share/fonts/freefont/

    ..add it to the X server's font path (temporary):

    xset fp+ /usr/share/fonts/freefont/

    For a permanent change, add the path to FontPath in XF86Config.

    Rehash if it's already included in the path:

    xset fp rehash
  • gnome-terminal, mlterm, uterm, and pluto are other multi-byte terminals. Whenever possible, I use roxterm.