Hello,
I know you cannot modify the line spacing used by a FormattedLinkLabel, but is there any way to determine what the spacing is that it's using? For a multiple line label, it definitely looks like it's based on the largest font in the line, and perhaps is related the the Ascent value of the font, but is there anything concrete that we could reference?
Thanks,
Sean.
Sean,
I don't see anything that would control this, but I do believe that you are correct that it performs the spacing based on the Ascent of the largest font. What is likely happening is that it is using the .NET Graphics class to perform measuring logic in addition to the actual rendering of the text (based on the TextRenderingMode of the control), though the former would be what is more relevant in terms of the positioning of the child elements. In order to change this, I think that the child elements would have to overlap each other (if you want smaller line spacing, for example), but to my knowledge this functionality is not available.
What do you need to know the line spacing for? Perhaps there is another way to accomplish what you're trying to do.
-Matt
Hi Matt,
It now seems that it's more than just the ascent. If I have a multi-line label, changing the size of one line changes the line spacing of the following line. We were at least hoping the line spacing is determined by whatever is on the line itself, not lines above! Perhaps it's using the ascent of the current line, and the descent of the line above?
We're trying to use this control in an application that requires the text on the control to be matched up position-wise with the same text (same font, size, etc.) in a Mac graphics app. The inability to determine what line spacing the control is using is making this impossible at the moment.
We're really hoping Infragistics can shed some concrete light on this.
I just tried the following value and the spaces between the lines were definitely different:
<span style="font-weight:bold; font-size:+3pt;">ultraFormatt</span> <br/>edLinkL<span style="font-size:18pt;"><br/>abel1</span>
If I increase the size of the first line, the space between the 2nd and 3rd lines remains the same on my machine:
<span style="font-weight:bold; font-size:+10pt;">ultraFormatt</span> <br/>edLinkL<span style="font-size:18pt;"><br/>abel1</span>
Perhaps you can post a screen shot, or the value that you're seeing this? I'm still not sure that there is going to be any way to determine the line spacing, but you may be able to look at the UIElements with the UIElementViewer and see if that helps narrow things down for you.
Matt,
Here's what I'm seeing.
I just create a windows app in Visual Studio and add an UltraFormattedLinkLabel with multiple lines. I'm using "GDI" for the TextRenderingMode. The first Value I use is:
<p style="text-align:Center;"><span style="font-family:Times New Roman; font-weight:bold; font-size:72pt;">Test</span><br/><span style="font-family:Times New Roman; font-style:normal; font-size:72pt;">Test</span><br/></p>
I also add some regular labels that I use to show the baseline and measure the distance between the baselines. The line spacing (baseline to baseline) is 110:
If I change the top line to 20pt, then move my labels equally, you can see the line spacing for the second line is actually smaller:
After I adjust the baselines and the measuring label, the line spacing (baseline to baseline) is now 95:
I will check out UIElementViewer to see if that helps.
I used the UIElementViewer as well, and it seems like the text is being centered in each TextSectionUIElement, though I'm not exactly sure what is used to provide the spacing on the top and the bottom. If it's based on the ascent/decent, to check the line spacing you could certainly take the height of the TextSectionUIElement and add the descent of the first line the ascent of the second (if I have my terminology right). Another,hackish option would be to always have a certain letter in each line that you have (for example the capital "T), but make it the same color as your form so that it can't be seen. Naturally this could throw off horizontal text positioning, which you would have to account for, but it would make the line spacing consistet.
For example, the value:
<p style="text-align:Center;"><span style="color:#ebe9ed; font-family:Times New Roman; font-weight:bold; font-size:72pt;">T</span><span style="font-family:Times New Roman; font-weight:bold; font-size:20pt;">Test</span><br/><span style="font-family:Times New Roman; font-style:normal; font-size:72pt;">Test</span><br/></p>
Assuming that the background of your form is the standard Control color of an unmodified OS theme.