File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
itext.tests/itext.layout.tests/itext/layout/renderer Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -84,5 +84,22 @@ public virtual void SetTextException() {
8484 rend . SetText ( val ) ;
8585 NUnit . Framework . Assert . AreEqual ( val , rend . GetText ( ) . ToString ( ) ) ;
8686 }
87+
88+ [ NUnit . Framework . Test ]
89+ [ LogMessage ( iText . IO . LogMessageConstant . FONT_PROPERTY_MUST_BE_PDF_FONT_OBJECT ) ]
90+ public virtual void SetFontAsText ( ) {
91+ PdfDocument pdfDoc = new PdfDocument ( new PdfWriter ( new ByteBufferOutputStream ( ) ) ) ;
92+ pdfDoc . AddNewPage ( ) ;
93+ Document doc = new Document ( pdfDoc ) ;
94+ Text txt = new Text ( "text" ) ;
95+ txt . SetProperty ( Property . POSITION , LayoutPosition . ABSOLUTE ) ;
96+ txt . SetProperty ( Property . TOP , 5f ) ;
97+ FontProvider fp = new FontProvider ( ) ;
98+ fp . AddFont ( "Helvetica" ) ;
99+ txt . SetProperty ( Property . FONT_PROVIDER , fp ) ;
100+ txt . SetFont ( "Helvetica" ) ;
101+ doc . Add ( new Paragraph ( ) . Add ( txt ) ) ;
102+ doc . Close ( ) ;
103+ }
87104 }
88105}
Original file line number Diff line number Diff line change 1- 07bf13756e6d3cd51214bc39231517e99b5a34c8
1+ 3a3a37959937c694930f7fe8f6ded92cef8bc67c
You can’t perform that action at this time.
0 commit comments