Line Height

Line Height

Forum member · Aug 12, 2006
Hi, I will draw an array of text in a label. Each array element is separated with an "\n", so in the pdf report a new line is printed. How can I calculate how high the label has to be? What I do is measuring the space from one line bottom to the next. But when I change the font size I have to do it again. And please: What is a LineGap ? Thanks Calle

Re: Line Height

Support · Aug 14, 2006
Hello Calle, You can find the height required for a Label by calculating the height based on the value of the Ascender, Descender and LineGap for the given font size. Just substitute different font sizes and you will get the corresponding height for each line. The baseline (bottom of the “a” character) of the first line of text is Y + ascender. The baseline for the second line of text is the baseline of the first line plus the leading. If Ascender = 13pt Descender = 4 pt Leading = 13pt + 4pt = 17pt (the default) Y = 100pt The baseline of the first line is 100pt + 13pt (Y + Ascender) = 113pt. The baseline or the second line is baseline of previous line + Leading = 113pt + 17pt = 130pt The baseline or the third line is baseline of previous line + Leading = 130pt + 17pt = 147pt So in your case to calculate the height, you will have to add the ascender, descender and the line gap. Height = ceTe.DynamicPDF.Font.Courier.GetAscender(10) - ceTe.DynamicPDF.Font.Courier.GetDescender(10) + ceTe.DynamicPDF.Font.Courier.LineGap(10); The LineGap is the distance between the baseline of first line and the baseline of the second line. Thanks, ceTe Software Support Team

Re: Line Height

Forum member · Oct 5, 2006
The line of code given is not entirely correct: Height = ceTe.DynamicPDF.Font.Courier.GetAscender(10) - ceTe.DynamicPDF.Font.Courier.GetDescender(10) + ceTe.DynamicPDF.Font.Courier.LineGap(10); Should be: Height = ceTe.DynamicPDF.Font.Courier.GetAscender(10) - ceTe.DynamicPDF.Font.Courier.GetDescender(10) + ceTe.DynamicPDF.Font.Courier.GetLineGap(10); Note the 'GetLineGap' at the end of the line. Sincerly, H. Dijkstra

Re: Line Height

Support · Oct 5, 2006
Hello Dijkstra, Yes, you are correct. Thanks for pointing this out. Thanks, ceTe Software Support Team