Search code examples
textalignmentprocessingjustify

textAlign() JUSTIFIED processing api


im working in processing and i would like to have a textAlign justified mode. I have found this link: http://code.google.com/p/processing/issues/detail?id=186 but can't get it to work. Have no clue how to import.

I have a very long string and i would like to justify it depending on X1, X2 variable, for example x1 = 100 (string begins), x2 = 200 (string stops, gets \n or something) and continues in next line with x1 again.

Thanks


Solution

  • Very sorry for late replay. I got this issue solved with a little bit of help. Thanks antiplastik! See PGraphicsJava2DJustify.java

    HowTo:

    size(100, 100, "PGraphicsJava2DJustify");
    background(255);
    fill(0);
    textAlign(PGraphicsJava2DJustify.JUSTIFY);
    textFont(createFont("", 10), 10);
    text("this is the text to justify", 20, 20, 60, 60);