+ public synchronized void renderGlyph(Font.Glyph glyph) throws IOException {
+ int width = 0;
+ int height = 0;
+ byte[] data = null;
+ String key = glyph.font.res.getDescriptiveName() + ":" + glyph.c;
+ key = new String(Base64.encode(key.getBytes()));
+ File cacheFile = new java.io.File(System.getProperty("user.home") +
+ java.io.File.separatorChar + ".xwt" +
+ java.io.File.separatorChar + "caches" +
+ java.io.File.separatorChar + "glyphs" +
+ java.io.File.separatorChar +
+ key);
+ new java.io.File(cacheFile.getParent()).mkdirs();
+
+ if (cacheFile.exists()) {
+ DataInputStream dis = new DataInputStream(new FileInputStream(cacheFile));
+ width = dis.readInt();
+ height = dis.readInt();
+ glyph.font.max_ascent = dis.readInt();
+ glyph.font.max_descent = dis.readInt();
+ glyph.baseline = dis.readInt();
+ glyph.advance = dis.readInt();
+ data = new byte[width * height];
+ if (width != 0 && height != 0) dis.readFully(data);
+
+ } else try {
+ System.out.println("cache miss!");