- private static Cache fontCache = new Cache(100);
- public static Font getFont(Stream stream, int pointsize) {
- Font ret = (Font)fontCache.get(stream, new Integer(pointsize));
- if (ret == null) fontCache.put(stream, new Integer(pointsize), ret = new Font(stream, pointsize));
+ // HACK: replace with Cache<JS, int>
+ private static Basket.Map fonts = new Basket.HashMap();
+ public static Font getFont(JS stream, int pointsize) {
+ Basket.Map m = (Basket.Map)fonts.get(stream);
+ Font ret = null;
+ if (m != null) ret = (Font)m.get(new Integer(pointsize));
+ else fonts.put(stream, m = new Basket.HashMap());
+ if (ret == null) m.put(new Integer(pointsize), ret = new Font(stream, pointsize));