#1 Re: PDF Engine » Problems with render metafile EMF created by LibreOffice Draw » 2011-03-11 10:51:54

Sorry, I am causing confusion.   I was using WMF files instead of EMF files, because I was having problems with EMF files and embedded StretchDIBits images (the images would go missing).   That issue has now been resolved because I now do my EMF drawing using GDI+ instead of GDI.  This had nothing to do with SynPDF.

During my earlier testing, I had observed that SynPDF would put "blocks" or "borders" around all graphic elements in my WMF files when adding them, but it would not do that with EMF files, which is why I was focusing on EMF files in my upload of the demo project.   Of course, the problem with WMF files is still there if you look at "langbad-original.pdf" which imports "langbad.emf" which was created by embedding a WMF file inside an EMF file.   It's a bit confusing, I hope I am making sense.

Anyway, it now turns out that my issues with SynPDF have not been solved by my new EMF drawing method anyway, because the graphic corruption in "boxes-original.pdf" is still there, and the boxes in "langbad-original.pdf" are also still there.

Regarding Uniscribe, Uniscribe:=True seems to not respect the character width on some Asian fonts with wide characters.   However, Uniscribe:=True does at least show the characters, as you pointed out.

I am doing further testing.

#2 Re: PDF Engine » Problems with render metafile EMF created by LibreOffice Draw » 2011-03-11 06:16:08

I have fixed an issue I was having with EMF files.   Currently, SynPDF renders EMF files correctly.  The files I uploaded, and the problems described in the original report either no longer occur, or do not occur in the same way when using EMF files as opposed to WMF files.   Hence, I will continue using WMF files.   

Font fallback for multilingual fonts remains an issue, however.  I am finding that I need to specify the same font for all text in my EMF in order to get SynPDF to render the fonts correctly, and even then, some fonts (seems to be those inside font collection .ttc files??) don't render anyway.   I'll look into the font issue again at a later stage.

#4 PDF Engine » Problems with render metafile EMF created by LibreOffice Draw » 2011-03-09 10:20:30

cjrh
Replies: 5

Using LibreOffice Draw, I export metafiles (as EMF) and when I try to add these metafiles to a pdf document, using Canvas.RenderMetafile(), there are various rendering problems and bounding boxes being drawn, and so on.  I have sent you an email (with attachment) about this.  This ticket is just so that we can have the issue logged for follow up.

#5 Re: PDF Engine » Asian fonts (simsun.ttc) causes range check error. » 2010-06-23 07:04:54

Looks perfect!   Many thanks for your speedy fix!  The emf was created by entering the text into Word, and then using a virtual printer to write printing commands to the EMF.    I would love to follow development of this library (and perhaps contribute) by tracking a version-control archive.   As far as I can see, you don't use one yet?   I would recommend Git or Mercurial over Subversion.

#6 Re: PDF Engine » Asian fonts (simsun.ttc) causes range check error. » 2010-06-22 00:07:18

With range-checking disabled, output is indeed generated.   In my output PDF, however, I see that although the correct Asian text is now generated, the Arabic text is not right.   An email, with attachments, has been sent to you about this.   Thank you for your prompt feedback.

#7 PDF Engine » Asian fonts (simsun.ttc) causes range check error. » 2010-06-21 13:49:02

cjrh
Replies: 8

I seem to have found a problem rendering asian fonts, specifically something that requires simsun.ttc.   I have an EMF file that I am trying to convert to PDF.  Code looks like the following:

var
  Doc: TPdfDocument;
  Metafile: TMetafile;
begin
  Doc := TPdfDocument.Create;
  Doc.UseUniscribe := True;
  Doc.AddPage;

  Metafile := TMetafile.Create;
  Metafile.LoadFromFile('test.emf');

  Doc.Canvas.RenderMetaFile(Metafile);
  Doc.SaveToFile('test.pdf');
end;

I can't see how to add an attachment, but I am happy to send "test.emf" in an email if you provide me with an address.

A range-check error is caused in SynPdf.pas, line 5647, in code:

procedure SwapBuffer(P: PWordArray; PLen: Integer);
var i: integer;
begin
  for i := 0 to PLen-1 do
    P^[i] := swap(P^[i]);
end;

It seems that PWordArray (length 16384 defined in sysutils) is too small for the Simsun font, though FWIW I have no experience with this library at all, and the fault could easily lie with me.

regards
cjrh

Board footer

Powered by FluxBB