Incorrect accented characters on print

Once in a while I keep running into a frustrating problem: On some setups, some international characters in Memos get printed as some other characters. E.g. I want to print a Å™, but it gets printed as ?? (or maybe not the actual Norwegian character but some character which resembles it). The preview itself is OK, which makes me think it's somehow related to fonts available inside a printer (as if FR told the printer, "Print me a Å™ using the Arial font" and the printer used the ?? glyph, because it has the same character code as Å™ in the embedded Arial font). The problem is, I turned just about everything I could think of off, hoping that I would force Windows to print my report as an image rather than a mixture of text and images, but no go - I still keep getting ??'s. But other applications, e.g. Notepad, can print just fine. Is this a known bug of FR 2.5x, or did I overlook some setting in my printer setup, or is it something else? I would appreciate any help, because I just can't figure it out.

Comments

  • edited 3:18PM
    Well, I feel like I raped the source code horribly, but at least I got it working: In fr_class.pas, I changed
    procedure TfrMemoView.AssignFont(Canvas: TCanvas);
    begin
      with Canvas do
      begin           
        SetBkMode(Handle, Transparent);
        Font := Self.Font;
        if not IsPrinting then
          if ScaleY = 1 then
            Font.Height := -Round(Font.Size * 96 / 72 * ScaleY) else
            Font.Height := -Trunc(Font.Size * 96 / 72 * ScaleY);
      end;
    end;
    
    to
    procedure TfrMemoView.AssignFont(Canvas: TCanvas);
    begin
      with Canvas do
      begin           
        SetBkMode(Handle, Transparent);
        Font := Self.Font;
        Font.Charset := EASTEUROPE_CHARSET;
        if not IsPrinting then
          if ScaleY = 1 then
            Font.Height := -Round(Font.Size * 96 / 72 * ScaleY) else
            Font.Height := -Trunc(Font.Size * 96 / 72 * ScaleY);
      end;
    end;
    
    I am not sure exactly whether the problem is in TFont.Assign not copying the charset or in FR 2.5x not setting the Font's charset even when it is set in the Report Designer, but the important thing is that this ugly hack works.
  • edited 3:18PM
    The hack I described in the second post seemed to work well enough, so I stopped looking for a better solution.

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.