Am 2000-09-20 um 18:05 h UCT hat William Overington geschrieben:
> I am having a problem with Java, unicode and fonts.

I am not an expert in Java. Maybe, I can help you with your HTML,
and fonts problem.

> Here is TestUnicode.htm

You should start your source file with the HTML version information,
cf. <http://www.w3.org/TR/REC-html40/struct/global.html#h-7.2>.
Whilst this is required by the standard, many browsers still display
your file as intented (or almost so), if you leave it off. However,
you risk that some, current or future, browser will display things
you never dreamt of.

> <HTML>
> <HEAD>

You'd better include a Meta tag with the header (preferably prior
to any ather header content) specifying the transfer encoding,
cf. <http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2>.
Of course, you must declare your file to be in UTF-8.

Cf. my example files <http://www.rz.uni-konstanz.de/y2k/test/Go-UTF.htm>
and <http://www.rz.uni-konstanz.de/y2k/test/Euro-UTF.htm>.

> <TITLE>The TestUnicode program</TITLE>
> </HEAD>
> <BODY>
...
> <APPLET code=TestUnicode.class height=300 width=500>
> </APPLET>

Always tell the browser, what to display if it does not understand applets
or if the user has disabled Java, as in:
  <APPLET code=TestUnicode.class height=300 width=500>
    If you are really interested in learning
    to speak Esperanto in a French caf�,
    then you should enable Java, in your browser.
  </APPLET>

> I copied across the files TestUnicode.htm and TestUnicode.class and double
> clicked on the TestUnicode.htm file as displayed in Windows Explorer.  The
> text appeared in about 12 point with the e acute present but the C^ and the
> g^ replaced with black vertical bars.  Upon using View Source and then
> closing the window thus opened, the text reappeared drawn in 36 point type,
> with the C^ and g^ each replaced with an outline of a square.

These bars and squares indicate a character the browser is not capable of
displaying (while it still has recognized it as a character).

Several possible reasons spring to mind:

- In your applet, you specified Helvetica, a font not available on most
  computers; most PCs do have Arial, which is quite similar, but if your
  applet is viewed on a Mac, or on a Unix system (including) Linux, you
  will probably be out of luck. Try to find a way to specify the font
  in a portable way, or leave that decision entirely to the receiving
  side (where it actually belongs).

- You have not told the browser about using Unicode. Netscape (up to 4.7)
  has a bug which prevents it from displaying any character outside the
  character set used for transfer, quite in contrast to the standard
  <http://www.w3.org/TR/REC-html40/charset.html#h-5.1>. I am not sure
  about IE 4; maybe, it has a similar bug. If so, the above-mentioned
  Meta tag would remedy the situation.

- Your target computer may have old fonts installed that lack the required
  characters. If so, the remedy is, of course, to install the current
  fonts from <http://www.microsoft.com/typography/fontpack/default.htm>;
  for your example, any WGL4 font will do. (WGL4 is a Microsoft character
  set comprising all scripts used in Europe; for the specification, cf.
  <http://www.microsoft.com/typography/OTSPEC/WGL4.htm>.)

> Our hypothetical author is not allowed to do things such as add extra font
> files into the windows system.

But at the very least, he must be sure that the characters he'll be using
be available to the browser. Hence, he will have to provide an introductory
page explaining to the prospective audience the minimum requirements plus
hints how to comply with them, e. g. tell Windows users how to obtain the
Microsoft core fonts, how to install them, and how to get and install an
up-to-date browser, and likewise for Mac, and Unix, users.

Best wishes,
   Otto Stolz


Reply via email to