fixed bug 417: font.wait
authoradam <adam@megacz.com>
Wed, 11 Feb 2004 07:06:53 +0000 (07:06 +0000)
committeradam <adam@megacz.com>
Wed, 11 Feb 2004 07:06:53 +0000 (07:06 +0000)
darcs-hash:20040211070653-5007d-a5d77133207891a17bef7c3a5fd9ce65e5b3e815.gz

src/org/ibex/Ibex.java

index ed3cb9c..3ab733f 100644 (file)
@@ -64,6 +64,7 @@ public final class Ibex extends JS.Cloneable {
         case "regexp": return METHOD;
         case "ui": return getSub("ui");
         case "ui.font": return getSub("ui.font");
+        case "ui.font.wait": return METHOD;
         case "ui.font.sansserif": return Main.builtin.get("fonts/vera/Vera.ttf");
         case "ui.font.monospace": return Main.builtin.get("fonts/vera/VeraMono.ttf");
         case "ui.font.serif": return Main.builtin.get("fonts/vera/VeraSe.ttf");
@@ -195,6 +196,17 @@ public final class Ibex extends JS.Cloneable {
                     case "stream.watch": return new Stream.ProgressWatcher((Stream)a, (JS)b);
                     case "regexp": return new JSRegexp(a, b);
                     //#end
+                case 3:
+                    //#switch(name)
+                    case "font.wait":
+                        try {
+                            JS.UnpauseCallback callback = JS.pause();
+                            Font font = Font.getFont((Stream)a, JS.toInt(b));
+                            if (font.rasterizeGlyphs((String)c, null, 0,0,0,0,0,0,0, callback) != -1) Scheduler.add(callback);
+                        } catch (JS.NotPauseableException npe) {
+                            JS.error("can't wait for a font in a foreground thread");
+                        }
+                    //#end
                     break;
             }
         } catch (RuntimeException e) {