unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* can't use Emacs with new free STIX fonts
@ 2007-12-02  5:50 Joe Wells
  2007-12-02 10:58 ` Leo
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Wells @ 2007-12-02  5:50 UTC (permalink / raw)
  To: emacs-devel

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, "7\0\10\0\32\0\0\5D\0\0\0\f@\1\0\20\20\20\0\347\353\357\0\27\0\0\5\0\0\0\0005\30\4\0\33\0\0\5D\0\0\0\2\0\2\00077\6\0\34\0\0\5\33\0\0\5\f\0\0\0\20\20\20\0\347\353\357\0H\0\10\0\33\0\0\5\34\0\0\5\2\0\2\0\0\0\0\0\0\1\0\0\2\0\0\0\1\0\0\0<\0\2\0\34\0\0\0057\0\n\0\35\0\0\5D\0\0\0\fE\1\0\20\20\20\0\347\353\357\0\1\0\0\0\33\0\0\5\27\0\0\5\0\0\0\0007\0\t\0\36\0\0\5D\0\0\0\\@\0\0\20\20\20\0\347\353\357\0\2\0\0\0\3\0\0\0\27\0\0\0057\0\t\0\37\0\0\5D\0\0\0\\@\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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't use Emacs with new free STIX fonts
  2007-12-02  5:50 can't use Emacs with new free STIX fonts Joe Wells
@ 2007-12-02 10:58 ` Leo
  2007-12-02 14:58   ` Stefan Monnier
  2007-12-02 15:18   ` Jason Rumney
  0 siblings, 2 replies; 4+ messages in thread
From: Leo @ 2007-12-02 10:58 UTC (permalink / raw)
  To: emacs-devel

On 2007-12-02 05:50 +0000, Joe Wells wrote:
> #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.

It is in unicode2 branch already and this branch will be merged into
trunk for next release.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't use Emacs with new free STIX fonts
  2007-12-02 10:58 ` Leo
@ 2007-12-02 14:58   ` Stefan Monnier
  2007-12-02 15:18   ` Jason Rumney
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2007-12-02 14:58 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

> trunk for next release.

"Next release" here means 23.1, not 22.2.


        Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can't use Emacs with new free STIX fonts
  2007-12-02 10:58 ` Leo
  2007-12-02 14:58   ` Stefan Monnier
@ 2007-12-02 15:18   ` Jason Rumney
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Rumney @ 2007-12-02 15:18 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo wrote:
> On 2007-12-02 05:50 +0000, Joe Wells wrote:
>   
>> #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.
>>     
>
> It is in unicode2 branch already and this branch will be merged into
> trunk for next release.
>   

The next release will be 22.2. The xft work will not appear until the
next major release, 23.1.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-02 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-02  5:50 can't use Emacs with new free STIX fonts Joe Wells
2007-12-02 10:58 ` Leo
2007-12-02 14:58   ` Stefan Monnier
2007-12-02 15:18   ` Jason Rumney

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).