Unicode rendering in Preview

PolomintPolomint Australia
edited 5:05PM in FastReport VCL 5
Some time ago I reported a problem with rendering unicoded currency symbols in the PDFed version of a Fast Report.

That was fixed (I think with v5.3.6).

However we still have a minor problem with unicodes in the FastReports Preview screen. A printed version of the report has the same issue. Exporting to PDF (and then printing) is fine however.

Attached are screen grabs from the same test data and code-base (taken a couple of days apart) that show the Rupee symbol rendered correctly in PDF export, but not in Preview. The program was built with FastReports v5.6.

Screenshot%202017-03-28%2013.52.02.png

Screenshot%202017-04-03%2010.01.55.png

Is there something simple we should do to fix this?

Comments

  • gpigpi
    edited 5:05PM
    What version of Delphi do you use?
    Attach your report template with Rupee symbol here
  • PolomintPolomint Australia
    edited 5:05PM
    Thanks QPI.
    gpi wrote: »
    What version of Delphi do you use?
    Seattle (but the problem occurred in code generated by XE7 too)
    gpi wrote: »
    Attach your report template with Rupee symbol here
    The template probably won't help you as the field is populated by code in the DetailBandBeforePrint event (but is attached here anyway). The relevant section is:
    <TfrxMemoView Name="Balance" Left="340.15745591" Top="0" Width="94.48818898" Height="18.89765" DataSet="frxDBDataset" DataSetName="UnitValueQuery" 
    Font.Charset="0" Font.Color="0" Font.Height="-13" Font.Name="Tahoma" Font.Style="0" HAlign="haRight" ParentFont="False" Text=""/>
    

    The code in the event looks like:
    procedure TGLOWReportUnitValue.DetailBandBeforePrint (Sender : TfrxReportComponent; var PrintBand : Boolean);
    begin
      with GLOWDataModuleBasic do begin
        AccountNameAndNumber.Text := GetAccountNameNumber (QueryResults, EmptyStr, ' / ');
        if IsNull (QueryResultsCurrency.AsVariant) then
          Balance.Text := FormatCurr (gblfmtDefaultCurrency, -QueryResultsBalance.Value)
        else
          Balance.Text := FormatCurr (GetCurrencyFormat (QueryResultsCurrency.Value), -QueryResultsForeignBalance.Value);
        PrintBand := True;
      end;
      DetailBandBackground.Color := BandColour.GetColour;
      if PrintBand then
        with Report.Engine do begin
          if FreeSpace < DetailBand.Height + CountriesGroupFooter.Height then
            NewPage;
        end;
    end; {TGLOWReportUnitValue.DetailBandBeforePrint}
    

    The gblfmtDefaultCurrency value is "'$'#,##0.00' ';('$'#,##0.00)" for AUD (Australia).

    GetCurrencyFormat returns "'₹'#,##0.00' ';('₹'#,##0.00)" for INR (India).

    FormatCurr is the standard SysUtils function.
  • gpigpi
    edited April 2017
    FR show ₹ in the preview correctly. See here: https://yadi.sk/d/JUbEOnX93GcmFq
  • PolomintPolomint Australia
    edited 5:05PM
    Thanks QPI.

    Your reply has prompted me to do what I should have tried first!

    I've built a basic testbed using the Test.fr3 file you provided, and have now added to it (in the BeforePrint event) code to populate the Memo1.Text.

    So far it is all operating as it should.

    I'll experiment further to find out what causes the odd behaviour of our application. Once I know that, I'll post it here (as possible help to others). >
  • PolomintPolomint Australia
    edited 5:05PM
    ROOT CAUSE FOUND [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Came back to this after doing something else for several days, and have found that the CharSet value in the Font property of the Page or Band is causing[/img]different behaviour for Text Object set as a literal in the Report Editor and when the TfrxMemoView Text property is set from Delphi code.

    If Charset is "Default_Charset" both Preview and PDF Export successfully handle the Unicode character (Rupee symbol) regardless of whether it is set literally or via Delphi code.

    If Charset is "ANSI_Charset" then Preview handles the Unicode character incorrectly when set via code, but correctly when set as a literal. PDF Export is correct for both methods of setting the character.

    While this was a minor inconvenience, and is now easily remedied, I am still tempted to raise a Ticket, because this could cause someone else to waste a lot of time trying to work out what is happening.

    I will raise a ticket if I get one or more votes from Forum Members to do so >

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.