PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 30, 2024 2:29 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Jul 05, 2012 11:39 am 
Offline

Joined: Mon Jul 02, 2012 3:05 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 05, 2012 12:42 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 05, 2012 1:23 pm 
Offline

Joined: Mon Jul 02, 2012 3:05 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group