if (ret != null) return ret;
// FEATURE: be smarter here
- if (c < 256) Font.renderGlyphs(res, pointsize, 0, 255, glyphCache);
- else Font.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache);
+ if (c < 256) Freetype.renderGlyphs(res, pointsize, 0, 255, glyphCache);
+ else Freetype.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache);
ret = (Glyph)glyphCache.get(res, new Integer((((int)c) << 16) | pointsize));
if (ret != null) return ret;
// FEATURE: use streams, not memoryfont's
// FEATURE: kerning pairs
-public class Font {
+public class Freetype {
- Font() { }
+ Freetype() { }
private static org.xwt.mips.Interpreter vm = null;
glyphCache.put(res, new Integer((g << 16) | pointsize), glyph);
}
} catch (Exception e) {
- Log.log(Font.class, e);
+ Log.log(Freetype.class, e);
}
}
}
--- /dev/null
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
+
+/* NOTE: _user_info is defined in crt0.c. It points to a 4096 byte
+ block of memory that contains 1024 32-bit values that can be set
+ with the setUserInfo() method of MIPSEmu.
+
+ The VM will pause after initialization. When unpaused, it expects
+ that:
+
+ FIXME
+
+*/
+
+int main(int argc, char** argv) {
+ // FIXME: do some cool stuff here
+}
--- /dev/null
+package org.xwt.translators;
+import org.xwt.*;
+import org.xwt.util.*;
+import java.io.*;
+import java.util.zip.*;
+
+public class MSPack {
+
+ MSPack() { }
+
+ private static org.xwt.mips.Interpreter vm = null;
+
+ public static synchronized void unpack(InputStream theCabFile) {
+ try {
+ if (vm == null) {
+ InputStream bis = Platform.getBuiltinInputStream();
+ ZipInputStream zis = new ZipInputStream(bis);
+ for(ZipEntry ze = zis.getNextEntry(); ze != null && !ze.getName().equals("libmspack.mips"); ze = zis.getNextEntry()) { }
+ byte[] image = InputStreamToByteArray.convert(zis);
+ vm = new org.xwt.mips.Interpreter(image);
+ vm.start(new String[]{ "libmspack.mips" });
+ vm.execute();
+ }
+
+ int CAB_RESERVED = 256*1024;
+ int baseAddr = vm.sbrk(CAB_RESERVED);
+
+ byte[] cabstream = InputStreamToByteArray.convert(theCabFile);
+ vm.copyout(cabstream, baseAddr, cabstream.length);
+ vm.setUserInfo(0, baseAddr);
+ vm.setUserInfo(1, cabstream.length);
+
+ vm.execute();
+ // FIXME: do more stuff here
+
+ } catch (Exception e) {
+ Log.log(MSPack.class, e);
+ }
+ }
+}