The following piece of code has two problems:
1) requires write permission does not work sandboxed (applet or 
   Java Web Start)
   Fix: A doPriviledge needs to be put into the code 
2) leaks a file every time it is called (in C:\Temp on Windows and
   /usr/tmp on Solaris)   
   Fix: Make sure to remove the file. This is a serious problem
   since a new file is leaked everytime the application is started
//---------------------------------------------------------------------
import java.awt.*;
import java.io.*;
import java.net.*;
public class ybGuiFactory
{
...
    private final static String VAR_FONT_FILE = "YB_VAR_FONT.TTF";
...
    public static void loadVarFont(String servletURL)
    {
        ClassLoader cl = ybGuiFactory.class.getClassLoader();
        try {
            // load from jar file 
            InputStream fontStream =
cl.getResourceAsStream("fonts/"+VAR_FONT_FILE);
            if(fontStream == null) {
              // load over the net
              URL fontURL = new URL(servletURL+"fonts/"+VAR_FONT_FILE);
              fontStream = fontURL.openStream();
              if(fontStream == null) return;
            }
            Font f = Font.createFont(Font.TRUETYPE_FONT, new
BufferedInputStream(fontStream));
            VAR_FONT = f.deriveFont((float) 8.8);
            fontStream.close();
        }
        catch(IOException ioe) {
            ioe.printStackTrace();
            return;
        }
        catch(FontFormatException ffe) {
            ffe.printStackTrace();
            return;
        }
    }
...
}
//---------------------------------------------------------------
-- 
rene.schmidt@eng 2001-02-07