PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Non breaking space in XTextFormatter https://forum.pdfsharp.net/viewtopic.php?f=2&t=2074 |
Page 1 of 1 |
Author: | xavier [ Thu Jul 05, 2012 11:39 am ] |
Post subject: | Non breaking space in XTextFormatter |
Hi, I have a problem with text formatting in XTextFormatter. I find it necessary to use nbsp in my strings, but they get wrapped anyway. I looked into the code and found that blocks in XTextFormatter are built between the characters, that are whitespace according to Char.IsWhiteSpace(char). How can I override/trick this behaviour? I wouldn't want to modify the PdfSharper code itself, yet I find the problem quite critical. Will this behaviour change in future releases? Do you know of any whitespace character, that does not validate with Char.IsWhiteSpace? Thanks in advance |
Author: | Thomas Hoevel [ Thu Jul 05, 2012 12:42 pm ] |
Post subject: | Re: Non breaking space in XTextFormatter |
Hi! The answer can be found in the XTextFormatter source code: Code: /// <summary> /// Represents a very simple text formatter. /// If this class does not satisfy your needs on formatting paragraphs I recommend to take a look /// at MigraDoc Foundation. Alternatively you should copy this class in your own source code and modify it. /// </summary> Make a copy of XTextFormatter and modify it for your needs. In the line "else if (Char.IsWhiteSpace(ch))" treat NBSP as NonWhiteSpace. |
Author: | xavier [ Thu Jul 05, 2012 1:23 pm ] |
Post subject: | Re: Non breaking space in XTextFormatter |
Wow, I've missed that comment. I think that's what I'll do, a copy of XTextFormatter. Switching to MigraDoc could be a bit more expensive. Thanks for help, case closed |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |