emacs-devel
[Top][All Lists]
Advanced

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

can't use Emacs with new free STIX fonts


From: Joe Wells
Subject: can't use Emacs with new free STIX fonts
Date: Sun, 02 Dec 2007 05:50:58 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Dear Emacs gurus,

You may be aware that the STIX Fonts Project recently released a beta
test version of the STIX fonts.  These fonts contain a large set of
glyphs for scientific and technical characters.  As far as I am aware,
these fonts are the only _free_ (as in non-proprietary) source for
glyphs in a modern Unicode font for most of these characters.

Naturally, it would be nice to be able to use these fonts with Emacs.
Currently the only other option is slaveware fonts (for example, Code
2000, Everson Mono Unicode, and Bitstream Cyberbit), and it would be
very nice to have a free font option in Emacs.

Unfortunately, the STIX fonts do not seem to work with the many X
Window System applications like Emacs that use the old X “core fonts”
method.  At least I have not been able to get them to work.

Some of you are probably well aware that there are two main methods
for accessing fonts in X Window System applications:

  “X includes two font systems: the original core X11 fonts system,
  which is present in all implementations of X11, and the Xft fonts
  system, ...”

Usually, the same font files can be accessed via both methods.
However, some modern fonts do not work with the old core fonts
mechanism.  The old core fonts mechanism is regarded by developers as
a legacy method and some developers refuse to fix bugs that are
related to the old core fonts mechanism.

So there seem to be two possibilities:

#1: Someone can figure out how to make the STIX fonts work with the
    old core fonts mechanism.

#2: Emacs can be upgraded to work with the Xft mechanism.

I know there is ongoing work toward #2, but if I understand correctly
this is not scheduled for the next Emacs release.

Below I include the details of what I did to try to get the STIX fonts
to work via the core fonts mechanism, in case anyone else wants to try
#1.

Can anyone help?

Joe

----------------------------------------------------------------------
P.S.  Here is what I did to try to install and use the fonts with
Emacs.  First, you have to get the font files.  I refuse to get them
from the main STIX web site because they (absurdly) require the
downloader to supply their e-mail address.  The license is free so it
is no problem to get the fonts from elsewhere.  Here is one place you
can get the fonts (this one RPM contains 4 of the font files and is
enough for testing purposes):

  mkdir ~/.fonts/stixfonts
  cd ~/.fonts/stixfonts
  wget 
http://koji.fedoraproject.org/packages/stix-fonts/0.9/6.fc9/noarch/stix-fonts-0.9-6.fc9.noarch.rpm

Then unpack the RPM to get the file STIXGeneral.otf (you can get the
others if you like, but one is enough for testing):

  rpm2cpio stix-fonts-0.9-6.fc9.noarch.rpm | cpio --extract --make-directories 
./usr/share/fonts/stix/STIXGeneral.otf
  rm stix-fonts-0.9-6.fc9.noarch.rpm
  mv usr/share/fonts/stix/STIXGeneral.otf .
  rm -r usr

Then make the font accessible to X via the “core fonts” mechanism:

  mkfontscale
  mkfontdir
  xset fp+ ~/.fonts/stixfonts    (must execute this in every X session)

This is the ordinary way of installing fonts for the core fonts
method.  (Note that this method also happens to simultaneously install
the fonts for the Xft method on many systems, because by default on
many systems all directories inside ~/.fonts are included for the Xft
method.)

After installing the fonts, I tried to use them:

  xterm -fn '*-stixgeneral-medium-r-normal-*'

I got this error message:

  xterm:  unable to open font "*-stixgeneral-medium-r-normal-*", trying 
"fixed"....

I tried to view the font with a font viewer program:

  xfd -fn '*-stixgeneral-medium-r-normal-*'

I got this error message:

  Warning: Cannot convert string "*-stixgeneral-medium-r-normal-*" to type 
FontStruct

I also tried in Emacs but I will not bother to report the details of
the failure, as there is no simple error message.

To try to debug what is happening, I used strace:

  ( sleep 1 ; xfd -fn '*-stixgeneral-medium-r-normal-*' & ) ; sudo strace -o 
/tmp/X.strace -s 10000 -p `pidof X`

This revealed the following system calls occur in the X server:

  read(47, 
"address@hidden<address@hidden@\0\0\347\353\357\0\20\20\20\0\2\0\0\0\3\0\0\0\27\0\0\5-\0\v\0
 \0\0\5\37\0\0\0*-stixgeneral-medium-r-normal-*\0\227\1\3\0 \0\0\5\1\0\0\0", 
4096) = 280
  open("/home/jbw/.fonts/stixfonts/STIXGeneral.otf", O_RDONLY) = 48
  fcntl64(48, F_SETFD, FD_CLOEXEC)        = 0
  fstat64(48, {st_mode=S_IFREG|0644, st_size=273424, ...}) = 0
  mmap2(NULL, 273424, PROT_READ, MAP_PRIVATE, 48, 0) = 0xa2de7000
  close(48)                               = 0
  munmap(0xa2de7000, 273424)              = 0

This indicates that the X server gets the font request, correctly
figures out that it needs to get the font from the file
STIXGeneral.otf, maps that file into memory, (presumably) inspects the
font data, and then unmaps the font file.

This is all the debugging information I have been able to obtain so
far.  Despite turning debugging up to level 11 (the highest debugging
messages from the X server are at level 10), no interesting messages
show up in the X server's log file.

So I don't know what is going wrong.  I don't know whether the X
server doesn't like the font file, or whether the problem is
elsewhere.  The X server has no problem using other OTF font files as
core fonts (this feature is provided by the loadable module
/usr/lib/xorg/modules/fonts/libfreetype.so), so I know the problem is
not missing support.

Further progress on this problem seems likely to require running the X
server under the debugger to find out what is going wrong.




reply via email to

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