freetype curve extraction in Font.java and readback in Box.java
[org.ibex.core.git] / src / org / ibex / core / Box.java
index 2fb9fe6..0e95a7e 100644 (file)
@@ -468,7 +468,13 @@ public final class Box extends JSScope implements Task {
         case "indexof": return METHOD;
         case "distanceto": return METHOD;
         case "text": return text;
-        case "path": throw new JSExn("cannot read from the path property");
+        case "path": 
+            if (path != null) return path.toString();
+            if (text == null) return null;
+            if (font == null) return null;
+            String ret = "";
+            for(int i=0; i<text.length(); i++) ret += font.glyphs[text.charAt(i)].path;
+            return ret;
         case "fill": return Color.colorToString(fillcolor);
         case "strokecolor": return Color.colorToString(strokecolor);
         case "textcolor": return Color.colorToString(strokecolor);
@@ -551,7 +557,7 @@ public final class Box extends JSScope implements Task {
         case "shrink":      CHECKSET_FLAG(HSHRINK | VSHRINK); RECONSTRAIN();
         case "hshrink":     CHECKSET_FLAG(HSHRINK); RECONSTRAIN();
         case "vshrink":     CHECKSET_FLAG(VSHRINK); RECONSTRAIN();
-        case "path":        path = Path.parse(toString(value)); dirty();
+        case "path":        path = Path.parse(toString(value)); RECONSTRAIN(); dirty();
         case "width":       setWidth(toInt(value), toInt(value));
         case "height":      setHeight(toInt(value), toInt(value));
         case "maxwidth":    setWidth(minwidth, toInt(value));