//#define CHECKSET_STRING(prop) if ((value==null&&prop==null)||(value!=null&&JSU.toString(value).equals(prop))) break; prop=JSU.toString(value);
// FIXME memory leak
- static Basket.Map boxToCursor = new Basket.HashMap(500, 3);
+ static Basket.Map boxToCursor = new Basket.Hash(500, 3);
- static final Font DEFAULT_FONT;
- static {
- try { DEFAULT_FONT = Font.getFont((JS)Main.builtin.get(JSU.S("fonts/vera/Vera.ttf")), 10); }
- catch(JSExn e) { throw new Error("Error loading default font: " + e); }
- }
+ public static final Font DEFAULT_FONT = Font.getFont(Main.vera, 10);
// Flags //////////////////////////////////////////////////////////////////////
public int maxwidth = Integer.MAX_VALUE;
public int minheight = 0;
public int maxheight = Integer.MAX_VALUE;
+ public int minwidth() { return minwidth; }
+ public int minheight() { return minheight; }
+ public int maxwidth() { return maxwidth; }
+ public int maxheight() { return maxheight; }
private short rows = 1;
private short cols = 0;
private short rowspan = 1;
font.rasterizeGlyphs(text, buf, strokecolor, text_x, text_y, cx1, cy1, cx2, cy2);
}
- if (path != null) path.realize(Affine.translate(globalx, globaly)).stroke(buf, 1, strokecolor);
+ if (path != null) new Polygon(path, Affine.translate(globalx, globaly)).stroke(buf, strokecolor);
for(Box b = getChild(0); b != null; b = b.nextSibling())
b.render(globalx, globaly, cx1, cy1, cx2, cy2, buf, null);
// Methods to implement org.ibex.js.JS //////////////////////////////////////
-
public JS call(JS method, JS[] args) throws JSExn {
switch (args.length) {
case "shrink": CHECKSET_FLAG(HSHRINK | VSHRINK); RECONSTRAIN();
case "hshrink": CHECKSET_FLAG(HSHRINK); RECONSTRAIN();
case "vshrink": CHECKSET_FLAG(VSHRINK); RECONSTRAIN();
- case "path": path = Path.parse(JSU.toString(value)); RECONSTRAIN(); dirty();
+ case "path": path = new Path(JSU.toString(value)); RECONSTRAIN(); dirty();
case "width": setWidth(JSU.toInt(value), JSU.toInt(value));
case "height": setHeight(JSU.toInt(value), JSU.toInt(value));
case "maxwidth": setWidth(minwidth, JSU.toInt(value));
JSU.error("redirect can only be set to a descendant of its current value");
case "fontsize": font = Font.getFont(font == null ? null : font.stream, JSU.toInt(value)); RECONSTRAIN(); dirty();
case "font":
- if(!(value instanceof Stream)) throw new JSExn("You can only put streams to the font property");
+ if(!(value instanceof Fountain)) throw new JSExn("You can only put streams to the font property");
//FIXME: if (font == value) return; // FIXME: unclone()
- font = value == null ? null : Font.getFont((Stream)value, font == null ? 10 : font.pointsize);
+ font = value == null ? null : Font.getFont((Fountain)value, font == null ? 10 : font.pointsize);
RECONSTRAIN();
dirty();
case "x": if (parent==null && Surface.fromBox(this)!=null) {