AV Embedding Fonts into PDF

I am getting an Access Violation when choosing embedding fonts into a PDF. I am using XE 7 and Fast Reports 5.1.7

I did not realize it had that bug until I pushed an app out to production. Unfortunately I have upgraded to XE7 and have no way of going back (without many hours of work)

Comments

  • edited October 2014
    If you compile for debug it is working?
    Try to build for release without optimizations.

    There is a issues with GetGlobalFont() function in frxExportPDF.pas.
    I have reported this but someone there said this is not an issue.

    From docwiki: http://docwiki.embarcadero.com/RADStudio/X...#For_Statements
    There you can read:
    "After the for statement terminates (provided this was not forced by a Break or an Exit procedure), the value of counter is undefined."
    for i := 0 to FFonts.Count - 1 do
        begin
           //some code.....
        end;
        if i < FFonts.Count then //<---- here i variable can be undefined !!!!
          result := TfrxPDFFont(FFonts[i])
    
  • edited 7:27PM
    Delphi shows Line 203 (I beleive, based on CPU window) in frxCmapTableClass.CmapTableClass.LoadSignedCmapSegment

    The AV is nil, not an address, so it might be either an unintialized variable or an already freed object from FreeAndNil() or low level stuff accessing invalid data. I do not have source code so I do not know. Just trying to help.

    CPU:
    <unknown file>.203:
    01364A75 8B45FC mov eax,[ebp-$04]

  • edited 7:27PM
    Also, the file stays in use after the exception rolls out. You may be missing a try/finally and closing the file.
  • edited 7:27PM
    If this happens in debug mode too you can post Call Stack. Insert all then Ctrl-C and post here.
  • edited October 2014
    Hello,

    I have same problem too.
    I get problem only with property PDFExport1.EmbebdedFont set to True

    Debug Window screenshot after break program is attached.

    Debug Window at line before Exception is attached.
  • edited October 2014
    I can not reproduce and I think this depends on fonts you are using.
    I will want to try to reproduce with your font. You can put a breakpoint in frxTrueTypeCollection at line 170 Name := font.Name; and see all font names. I need the font name that will raise exception after you see the name.
  • font.Name is 'Arial'

    My priority is embedded FontName 'Arial Narrow' like used condensed font.

    OS: Windows 7 x64 CZ. Problem have all users of My Application.
    With Fast Report 4 works OK !

    Base simple sample project attached.

    FastReport 5.1.8. Ent. I use compiled from source.



  • edited 7:27PM
    Your example do use Arial (not Arial Narrow) and with FR 5.1.8 and Delphi XE7 I do not have any issues.
    I do not have now "Arial Narrow" to test with because it comes with MS Office or other paid way.
    If you comment following line in TfrxPDFFont.Create() you will avoid this error but the file will be ten times bigger:
    PackFont := true;

    Have you tried to open a support ticket at FastReport?

  • New support ticket is created.
  • edited 7:27PM
    I found a solution to the AV here:
    http://www.fast-report.com/en/forum/?p=/discussion/comment/33369
    

    I tested with version 5.1.12 and it worked perfectly.

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.