Menu

#601 Reduce the EMF output

closed-accepted
nobody
None
5
2014-08-15
2012-08-30
No

Current EMF terminal puts some unnecessary commands for
set_font and set_dasytype. Attached patch enable to reduce
the output size by ignoring such commands.

Discussion

  • Shigeharu TAKENO

    a patch for emf.trm

     
  • Ethan Merritt

    Ethan Merritt - 2012-08-30
    • status: open --> open-accepted
     
  • Ethan Merritt

    Ethan Merritt - 2012-08-30

    Thank you very much for reporting the problem and for providing a patch.

    As to EMF_set_font, I have applied a slightly different fix guided by your patch.

    As to EMF_dashtype, it seems that the dash assignment code has been broken in EMF for a long time. I applied a simple fix for the broken code, but after this fix your patch no longer matches the code. Can you confirm that the dashed lines now work correctly, for example in dashcolor.dem? I do not know if a revised version of your patch is still needed to prevent unnecessary linetyps requests in the output file.

     
  • Shigeharu TAKENO

    a patch for new emf.trm

     
  • Shigeharu TAKENO

    snapshot of 1st emf file of dashcolor.dem

     
  • Shigeharu TAKENO

    snapshot of 2nd emf file of dashcolor.dem

     
  • Shigeharu TAKENO

    I made a patch emf-reduce-3.diff for new emf.trm. I attached snapshot data
    of emf output for dashcolor.dem. Original gnuplot puts the emf file which have:

    CreatePen
    DeleteObject <- Pen
    CreatePen
    ...

    and

    CreateFontIndirect
    DeleteObject <-- Font
    CreateFontIndirect
    ...

    The patch reduce such codes. Indeed, the emf file sizes of dashcolor.dem are:
    1st page: 37948 byte (2158 EMR records) -> 35932 byte (2051 EMR records)
    2nd page: 99616 Byte (5928 EMR records) -> 82552 byte (4951 EMR records)

     
  • Ethan Merritt

    Ethan Merritt - 2012-09-04

    Thanks. The patch looks good. But there is one part I do not understand. Can you explain what is the purpose of these instructions?

    EMF_SelectObject(EMF_STOCK_OBJECT_BLACK_PEN);
    EMF_SelectObject(EMF_STOCK_OBJECT_WHITE_BRUSH);

    These commands appear in more than one place.
    Since gnuplot always defines and uses its own PEN and BRUSH objects, I don't understand the reason for temporarily selecting the STOCK_OBJECT ones?

     
  • Shigeharu TAKENO

    The followin page says:

    http://msdn.microsoft.com/en-us/library/dd183539%28v=vs.85%29.aspx

    "Do not delete a drawing object (pen or brush) while it is still selected into a DC."

    So, we can delete pen and brush after taking another pen or brush.

     
  • Ethan Merritt

    Ethan Merritt - 2012-09-12
    • status: open-accepted --> closed-accepted
     
  • Ethan Merritt

    Ethan Merritt - 2012-09-12

    patched EMF driver now in CVS for both 4.6 and 4.7

     

Log in to post a comment.