Enabling Symbol Fonts in Browsers under X

Ian Hutchinson

4 Aug 2004 update

Fix that works for most browsers using standard X fonts1

Download this linux bash script to do the fix. Make it executable and run it as root. If you want just to get things working, that ought to be sufficient, but if you want all the gory details, read on.

Detailed discussion

Most browsers on X window systems organize their fonts by Document-Encoding, which controls the document overall and then, within that encoding, by a set of names available via HTML tags < font face="name" > . Obviously, accessing symbols in a regular document by changing the overall encoding is not what one wants.
The relevant default encoding is generally Western (iso-8859-1).
With fonts set up in the normal way, one cannot access the symbol face from the default (Western) encoding, because it is not one of the available fonts. In the font-choosing section of Netscape, anything that Netscape can't identify (such as the fontspecific fonts, of which the symbol set is one) is put into an encoding set "User-Defined", which one can't make the default because it does not have the standard fonts. The iso-8859-1 encoding font group appears to consist of all the fonts in the X-server that end in iso8859-1.
In the long run, it will be possible to use the standard-conforming mechanism of unicode points to access the symbols. However, at present, no browser offers a sufficiently complete implementation.
One way to fool browsers into making the symbol font available is to alias fonts that are symbol to have a bogus name ending iso8859-1. That causes the browser to include them in the standard encoding set, so they are routinely available to any document with the default encoding, for example by < font face=symbol > w < /font > (which gives an omega). However, this only seems to work for the standard pixel generated X fonts, not for Type 1.
In a typical X setup, all this requires is that the following lines be added to a fonts.alias file in the standard font path(s) for the server, and then the server should be restarted (or xset fp rehash). More modern X-servers that depend on a font server such as xfs, require the font server to be restarted. The simplest way to do so if you are not an expert is to reboot.
!___________________________Cut here__________________________________________
! 100dpi aliases to fool Netscape into symbol support in iso8859 encoding.
-adobe-symbol-medium-r-normal--11-80-100-100-p-61-iso8859-1 -adobe-symbol-medium-r-normal--11-80-100-100-p-61-adobe-fontspecific
-adobe-symbol-medium-r-normal--14-100-100-100-p-85-iso8859-1 -adobe-symbol-medium-r-normal--14-100-100-100-p-85-adobe-fontspecific
-adobe-symbol-medium-r-normal--17-120-100-100-p-95-iso8859-1 -adobe-symbol-medium-r-normal--17-120-100-100-p-95-adobe-fontspecific
-adobe-symbol-medium-r-normal--20-140-100-100-p-107-iso8859-1 -adobe-symbol-medium-r-normal--20-140-100-100-p-107-adobe-fontspecific
-adobe-symbol-medium-r-normal--25-180-100-100-p-142-iso8859-1 -adobe-symbol-medium-r-normal--25-180-100-100-p-142-adobe-fontspecific
-adobe-symbol-medium-r-normal--34-240-100-100-p-191-iso8859-1 -adobe-symbol-medium-r-normal--34-240-100-100-p-191-adobe-fontspecific
!__________________________Cut here optionally_________________________________
! 75dpi Netscape symbol aliases.
-adobe-symbol-medium-r-normal--10-100-75-75-p-61-iso8859-1 -adobe-symbol-medium-r-normal--10-100-75-75-p-61-adobe-fontspecific
-adobe-symbol-medium-r-normal--12-120-75-75-p-74-iso8859-1 -adobe-symbol-medium-r-normal--12-120-75-75-p-74-adobe-fontspecific
-adobe-symbol-medium-r-normal--14-140-75-75-p-85-iso8859-1 -adobe-symbol-medium-r-normal--14-140-75-75-p-85-adobe-fontspecific
-adobe-symbol-medium-r-normal--18-180-75-75-p-107-iso8859-1 -adobe-symbol-medium-r-normal--18-180-75-75-p-107-adobe-fontspecific
-adobe-symbol-medium-r-normal--24-240-75-75-p-142-iso8859-1 -adobe-symbol-medium-r-normal--24-240-75-75-p-142-adobe-fontspecific
-adobe-symbol-medium-r-normal--8-80-75-75-p-51-iso8859-1 -adobe-symbol-medium-r-normal--8-80-75-75-p-51-adobe-fontspecific
!___________________________Cut here___________________________________________

There may be undesirable consequences from this bogus alias for other X programs. Not giving a scalable font alias minimizes this but it means the symbol font can't be scaled arbitrarily.

Font Size Settings in Older Netscapes

