font embedding and Windows font fallback

My report should be able to display (almost) any Unicode character, but our customers' PCs are not supposed to have an Unicode font installed (such as Arial Unicode MS) and we would prefer not to install additional (large and costly) fonts on them.

So I was relying on the Windows font fallback strategy by setting all TfrxMemoView to Arial font and set

with frxPDFExport1 do begin
EmbeddedFonts:= true;
Compressed:=true;

, expecting that the pdf will use and embed characters from fallback fonts such as SimSun or Segoe UI automagically when needed.

However, Unicode characters missing in Arial show up as "tofu" blocks in the pdf, and using Adobe Acrobat, I could see they are forced to Arial.

Is there a way for Fast Reports to use the font fallback mechanism AND embed those characters ?

thanks !

Comments

  • gpigpi
    edited 6:14PM
    For unicode characters you should use unicode fonts (like Arial Unicode MS)
  • edited 6:14PM
    gpi wrote: »
    For unicode characters you should use unicode fonts (like Arial Unicode MS)

    yes I know, but there is no single font with all the characters I need, and the .pdf would be too large, so I tried another approach : dynamically changing the font depending on the language.
    I set a style for all memos that are translated and tried to change the style's font if the result will be in japanese:
    procedure DoReport(LReportData:TReportData);
    var
      LStyle : TfrxStyleItem;
      i:integer;
    begin
      with FFastReport do begin
        frxPDFExport.FileName:= LReportData.FDestFile;
        ReportTranslate.Language:= LReportData.FLanguage;
        with frxreport do begin
          LoadFromFile(LReportData.FSrcReport, True); 
    
          if LReportData.FLanguage='jp' then begin
            for i:=0 to Styles.Count-1 do begin
              LStyle := Styles[i];
              LStyle.Font.Name:='SimSun';
            end;
            // something needed to update styles ?
          end;
    
          if not PrepareReport(True) then raise Exception.Create('report generation failed');
          if not Export(frxPDFExport) then raise Exception.Create('pdf export failed');
        end;
      end;
    end;
    

    however, the .pdf still uses Arial (the font of the style for other languages)

    What should I do to re-apply the style after changing the font ?

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.