Text margin - left

The implementation allows to change the left text margin (padding before - to the left of - each line, independent to any padding for alignment). The number of characters as well as the used character can be changed. The default values are 0 and blank ` `.

The following code creates a paragraph context and then a paragraph with some demo text. It then prints the default settings (no left margin). This is followed by setting the left text margin to 5, printing the output. This is followed by setting the left text margin to 10 and the character to >, printing the output.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
AP_Context ctx = new AP_Context();
ctx.setAlignment(TextAlignment.LEFT);
ctx.setWidth(29);

AsciiParagraph ap = new AsciiParagraph(ctx);
ap.addText(new LoremIpsum().getWords(29));

System.out.println(ap.render());

ctx.setTextLeftMargin(5);
System.out.println(ap.render());

ctx.setTextLeftMargin(10);
ctx.setTextLeftChar('>');
System.out.println(ap.render());

The resulting output for the first setting, default margin, is:

Lorem ipsum dolor sit amet,
consetetur sadipscing elitr,
sed diam nonumy eirmod tempor
invidunt ut labore et dolore
magna aliquyam erat, sed diam
voluptua. At vero eos et
accusam

The resulting output for the second setting, left text margin set to 5, is:

     Lorem ipsum dolor sit amet,
     consetetur sadipscing elitr,
     sed diam nonumy eirmod tempor
     invidunt ut labore et dolore
     magna aliquyam erat, sed diam
     voluptua. At vero eos et
     accusam

The resulting output for the second setting, left text margin set to 10 and character set to >, is:

>>>>>>>>>>Lorem ipsum dolor sit amet,
>>>>>>>>>>consetetur sadipscing elitr,
>>>>>>>>>>sed diam nonumy eirmod tempor
>>>>>>>>>>invidunt ut labore et dolore
>>>>>>>>>>magna aliquyam erat, sed diam
>>>>>>>>>>voluptua. At vero eos et
>>>>>>>>>>accusam