@@ -46,6 +46,7 @@ This file is part of the iText (R) project.
46
46
import com .itextpdf .kernel .colors .ColorConstants ;
47
47
import com .itextpdf .kernel .font .PdfFont ;
48
48
import com .itextpdf .kernel .font .PdfFontFactory ;
49
+ import com .itextpdf .kernel .geom .PageSize ;
49
50
import com .itextpdf .kernel .pdf .PdfDocument ;
50
51
import com .itextpdf .kernel .pdf .PdfWriter ;
51
52
import com .itextpdf .kernel .pdf .canvas .PdfCanvasConstants ;
@@ -59,6 +60,7 @@ This file is part of the iText (R) project.
59
60
import com .itextpdf .layout .properties .Property ;
60
61
import com .itextpdf .test .ExtendedITextTest ;
61
62
import com .itextpdf .test .annotations .type .IntegrationTest ;
63
+
62
64
import org .junit .Assert ;
63
65
import org .junit .BeforeClass ;
64
66
import org .junit .Test ;
@@ -403,4 +405,41 @@ public void leadingAndFloatInTextTest() throws IOException, InterruptedException
403
405
404
406
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder ));
405
407
}
408
+
409
+ @ Test
410
+ public void textWrappingEpsilonTest () throws IOException , InterruptedException {
411
+ String outFileName = destinationFolder + "textWrappingEpsilon.pdf" ;
412
+ String cmpFileName = sourceFolder + "cmp_textWrappingEpsilon.pdf" ;
413
+
414
+ PdfWriter writer = new PdfWriter (outFileName );
415
+ PdfDocument pdfDoc = new PdfDocument (writer );
416
+ Document document = new Document (pdfDoc );
417
+
418
+ // Play with margins to make AbstractRenderer.EPS important for wrapping behavior
419
+ document .setLeftMargin (250.0F );
420
+ document .setRightMargin (238.727F );
421
+ pdfDoc .setDefaultPageSize (PageSize .LETTER );
422
+ PdfFont font = PdfFontFactory .createFont (sourceFolder + "../fonts/Open_Sans/OpenSans-Regular.ttf" );
423
+
424
+ String text1 = "First line of some text " ;
425
+ String text2 = "Second line of some text" ;
426
+
427
+ Text text = new Text (text1 );
428
+ text .setFont (font );
429
+ text .setFontSize (9 );
430
+ Paragraph paragraph = new Paragraph ();
431
+ paragraph .add (text );
432
+
433
+ text = new Text (text2 );
434
+ text .setFont (font );
435
+ text .setFontSize (9 );
436
+ paragraph .add (text );
437
+
438
+ paragraph .setBackgroundColor (ColorConstants .LIGHT_GRAY );
439
+ document .add (paragraph );
440
+ document .close ();
441
+ writer .close ();
442
+
443
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder ));
444
+ }
406
445
}
0 commit comments