@@ -40,7 +40,9 @@ source product.
40
40
For more information, please contact iText Software Corp. at this
41
41
42
42
*/
43
+ using iText . IO . Font . Constants ;
43
44
using iText . IO . Util ;
45
+ using iText . Kernel . Font ;
44
46
using iText . Kernel . Geom ;
45
47
using iText . Kernel . Pdf . Xobject ;
46
48
using iText . Layout ;
@@ -228,5 +230,25 @@ public virtual void LineRendererLayoutInHtmlModeWithLineHeightAndChildInHtmlMode
228
230
NUnit . Framework . Assert . AreEqual ( 28.67920f , lineRenderer . maxAscent , EPS ) ;
229
231
NUnit . Framework . Assert . AreEqual ( - 21.32080f , lineRenderer . maxDescent , EPS ) ;
230
232
}
233
+
234
+ [ NUnit . Framework . Test ]
235
+ public virtual void LineRendererLayoutInHtmlModeWithLineHeightPropertyNotSet ( ) {
236
+ LineRenderer lineRenderer = new LineRenderer ( ) ;
237
+ lineRenderer . SetParent ( CreateDocument ( ) . GetRenderer ( ) ) ;
238
+ lineRenderer . SetProperty ( Property . RENDERING_MODE , RenderingMode . HTML_MODE ) ;
239
+ // Set fonts with different ascent/descent to line and text
240
+ lineRenderer . SetProperty ( Property . FONT , PdfFontFactory . CreateFont ( StandardFonts . HELVETICA ) ) ;
241
+ TextRenderer textRenderer = new TextRenderer ( new Text ( "text" ) ) ;
242
+ textRenderer . SetProperty ( Property . FONT , PdfFontFactory . CreateFont ( StandardFonts . COURIER ) ) ;
243
+ lineRenderer . AddChild ( textRenderer ) ;
244
+ LayoutResult layoutResLineHeightNotSet = lineRenderer . Layout ( new LayoutContext ( CreateLayoutArea ( 1000 , 1000
245
+ ) ) ) ;
246
+ lineRenderer . SetProperty ( Property . LINE_HEIGHT , LineHeight . CreateNormalValue ( ) ) ;
247
+ LayoutResult layoutResLineHeightNormal = lineRenderer . Layout ( new LayoutContext ( CreateLayoutArea ( 1000 , 1000
248
+ ) ) ) ;
249
+ Rectangle bboxLineHeightNotSet = layoutResLineHeightNotSet . GetOccupiedArea ( ) . GetBBox ( ) ;
250
+ Rectangle bboxLineHeightNormal = layoutResLineHeightNormal . GetOccupiedArea ( ) . GetBBox ( ) ;
251
+ NUnit . Framework . Assert . IsTrue ( bboxLineHeightNotSet . EqualsWithEpsilon ( bboxLineHeightNormal ) ) ;
252
+ }
231
253
}
232
254
}
0 commit comments