WPCubed Product Support

One more time...shifting characters

I really need to get this fixed. How can no one else have this problem? I've just got Turbo Delphi Pro and I am still getting this issue:

You can refer to the sample project file here: [](http://www.blueapples.org/gems/wptools_test.zip)

Or you can just drop a TWPRichText control on a blank form, set Align to alClient, set WordWrap to true. Run the program. Type some text that wraps. Slowly resize the window horizontally.

Seemingly random characters will move horizontally one pixel at a time, back and forth.

Can I be any clearer with the issue I am having? I have tried this with Delphi 6 Personal, Delphi 2005 Personal, and Turbo Delphi 2006 for Win32. I have seen the problem on XP Home SP2 Home, Pro, and Media Center.

#1 ♥ 0
3.5k Views 1 links 2 users read 2 min

@Blueapples:
I really need to get this fixed. How can no one else have this problem?

I can reproduce your problem. Here are the results of my investigation and a workaround which you can use.

It is the ExtTextOutW function which makes the characters jump back/forth. If you replace "@OptCharWidth[0]" with "nil" in following function then the problem is gone, but this is not a (good) solution.

procedure TWPRTFEnginePaint.PaintRTFPage(...)begin  ...  else ExtTextOutW(dc, OptBufferX, yy, ExtTextOutMode,    @rr, @OptCharPaintBuffer[0], OptBufferCount, @OptCharWidth[0]);  ...end;

If you include wpfAlwaysFormatWithScreenRes in FormatOptions then the problem should be gone too, but it does not. Why? The reason is that this setting is not always respected by WPTools.

As you can see, the TWPRTFProps.Init calls UpdateRef with false (read: "do not format with screen res") and does not respect the wpfAlwaysFormatWithScreenRes setting.

procedure TWPRTFProps.Init(...)begin  ...  UpdateRef(false);end;

You can work around that "UpdateRef(false)" by doing the following in your own application.

procedure TForm1.FormCreate(Sender: TObject);
begin
  WPRichText1.FormatOptions := WPRichText1.FormatOptions + [wpfAlwaysFormatWithScreenRes];
end;

procedure TForm1.WPRichText1AfterLoadText(Sender: TObject);
begin
  WPRichText1.RTFData.UpdateReformatMode;
end;
#2 ♥ 0

Fedpol, you have made my day! I was beginning to think that there really wasn't a solution and using WPTools as a rich text edit replacement wasn't possible (just good for word processing), thank you for helping me, this has been a frustrating part of this project and I simply wasn't able to put the time into digging through the source code. It's a smooth as butter now.

#3 ♥ 0
This category is archived. No new posts are possible.