This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import processing.core.*; | |
public class PGraphicsJava2DJustify extends PGraphicsJava2D { | |
public static int JUSTIFY = 4; | |
static protected void showTextFontException(String method) { | |
throw new RuntimeException("Use textFont() before " + method + "()"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function measureString(str:String, format:TextFormat) : Number { | |
var textField:TextField = new TextField(); | |
textField.autoSize = TextFieldAutoSize.LEFT; // adjust appropriately | |
textField.defaultTextFormat = format; | |
textField.text = str; | |
return textField.textWidth; | |
} |
NewerOlder