public virtual void CalculateLineHeightTextRendererNullTest() { Document document = new Document(new PdfDocument(new PdfWriter(new ByteArrayOutputStream()))); TextRenderer textRenderer = new TextRenderer(new Text("Hello")); textRenderer.SetParent(document.GetRenderer()); float lineHeight = LineHeightHelper.CalculateLineHeight(textRenderer); NUnit.Framework.Assert.AreEqual(13.79999f, lineHeight, EPS); }
public virtual void CalculateLineHeighttTextRendererPointTest() { Document document = new Document(new PdfDocument(new PdfWriter(new ByteArrayOutputStream()))); TextRenderer textRenderer = new TextRenderer(new Text("Hello")); textRenderer.SetProperty(Property.LINE_HEIGHT, LineHeight.CreateFixedValue(200)); textRenderer.SetParent(document.GetRenderer()); float lineHeight = LineHeightHelper.CalculateLineHeight(textRenderer); NUnit.Framework.Assert.AreEqual(200, lineHeight, EPS); }
public virtual void CalculateLineHeightTextRendererNormalAscenderDescenderSumForNotoSansFontTest() { Document document = new Document(new PdfDocument(new PdfWriter(new ByteArrayOutputStream()))); PdfFont font = PdfFontFactory.CreateFont(FONTS + "NotoSans-Regular.ttf"); TextRenderer textRenderer = new TextRenderer(new Text("Hello")); textRenderer.SetProperty(Property.FONT, font); textRenderer.SetProperty(Property.LINE_HEIGHT, LineHeight.CreateNormalValue()); textRenderer.SetParent(document.GetRenderer()); float lineHeight = LineHeightHelper.CalculateLineHeight(textRenderer); NUnit.Framework.Assert.AreEqual(16.31999f, lineHeight, EPS); }