Label with "HTML-like Text Formatting" gets a space in start of next line when warping.

1 Answer 104 Views
Label
Simos Sigma
Top achievements
Rank 2
Iron
Iron
Iron
Simos Sigma asked on 25 Aug 2022, 01:58 PM

Hello community!!!

I have a RadLabel with HTML-like formatting text and TextWarp property to true.

My_radLabel.Text = "<html>This is a text <b>example</b> this is a text <b>example</b> this is a text <b>example</b> this is a text <b>example</b>.";
My problem is when RadLabel text is warping. In any point of text where the </b> tag exists, if text warps there, next line has a space at the start like this:

This is a text example this is a text example
  this is a text example this is a text example.


Else, if I remove the <b> tag where the text is warping it looks okay:
My_radLabel.Text = "<html>This is a text <b>example</b> this is a text example this is a text <b>example</b> this is a text <b>example</b>.";
This is a text example this is a text example
this is a text example this is a text example.

Any idea why is this happening?

Thank you for your time!!!

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Aug 2022, 11:35 AM
 

Hello, Simos,  

By default, Telerik Presentation Framework uses GDI+ to measure and render the text. You can easily switch to GDI instead by setting the UseCompatibleTextRendering property to false for the respective control. However,  the HTML-like text formatting functionality is supported only when using GDI+. More information is available in the following article:
https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/text-rendering

Note that the differently styled text parts are rendered in blocks so the appropriate style is correctly rendered. The empty space after the bold text is rendered separately from the bold text itself, that is why it goes to the next row.

The possible solution that I can suggest is to include the empty space in the bold text:

            this.radLabel1.Text = "<html>This is a text <b>example</b> this is a text <b>example</b> this is a text <b>example</b> this is a text <b>example</b>.";
            this.radLabel2.Text = "<html>This is a text <b>example</b> this is a text example this is a text <b>example</b> this is a text <b>example</b>.";
            this.radLabel3.Text = "<html>This is a text <b>example </b>this is a text example this is a text <b>example </b>this is a text <b>example</b>.";

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Tags
Label
Asked by
Simos Sigma
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or