In the .netscape preferences file there is a list of full (X) font names. like this:
DOC_CSID:               2
FONT_CHARSET:           iso-8859-1
FONT_SPEC:              schumacher-clean-120-noscale-fixed-x-user-defined 
FONT_SPEC:              schumacher-clean-120-noscale-prop-x-user-defined 
FONT_SPEC:              isas-fangsong ti-0-noscale-fixed-gb_2312-80 
FONT_SPEC:              isas-fangsong ti-0-noscale-prop-gb_2312-80 
FONT_SPEC:              daewoo-gothic-0-noscale-fixed-ks_c_5601-1987 
FONT_SPEC:              daewoo-gothic-0-noscale-prop-ks_c_5601-1987 
FONT_SPEC:              misc-fixed-0-noscale-fixed-jis_x0201 
FONT_SPEC:              misc-fixed-0-noscale-prop-jis_x0201 
FONT_SPEC:              jis-fixed-150-noscale-fixed-jis_x0208-1983 
FONT_SPEC:              jis-fixed-150-noscale-prop-jis_x0208-1983 
FONT_SPEC:              etl-fixed-0-noscale-fixed-iso-8859-7 
FONT_SPEC:              etl-fixed-0-noscale-prop-iso-8859-7 
FONT_SPEC:              adobe-courier-180-scale-fixed-iso-8859-1 
FONT_SPEC:              adobe-times-180-scale-prop-iso-8859-1 

These appear to be the defaults that are used in each of the encoding cases for proportional and fixed fonts.
Unfortunately, if you have set up the default size of the default font to be anything other than 12.0, as is the case in the above list, this fact is remembered only for the default fonts, not for the symbols (or any other face one might switch to). You have two options:
(1) Use 100dpi fonts (to make them display larger) and size 14.0 as your default. Assuming that both 75 and 100dpi fonts are in your font path, this is done by including the following lines in your .Xdefaults file.
Netscape*documentFonts.xResolution*iso-8859-1:  100
Netscape*documentFonts.yResolution*iso-8859-1:  100

Then reset Options/General-Preferences/Fonts/Proportional times font size to 14. This will give a screen size virtually the same as 18.0 at 75dpi, which is comfortable on my 15 inch monitor. For some reason, the symbol fonts come out a fair matching size, even though Netscape chooses nominally 12.0, (not 14.0 like the times).
(2) Fix the symbol size every time you restart Netscape In Netscape use Options/General-Preferences/Fonts/Proportional, choosing symbol specifically, and setting its size, then setting the default back to e.g. times. That will fix it till the next time Netscape is restarted. There ought to be a better way. If you find one, let me know. [hutch@psfc.mit.edu]

Aliases Fix Summary

(1) Cut out the above section(s) to file(s) 100dpi.alias, 75dpi.alias or construct your own aliases based on $ xlsfonts | fgrep symbol aliasing the terminating -*-fontspecific to -iso8859-1.
(2) Become the superuser. Determine the correct directory on the standard font path, e.g.
(3) Append the file(s) to the fonts.alias there:
# cat 100dpi.alias >> /usr/X11R6/lib/X11/fonts/100dpi/fonts.alias
# cat 75dpi.alias >> /usr/X11R6/lib/X11/fonts/75dpi/fonts.alias

[Actually one can just append the whole lot to either alias file.]
(4) xset fp rehash or restart the Xserver.
(5) Restart Netscape.

Quick fix for Netscape 4.x (obsolete)

(1) Add the following line to your .Xdefaults (or .Xresources):
Netscape*documentFonts.charset*adobe-fontspecific:   iso-8859-1

(2) $ xrdb .Xdefaults or else restart the X server.
(3) Restart Netscape.
This quick fix tells Netscape to include any font ending adobe-fontspecific in its western (8859-1) list. Then the above aliases are not needed.

Mozilla, Netscape 7, Konqueror

Mozilla does not offer the Quick Fix, nor, as far as I can tell does Konqueror or Opera. Therefore the aliases approach is preferable if they are required. The automatic script for installing the aliases will also try to correct a bug in MathML that emerges with this alias. When unicode 3.2 is fully implemented by the browsers, with luck these problems will go away. More details of the whole question of accessing symbol fonts are given in the TtH manual.


1For browsers such as some recent Mozilla builds that use anti-aliased fonts through the fontconfig server, a different fix is needed, see http://silas.psfc.mit.edu/tth/symfontconfig.html

File translated from TEX by TTHgold, version 3.70.
On 28 Aug 2005, 18:01.