Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Non-breaking spaces in DrawText not displayed
  FAQ FAQ  Forum Search   Register Register  Login Login

Non-breaking spaces in DrawText not displayed

 Post Reply Post Reply
Author
Message
bozzy View Drop Down
Beginner
Beginner


Joined: 09 Mar 12
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote bozzy Quote  Post ReplyReply Direct Link To This Post Topic: Non-breaking spaces in DrawText not displayed
    Posted: 09 Mar 12 at 11:52AM
Hi.

I'm having a similar problem to that exposed here:

http://www.quickpdf.org/forum/spaces-in-drawtextbox-not-displayed-in-pdf_topic1288.html

In order to maintain spaces between words when using DrawTextBox, I've created a function that substitutes Chr(32) with Chr(160). I call this function whenever I have to put out text on a PDF, regardless of whether I'm going to use DrawText or DrawTextBox.

The problem is that, quite surprisingly to me, DrawText is "eating" non-breaking spaces Chr(160), behaving exactly the opposite than DrawTextBox.

Is this another "feature" or is it a bug?

Thanks,

Bozzy


Edited by bozzy - 09 Mar 12 at 11:53AM
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 12 Mar 12 at 1:00PM
Can you post a quick example to show the problem so that I know that we are talking about the same problem.  DrawText and DrawTextBox are two different routines but it should be quite possible to make them work the same way in regards to Chr(160).

Posting a quick example will make sure we fix the exact problem.

Andrew.
Back to Top
bozzy View Drop Down
Beginner
Beginner


Joined: 09 Mar 12
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote bozzy Quote  Post ReplyReply Direct Link To This Post Posted: 12 Mar 12 at 3:26PM
I've just found that something's changed from QuickPDF 7.xx to QuickPDF 8.xx in regards to Chr(160).
It took me some time to figure it out, because I was SURE that DrawTextBox would "eat" multiple-spaces - Chr(32) - in v7.xx, while now it doesn't anymore.

Now it seems that DrawText and DrawTextBox behave exactly the same, so they keep sequences of Chr(32) intact and completely "eat" sequences of Chr(160).

This could be fine for me, but at this point I'm asking that things remain stable in the future, 'cause a year ago I've had to rewrite a lot of functions using DrawTextBox in order to put Chr(160) to maintain text formattation, and now, more by coincidence than other, I've found that I have to rewrite them again in order to restore standard space Chr(32) in place of non-breaking space Chr(160).
Better would be if also Chr(160) would be printed as a space, so I can let the functions as they're now.

This is a code snippet in Delphi to reproduce the problem (missing #160 spaces in PDF).

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TQuickPDF.Create do
  try
    UnlockKey(********);
    SetPageDimensions(842, 595);
    SelectFont(AddStandardFont(0));
    SetTextSize(12);
    DrawText(20,550,'HELLO' + #160#160#160#160#160 + 'WORLD    by    DrawText!!!');
    DrawTextBox(20,530,800,20,'HELLO' + #160#160#160#160#160 + 'WORLD    by    DrawTextBox!!!',1);
    SaveToFile('c:\test.pdf');
  finally
    Free;
  end;
end;

Thank you.

Bozzy

P.S. if you'd like to see the PDF created with QuickPDF v7 and v8 let me know where to attach files.
Back to Top
bozzy View Drop Down
Beginner
Beginner


Joined: 09 Mar 12
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote bozzy Quote  Post ReplyReply Direct Link To This Post Posted: 12 Mar 12 at 3:37PM
Just to be complete, watching at the thread I've mentioned in my first post above, there's a post by Rowan who says:

Ingo is right, it's by design.

The DrawTextBox function splits the text into words to do the wrapping and when it puts the words back together again it just adds a single space. Using Chr(160) should fix the problem as it is a non-breaking space. For the DrawHTMLText function the   entity can be used.

Cheers,
- Rowan.

Now it's behaving differently and it seems this isn't explained in any release notes or in the manual. If you'll decide to keep Chr(160) as non-printable, maybe it's worth spending two words in the manual and maybe adding a comment in the original thread about DrawTextBox and Chr(32) / Chr(160) difference.

Cheers.

Bozzy
Back to Top
bozzy View Drop Down
Beginner
Beginner


Joined: 09 Mar 12
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote bozzy Quote  Post ReplyReply Direct Link To This Post Posted: 23 Mar 12 at 11:20AM
Hi.

Any news here? Can I go and replace Chr(160) with Chr(32) when using the DrawTextBox and DrawText functions? Will it stay as it's behaving now?

Cheers,

Bozzy
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 13 at 2:54AM
Hi Bozzy,

I have tested using Chr(160) and Chr(32) in version 9.16 Beta 2 with DrawText and DrawTextBox and they are both working as expected. Though it is possible that certain fonts won't support char 32 and 160. You can download 9.16 Beta 2 from here:


Can you try again using 9.16 beta 2 and let us know how you go? If it still doesn't work on your end please post the code you're using and the PDF that is generated on your end.

Cheers,
- Rowan.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store