// FIXME remove this
private final JS rr;
+
public Ibex(Stream rr) { this.rr = bless(rr); }
public JS resolveString(String str, boolean permitAbsolute) throws JSExn {
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");
else if (url.startsWith("https://")) return new Stream.HTTP(url);
else if (url.startsWith("data:")) return new Stream.ByteArray(Base64.decode(url.substring(5)), null);
else if (url.startsWith("utf8:")) return new Stream.ByteArray(url.substring(5).getBytes(), null);
+ else if (url.startsWith("file:")) {
+ // FIXME
+ Platform.fileDialog(url.substring(5), false);
+ }
throw new JSExn("invalid resource specifier " + url);
}
case "thread.sleep": sleep(JS.toInt(a)); return null;
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) {
}
public Object call(Object a, Object b, Object c, Object[] rest, int nargs) throws JSExn {
// GROSS hack
- if (nargs == 9999) return t;
- if (nargs != 1) throw new JSExn("FIXME can only call with one arg");
+ if (nargs != 1 && nargs != 9999) throw new JSExn("FIXME can only call with one arg");
getStatic();
if (t == null) throw new JSExn("No such template " + parentkey);
+ if (nargs == 9999) return t;
t.apply((Box)a);
return a;
}