2003/09/20 05:03:47
[org.ibex.core.git] / src / org / xwt / translators / Font.java
index 190f927..8026108 100644 (file)
@@ -2,6 +2,7 @@ package org.xwt.translators;
 import org.xwt.*;
 import org.xwt.util.*;
 import java.io.*;
+import java.util.zip.*;
 
 // FEATURE: use streams, not memoryfont's
 // FEATURE: kerning pairs
@@ -13,9 +14,15 @@ public class Font {
 
     public static synchronized void renderGlyphs(Res res, int pointsize, int firstGlyph, int lastGlyph, Cache glyphCache) {
         try {
+           
             if (vm == null) {
-                vm = new org.xwt.mips.Interpreter("freetype.mips");
-                vm.start(new String[]{ "freetype.mips"});
+
+                InputStream bis = Platform.getBuiltinInputStream();
+                ZipInputStream zis = new ZipInputStream(bis);
+                for(ZipEntry ze = zis.getNextEntry(); ze != null && !ze.getName().equals("freetype.mips"); ze = zis.getNextEntry());
+                byte[] image = Resources.isToByteArray(zis);
+                vm = new org.xwt.mips.Interpreter(image);
+                vm.start(new String[]{ "freetype.mips" });
                 vm.execute();
             }