EMF export, zero width line problems
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
New
|
Undecided
|
Unassigned |
Bug Description
EMF export has two problems with zero width exported lines:
1. If stroke is disabled createpen is never called but fill is. Other applications that read the EMF can then use a default pen which is not zero width.
Fix to apply to emf-win32-
Insert this:
//Inkscape is NOT calling create_pen for objects with no border. PPT, and presumably others, pick whatever they want
//for the border if it is not specified, so no border can become border. To avoid this specify "no pen" here if we can determine
//that will not be needed after the fill.
if (style-
hpen = (HPEN) GetStockObject(
hpenOld = (HPEN) SelectObject( hdc, hpen );
}
after
flush_fill(); // flush any pending fills
in
unsigned int PrintEmfWin32:
2. If stroke is enabled but width is 0 createpen is called, but with width is 1.
Fix to apply to emf-win32-
change this:
DWORD linewidth = MAX( 1, (DWORD) (scale * style->
to this
DWORD linewidth = MAX( 1, (DWORD) (scale * style->
The original code was likely supposed to handle the case where the thinnest possible line was desired. However, it also ended up drawing a line when no line (width==0) was intended.
At another level it perhaps should be the case that stroke could not be set when line width is zero.
-------
Note, a much better fix would be to repair whichever routine it is that is not calling create_pen when no stroke is indicated. It should instead call create_pen with a zero width. and the 2nd fix above would then be changed to create a NULL_PEN instead of just returning. I did not do that on my copy because I could not figure out which routine was making the original error, and so worked around it at the EMF level. This results in the poorly structured fix of making the pen in the fill section (it had to be made somewhere for each object, and create_pen was not being called).
tags: | added: emf exporting win32 |
This was for trunk + devlib as of 2/29/2012, on Windows XP