problem with display of rich text objects

  • I am using WPTools V4.22, WPTools 4.22 RTF Engine, and WPForm V2.3. I am having a problem using Rich Text in my designs.

    I call the aRTFTEXT action from the WPA unit to create these rich text objects. The editor works fine rendering the text correctly while in edit mode. However, when the object refreshes after the inplace editor closes, the text in the object becomes almost unreadable. If I go back into edit mode on an rtf object, the text rerenders correctly while in edit mode. I've tried many fonts to see if it was font related, but the problem persists regardless of font selected. I have narrowed the cause of the display error to the form editor AutoZoom setting. If the AutoZoom is NOT set to wpfAutoZoomOff, the text will render poorly.

    I realize that if the autoZoom causes significant reduction of the font size, "greeking" of the text image will result. However, I am dealing with a page size that is 8.5 x 3.6 inches which causes approximately a font size reduction to 70% of the actual size at 800x600 resolution, which should not be unrenderable. The fact that calling the inplace editor cleans up the text perfectly even when AutoZoom is NOT set to wpfAutoZoom proves that the text can be rendered correctly at that resolution and page size.

    I have been able to reproduce this error using the "reporter" demo program.

    Is there some way to get rtf text objects to refresh using the same procedure that the inplace editor does upon entering edit mode? This would solve the problem.

    Thanks in advance for your help.

    - Steve Kowal

    • Offizieller Beitrag

    When the text is saved from the editor is saved with the wordwrap information and line heights saved as well.
    This is important because switching the printer should not change the display in WPForm.
    But in WPTools 4 using a zoom mode also changes the internal rendering resolution and so the information is not passed correctly.

    If you use an external editor which should be scalable I recommend to load the text before it is posted in a TWPRichText which has the size of the object. The property loIgnoreWordWrapInformation must be active in the Header.LoadOptions to get rid of the added tags.

    Julian

  • Are you planning to fix WPTools so that a zoom mode does render the text correctly? Or is my only option to use an external editor, and if so which one do you recommend that provides scalability?

    -Steve Kowal

  • I found a bug in the fix for this problem: If a rich text object has a non-transparent background, the fix logic renders only the background and not any of the formatted text. I made the following changes to the WPFGR.pas to eliminate the problem:

    Old Code:

    Code
    procedure TWPFGGraphicText.DrawIt(toCanvas: TCanvas; r: TRect);...      wpfRTFText:        begin          if (FRTFObject <> nil) and assigned(FWPFOnRenderRTFObject) then          begin           // OLD CODE -  USING ZOOMING VALUE           if FEditor.FResInfo.FZooming=100 then           begin            if assigned(FWPFOnCanvasRTFObject) then              FWPFOnCanvasRTFObject(FRTFObject, toCanvas,                r, Data.Angle, Feditor.FResInfo.FZooming, 0, FALSE);            FWPFOnRenderRTFObject(FRTFObject, toCanvas, r, Data.Angle,              FEditor.FResInfo.FZooming, 0, FEditor.FPrintInfo.FPrinting, nil);           end           else // New code - change canvas resolution according to ZOOM           begin            saveddc := SaveDC( toCanvas.Handle );

    New Code:

    I just cleared the brushstyle before saving the device context. FYI.

    - Steve Kowal

  • I found what seems to be a fix.

    I tried the solutions in this message, and none of them actually worked for me unless the RTF was the size of the whole page.

    Here's what I added in the DrawText function...

    where the lines read...

    saveddc := SaveDC(toCanvas.Handle);
    try
    resx := GetDeviceCaps(toCanvas.Handle, LOGPIXELSX);
    resy := GetDeviceCaps(toCanvas.Handle, LOGPIXELSY);
    GetWindowOrgEx(toCanvas.Handle, bl);
    SetMapMode(toCanvas.Handle, MM_ANISOTROPIC);

    ///I did this - note the "resx-3"
    SetWindowExtEx(toCanvas.Handle, resx-3, resy, nil);

    SetViewPortExtEx(toCanvas.Handle,
    MulDiv(resx, Feditor.FResInfo.FZooming, 100),
    MulDiv(resy, Feditor.FResInfo.FZooming, 100), nil);
    SetWindowOrgEx(toCanvas.Handle,
    MulDiv(bl.x - r.Left, 100, Feditor.FResInfo.FZooming),
    MulDiv(bl.y - r.Top, 100, Feditor.FResInfo.FZooming), nil);

    For some reason, adding that "-3" to the code made it display properly at all fonts, sizes, and zooms. I have NO IDEA WHY since I'm not a programmer, but it seems to have solved the problem on my end.

    John-David Biggers

    PS - Julian, my son, Julian, is getting real big, now. Pretty soon I'm going to have to show him the online world and let hime cyber-meet you, the person I named hm after.

    • Offizieller Beitrag

    Hi,

    thanks for your comment. But I really don't know. I get great zooming of RTF controls here, no problem at all. And best wishes to your son!

    I just found (finally) the problem with the strings in the inspector (which always showed 0 after clearing) - that was caused by the variant handling.

    I just posted WPForm 2.76 PRO.

    Regards,

    Julian Ziersch

    • Offizieller Beitrag
    Zitat

    Are you planning to fix WPTools so that a zoom mode does render the text correctly? Or is my only option to use an external editor, and if so which one do you recommend that provides scalability?

    -Steve Kowal

    WPTools 6 zooms perfectly (???!!!). The whole architecture of WPTools 5 and 6 is build up from zero to support zooming without the need to recalculate the text, as it was in WPTools 4.

    PS.: Please do not post links to videos (as in your signature) - we eill have to delete that posts.