/** encapsulates a single font (a set of Glyphs) */
public class Font {
- private Font(Res res, int pointsize) { this.res = res; this.pointsize = pointsize; }
+ private Font(Stream res, int pointsize) { this.res = res; this.pointsize = pointsize; }
private static boolean glyphRenderingTaskIsScheduled = false;
public final int pointsize; ///< the size of the font
- public final Res res; ///< the resource from which this font was loaded
+ public final Stream res; ///< the resource from which this font was loaded
public int max_ascent; ///< the maximum ascent, in pixels
public int max_descent; ///< the maximum descent, in pixels
boolean latinCharsPreloaded = false; ///< true if a request to preload ASCII 32-127 has begun
private static final Freetype freetype = new Freetype();
static final Queue glyphsToBeRendered = new Queue(255);
private static Cache fontCache = new Cache(100);
- public static Font getFont(Res res, int pointsize) {
+ public static Font getFont(Stream res, int pointsize) {
Font ret = (Font)fontCache.get(res, new Integer(pointsize));
if (ret == null) fontCache.put(res, new Integer(pointsize), ret = new Font(res, pointsize));
return ret;
Scheduler.add(new Scheduler.Task() {
public void perform() throws Exception {
Box b = new Box();
- Template t = Template.getTemplate((Res)Main.builtin.get("org/xwt/builtin/proxy_authorization.xwt"));
+ Template t = Template.getTemplate((Stream)Main.builtin.get("org/xwt/builtin/proxy_authorization.xwt"));
t.apply(b, null);
b.put("realm", realm);
b.put("proxyIP", proxyIP);
public static String originHost = null;
public static String origin = null;
- public static final Res builtin = new Res.Zip(new Res.Builtin());
+ public static final Stream builtin = new Stream.Zip(new Stream.Builtin());
public static Picture scarImage = null;
public static void printUsage() {
initialTemplateName = initialTemplateName.replace('.', '/');
origin = args[startargs];
- Res rr;
+ Stream rr;
final String initialTemplate;
if (origin.startsWith("http://") || origin.startsWith("https://")) {
rr = builtin;
initialTemplate = "org/xwt/builtin/splash.xwt";
} else {
- rr = new Res.File(origin);
- if (!new File(origin).isDirectory()) rr = new Res.Zip(rr);
+ rr = new Stream.File(origin);
+ if (!new File(origin).isDirectory()) rr = new Stream.Zip(rr);
initialTemplate = initialTemplateName;
}
if (Log.on) Log.info(Main.class, "loading xwar");
final XWT xwt = new XWT(rr);
- final Res final_rr = rr;
+ final Stream final_rr = rr;
scarImage =
- Picture.load((Res)Main.builtin.get("org/xwt/builtin/scar.png"),
+ Picture.load((Stream)Main.builtin.get("org/xwt/builtin/scar.png"),
new Scheduler.Task() { public void perform() throws JSExn {
- Template.getTemplate(((Res)final_rr.get(initialTemplate))).apply(new Box(), xwt);
+ Template.getTemplate(((Stream)final_rr.get(initialTemplate))).apply(new Box(), xwt);
} });
Scheduler.init();