History log of /inkscape/src/extension/internal/emf-inout.cpp
Revision Date Author Comments Expand
c1781cc5ed1fe8209c138c9634dc487c00a905a2 18-Feb-2016 mathog <>

provide end user debugging for EMF and WMF issues

b586b842618f8a3a71c2f4fd59d3abbafad3229f 29-Oct-2015 mathog <>

patch for bug 1511508

06517eb74772b7c18a8ab8d703405646d9ec05d3 27-Apr-2015 mathog <>

patch for bugs 1447850 and 1447382

41fe3f808697419ddead60fc7bcc425166c05c26 26-Feb-2015 mathog <>

fix for bug 1425317

680c76143b9a53386817a222607ce7b61e43709c 09-Feb-2015 mathog <>

fix for bug 1419926

f04e1d874e4b3956e4b162f2aedff3f035bbb111 09-Feb-2015 mathog <>

fix for bug 1405292

2d7e3411a6d25ef5810453c17fe591dcf04d5d05 04-Sep-2014 mathog <>

resolves bug 1348417 and implements addition features for bug 1302857

edc2f3b640cca99df088effceaa7da6273f4d8d4 30-Aug-2014 Alex Valavanis <valavanisalex@gmail.com>

Reduce header bloat

/inkscape/src/axis-manip.h /inkscape/src/desktop-events.h /inkscape/src/display/sp-canvas-item.h /inkscape/src/display/sp-canvas.h /inkscape/src/ege-adjustment-action.h /inkscape/src/ege-output-action.h /inkscape/src/ege-select-one-action.h /inkscape/src/extension/input.h emf-inout.cpp wmf-inout.cpp /inkscape/src/extension/output.h /inkscape/src/helper/action.h /inkscape/src/icon-size.h /inkscape/src/ink-action.h /inkscape/src/ink-comboboxentry-action.h /inkscape/src/knot.cpp /inkscape/src/knot.h /inkscape/src/proj_pt.h /inkscape/src/sp-pattern.h /inkscape/src/ui/dialog/clonetiler.h /inkscape/src/ui/dialog/export.h /inkscape/src/ui/dialog/filedialogimpl-gtkmm.cpp /inkscape/src/ui/tools/flood-tool.h /inkscape/src/ui/tools/select-tool.h /inkscape/src/ui/tools/spiral-tool.h /inkscape/src/ui/tools/text-tool.h /inkscape/src/ui/widget/unit-tracker.h /inkscape/src/widgets/button.cpp /inkscape/src/widgets/button.h /inkscape/src/widgets/eek-preview.h /inkscape/src/widgets/gradient-image.h /inkscape/src/widgets/gradient-selector.cpp /inkscape/src/widgets/gradient-selector.h /inkscape/src/widgets/gradient-vector.h /inkscape/src/widgets/paint-selector.h /inkscape/src/widgets/sp-color-icc-selector.h /inkscape/src/widgets/sp-color-notebook.h /inkscape/src/widgets/sp-color-scales.h /inkscape/src/widgets/sp-color-selector.h /inkscape/src/widgets/sp-color-slider.h /inkscape/src/widgets/sp-color-wheel-selector.h /inkscape/src/widgets/sp-widget.h /inkscape/src/widgets/sp-xmlview-content.h /inkscape/src/widgets/spinbutton-events.h /inkscape/src/widgets/toolbox.h
4a62c7e0d9cf01dfaa0bdff3d9cde7ee47e92d24 25-Jul-2014 mathog <>

Fix for bug 1340683

4e47dd454b9d10cbca9ad0390cfbd176858287b8 22-Jul-2014 Markus Engel <markus.engel@tum.de>

Replaced some abs/fabs with std::abs.

034d7ccaa6acbcd03e37974a2d164706862c32a2 29-Apr-2014 mathog <>

Improved support for clipping on EMF/WMF import, see bug 1302857

3b70d4b4adefa3ff65931070bee74f26bab2f6f6 28-Apr-2014 mathog <>

Fix for bug 1306138

bc80d3a0d6f75fc0d88128000d85970cce297f81 28-Apr-2014 mathog <>

Fix for bug 1294840

4ab04cac6761e7e894c63f577c850b47ca0b6b9b 27-Apr-2014 tavmjong-free <tavmjong@free.fr>

Replace 'memset' by constructors. Fixes segfault from turning SPStyle into a class.

2bf3910a9fbe18eb8fb519f02f9d49d68df7ee7a 25-Mar-2014 David Mathog <mathog@caltech.edu>

Patch for several issues in libuemf. ----- The patch: 1. Removes half a dozen or so code lines that didn't do anything. 2. Fixes a couple of missing tests for pointers which cannot be NULL. (Note that in many instances the pseudoobject functions in upmf.c do accept null pointers because the objects being constructed have optional parts.) 3. There was one "real" potential memory leak (line 6276 in upmf.c, numbers before the patch). I fixed the others too, but they just never happen (iconv would have to fail in some strange way.) There are no (real) memory access violations or memory leaks in any of this either in standalone libUEMF testing or in use as part of Inkscape as determined from valgrind runs.

aa1ee3630f01ad8674dc4e69a86765cc2bf58ba3 19-Mar-2014 mathog <mathog@caltech.edu>

EMF import: fix clipPath definition: move transform attribute into the <rect> element (bug #1294713)

a2220686e6f3bc4aedd8140090696151d6cf1a00 11-Mar-2014 tavmjong-free <tavmjong@free.fr>

Change stroke-dasharray and stroke-dashoffset handling to match other properties. Split style.h into more manageable size files.

5879527bc41c3d47f37440fb8b83edb9c48080cc 22-Feb-2014 mathog <mathog@caltech.edu>

Fix 'preserveAspectRatio' attribute of bitmap images in EMF/WMF import/export (bug #1278645).

5da08901f6f284dfb64e741ed2f6287d9cfc087a 08-Feb-2014 mathog <mathog@caltech.edu>

EMF/WMF support: Various changes (see bug #1263242 c35 for details) EMF support: - linear gradients: improve numeric stability on round-trip editing - linear gradients: fix scaling issue libTERE/text_reassemble update: - improve handling of whitespace created with large x kerns - fix handling of absolute RTL-positioning of LTR text in EMF files WMF support: - fix support for 'textout' records and Placeable headers - add support for CREATEPATTERNBRUSH - fix offset on load if opened via GUI (bug #1250250)

1df6105803c4c56c020a56301c7c9c4890fd4158 18-Jan-2014 mathog <mathog@caltech.edu>

libUEMF update; EMF linear gradient bug fixes (bug #1263242)

/inkscape/src/extension/CMakeLists.txt Makefile_insert emf-inout.cpp emf-inout.h emf-print.cpp emf-print.h metafile-inout.cpp metafile-inout.h metafile-print.cpp wmf-inout.cpp wmf-inout.h wmf-print.cpp /inkscape/src/libuemf/CMakeLists.txt /inkscape/src/libuemf/Makefile_insert /inkscape/src/libuemf/README /inkscape/src/libuemf/uemf.c /inkscape/src/libuemf/uemf.h /inkscape/src/libuemf/uemf_endian.c /inkscape/src/libuemf/uemf_endian.h /inkscape/src/libuemf/uemf_print.c /inkscape/src/libuemf/uemf_print.h /inkscape/src/libuemf/uemf_utf.c /inkscape/src/libuemf/uemf_utf.h /inkscape/src/libuemf/upmf.c /inkscape/src/libuemf/upmf.h /inkscape/src/libuemf/upmf_print.c /inkscape/src/libuemf/upmf_print.h /inkscape/src/libuemf/uwmf.c /inkscape/src/libuemf/uwmf.h /inkscape/src/libuemf/uwmf_endian.c /inkscape/src/libuemf/uwmf_endian.h /inkscape/src/libuemf/uwmf_print.c /inkscape/src/libuemf/uwmf_print.h
bcc1460075bacc93179de32bbc59afd79f8ec389 27-Oct-2013 Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>

add some nullptr checking, should fix crash (couldn't test)

fc7bd82fba00cc9b3c954c2c52bb884af45d633f 27-Oct-2013 Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>

fix crash, partly fix vertical positioning issue. couldn't figure out how to make it work, the applied scale transform works weird somehow

3cb4b12a2ae9684761999a3fab8badd8323a1880 24-Oct-2013 mathog <mathog@caltech.edu>

Fix for Bug 1242927 (minor EMF import issues)

6962f793fc5f7459347a51332a60d962f1035d38 24-Oct-2013 mathog <mathog@caltech.edu>

Fix for Bug 1243937 (EMF import, diagram obscured by full page rectangle)

28c3a9de9a8b7b5f345447ef581218d2b7751cb7 24-Oct-2013 Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>

fix bug "some of the locale-based templates cause objects to be resized when default units are changed" #1236257

87b68db8c76e3425a99bb2f05c70d7b25c50b654 13-Oct-2013 Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>

Units: stop newing Unit objects. pass around pointers to "undeletable" Unit objects in the UnitTable. I think we should move to using indexed units, and pass around the index of the unit in the unittable, or smth like that... ?

/inkscape/src/arc-context.cpp /inkscape/src/display/canvas-axonomgrid.cpp /inkscape/src/display/canvas-grid.cpp /inkscape/src/display/canvas-grid.h /inkscape/src/document.cpp emf-inout.cpp wmf-inout.cpp /inkscape/src/live_effects/parameter/unit.cpp /inkscape/src/lpe-tool-context.cpp /inkscape/src/pen-context.cpp /inkscape/src/preferences.cpp /inkscape/src/rect-context.cpp /inkscape/src/seltrans.cpp /inkscape/src/sp-guide.cpp /inkscape/src/sp-namedview.cpp /inkscape/src/sp-namedview.h /inkscape/src/sp-text.cpp /inkscape/src/spiral-context.cpp /inkscape/src/star-context.cpp /inkscape/src/text-context.cpp /inkscape/src/ui/dialog/clonetiler.cpp /inkscape/src/ui/dialog/document-properties.cpp /inkscape/src/ui/dialog/export.cpp /inkscape/src/ui/dialog/guides.cpp /inkscape/src/ui/tool/node.cpp /inkscape/src/ui/widget/page-sizer.cpp /inkscape/src/ui/widget/page-sizer.h /inkscape/src/ui/widget/preferences-widget.cpp /inkscape/src/ui/widget/registered-widget.h /inkscape/src/ui/widget/scalar-unit.cpp /inkscape/src/ui/widget/scalar-unit.h /inkscape/src/ui/widget/selected-style.cpp /inkscape/src/ui/widget/selected-style.h /inkscape/src/ui/widget/spinbutton.cpp /inkscape/src/ui/widget/style-swatch.cpp /inkscape/src/ui/widget/unit-menu.cpp /inkscape/src/ui/widget/unit-menu.h /inkscape/src/ui/widget/unit-tracker.cpp /inkscape/src/ui/widget/unit-tracker.h /inkscape/src/util/expression-evaluator.cpp /inkscape/src/util/expression-evaluator.h /inkscape/src/util/units.cpp /inkscape/src/util/units.h /inkscape/src/widgets/desktop-widget.cpp /inkscape/src/widgets/lpe-toolbar.cpp /inkscape/src/widgets/measure-toolbar.cpp /inkscape/src/widgets/node-toolbar.cpp /inkscape/src/widgets/paintbucket-toolbar.cpp /inkscape/src/widgets/rect-toolbar.cpp /inkscape/src/widgets/ruler.cpp /inkscape/src/widgets/ruler.h /inkscape/src/widgets/select-toolbar.cpp /inkscape/src/widgets/stroke-style.cpp /inkscape/src/widgets/stroke-style.h
86df60ed2c0ede4dad6684c75acd907f6146c1b6 09-Oct-2013 JazzyNico <nicoduf@yahoo.fr>

Documentation/Translation. Fix for Bug #1236382 (Typos in comments and message, localization context needed) by Yuri Chornoivan.

c4162fcc5a3c05e1b5d56115f40b60b88b956138 05-Oct-2013 Matthew Petroff <matthew@mpetroff.net>

Fix EMF/WMF import scale (Bug #1229120).

87d2ee3b16068e03b26a409994b73605fde664a6 22-Sep-2013 Matthew Petroff <matthew@mpetroff.net>

Fix adding viewBox to new documents.

453a8671e6992250324846d0b76f02801221c760 15-Sep-2013 Matthew Petroff <matthew@mpetroff.net>

Improved code readability.

1710c8729db34263e50b443e7fcf541d3cffa005 02-Sep-2013 Krzysztof Kosiński <tweenk.pl@gmail.com>

Unduplicate some code in the metafile printing extensions

6a55cc6751be1162fa737fa656ffae0729c2e2a0 31-Aug-2013 Krzysztof Kosiński <tweenk.pl@gmail.com>

Move libuemf to a separate directory. Rename libunicode-convert to symbol_convert and put it in libuemf.

/inkscape/configure.ac /inkscape/po/POTFILES.in /inkscape/src/CMakeLists.txt /inkscape/src/Makefile.am Makefile_insert emf-inout.cpp emf-inout.h emf-print.cpp emf-print.h text_reassemble.c wmf-inout.cpp wmf-inout.h wmf-print.cpp wmf-print.h /inkscape/src/libnrtype/Layout-TNG-Output.cpp /inkscape/src/libuemf/CMakeLists.txt /inkscape/src/libuemf/Makefile_insert /inkscape/src/libuemf/README /inkscape/src/libuemf/makefile.in /inkscape/src/libuemf/symbol_convert.c /inkscape/src/libuemf/symbol_convert.h /inkscape/src/libuemf/uemf.c /inkscape/src/libuemf/uemf.h /inkscape/src/libuemf/uemf_endian.c /inkscape/src/libuemf/uemf_endian.h /inkscape/src/libuemf/uemf_print.c /inkscape/src/libuemf/uemf_print.h /inkscape/src/libuemf/uemf_utf.c /inkscape/src/libuemf/uemf_utf.h /inkscape/src/libuemf/uwmf.c /inkscape/src/libuemf/uwmf.h /inkscape/src/libuemf/uwmf_endian.c /inkscape/src/libuemf/uwmf_endian.h /inkscape/src/libuemf/uwmf_print.c /inkscape/src/libuemf/uwmf_print.h /inkscape/src/libunicode-convert/Makefile_insert /inkscape/src/libunicode-convert/README /inkscape/src/style.h
aefaed7646cce60b4b2d4b2f7411234949539482 29-Aug-2013 ~suv <suv-sf@users.sourceforge.net>

adapt to changes in r12471 (unit refactoring)

794775c2543b922d4f1cdd25a514fd5d9cadba45 15-Aug-2013 Kris <Kris.De.Gussem@hotmail.com>

patch of David Mathog in bugtread 988601 comment 186

9a8ade3834e2a67c1d95bcfc900ab36be37a03a5 19-Jun-2013 David Mathog <>

changes_2013_05_22a.patch: 1. Resolves issue of bug #988601 message 170 (Support of 'Unset' styles in EMF export). 2. Implements CSS 3 (and CSS 2) text-decoration support. Note that it does not yet provide any method of adding these features - at present it just shows whatever is in the SVG. This new code is also used to display EMF/WMF strike-through and underline text decorations when these files are read in. Those decorations may also be written out to EMF/WMF. Other text decoration features, like overline, or dotted lines, are dropped. For SVG text-decoration -line, -style, -color are all implemented. CSS3 provides two ways to represent the same state, this code uses the compound text-decoration method rather than the 3 fields method. Also it leaves out keywords that are not needed and would break backwards compatibility. For instance: text-decoration: underline solid is valid, but would break CSS2. Solid is the default, so that sort of case is written as: text-decoration: underline If the state is CSS3 specific all of the needed fields are of course include, like text-decoration: underline wavy red 3. It incorporates the fix for bug 1181326 (Text edit mishandles span of just colored spaces) 4. It incorporates further changes to text editing so that style can be changed on spans consisting of only spaces when text decorations are present in the span. 5. It incorporates code to disable text decorations when text so marked is mapped onto a path. 6. Fixed more bugs in Hebrew language support than I can remember. Hebrew language export/import to EMF now works quite well. (See the examples in libTERE v 0.7.) WMF does not support unicode and for all intents and purposes Inkscape has no way to read or write Hebrew to it. Some of more important things that now work that didn't (or didn't always): Hebrew diacritical marks, R/L/center justification, and bidirectional text. The Hebrew fonts "Ezra SIL" and "EZRA SIL SR" should be installed before viewing the libTERE examples, otherwise font substitutions will cause some text shifts. 7. Implemented font failover in Text Reassemble, which makes the process more robust. (Again, see the examples in libTERE. )

089478b5b462b98a7ecb34496c6f15eb315b9a18 21-Mar-2013 David Mathog <>

988601-changes_2013_03_20a.patch 1. Fixes the clang warnings noted in a post above, other than those associated with alignment caused by casting. 2. Fixes some minor rounding errors in both WMF and EMF input/output. Round trip open/save cycles are conservative for EMF and WMF files (excluding any features that are not full supported in inkscape or the target file format, for instance, gradients, which must be emulated.) 3. Fixed a missing break in the input WMF LINETO record handling, which was falling through into the MOVETO and generating a harmless extra "M" operation in a path. 4. WMF has no POLYPOLYLINE record. However input that maps into essentially a polypolyline record in SVG is common, for instance dashed lines that have been converted to line segments. These end up in SVG as a series of M L M L draw commands in the path. Earlier each M L pair was going out as a polyline record, now they go as a series of MOVETO/LINETO records. The primary reason for this change is that without this change the behavior described in (2) does not occur. 5. Fixed an issue where polyline and polygon records in some instances ended up with an extra copy of their last point.

5530d4cb2db040e48228f2f4a525e3dabb15b057 19-Mar-2013 David Mathog <>

changes_2013_03_18c.patch This set of patches does the following: 1. Fixed a typo ( where "+ sizeof()" should have been "* sizeof()") which caused a memory problem for EMF/WMF files with very large numbers of hatches. 2. Added support for background mode, background color, and textcolor in hatches. EMF/WMF files change these parameters but the change may be silent until many records later. This has the odd effect that a stroke or fill may be defined (in SVG) and then it is ignored later and replaced with one with a different background color. 3. Fixed WMF output so that it wasn't adding +1 to the number of pixels for Width and Height. (Allows WMF files to go through several cycles of save as, open without changing sizes.) 4. Cleaned up indenting of [ew]mf-{print|inout}.* files, to make them compliant with the inkscape standard. All indents are (I hope) now 4*i deep. 5. Added underline/strikeout support for text read from EMF/WMF files. Inkscape itself cannot currently render this, but it makes it into the SVG, and it shows up correctly when that SVG is read by Opera. 6. Took out all the "throw" calls, replacing them with g_error(). If this comes up again in debugging a define can be used to remap the g_error to temporarily reintroduce the throw so that gdb can catch them. 7. Took out the "%6lf" format changes from patch 11724, retained the "127" length limit in the same sscanf. 8. Put the C type casts back in, reversing those changes from patch 11724. This is a style issue, and I could not find clear guidance for which way to go. (Nor a good rationale for keeping the lengthier C++ syntax.) So I reviewed a large swath of other inkscape code to see if there was a trend and found a very large number of other sections that were using C style casts instead of the more verbose C++ forms. So I kept it the way it has been. 9. The locale changes from 11724 were of course retained.

10b77f97a176647caa068363224704062325ec4a 08-Mar-2013 David Mathog <>

changes_2013_02_25a.patch New: WMF import/export implements WMF (Windows Metafile) read and write. Inkscape previously supported that through uniconverter, which was not very good with WMF files. The new version now has a complete wmf-print/wmf-inout implementation, analogous to the previous emf-print/emf-inout. This handles images, patterns, and various other goodies to the extent that WMF does. WMF is a bit primitive, many fields are only 16 bits, so it even more resolution sapping issues than does EMF. Given the choice, always use the latter format.

7221236468b0b60c925a058fb7a1919a141202d4 13-Feb-2013 David Mathog <>

changes_2013_02_01b.patch EMF import: - Fix for EMF files with MODIFYWINDOWTRANSFORM records containing rotations - Add support for embedded PNG and JPG images - Fix for PowerPoint patterns EMF export: - Rotated images are exported using MODIFYWINDOWTRANSFORM records - Add output option to allow unrotated output (e.g. for PowerPoint 2003) - Don't rotate hatch and image fills on export libTERE: - Fix bug with misplaced words in LTR text (fix for RTL untested)

77158fc70d508e2e4deee0bd3783ea8ba56c9c61 13-Dec-2012 David Mathog <>

preliminary release of the EMF import text reassembly feature. (based on libTERE (TExt REassembly), not yet published) libTERE examines all the text in an EMF file, which consists only of little chunks in different formats, and attempts to reassemble it into an editable SVG text object, with color, different fonts and so forth. (only tested with English)

08b7b18b314f8ea09d1edf072c72fddc8324b8a3 14-Nov-2012 David Mathog <>

changes_2012_11_13a.patch EMF import: - More changes to the MAPMODES behavior.

51a4b3a1f5ff786faa6711432cf1930ef14d4e0c 01-Nov-2012 David Mathog <>

changes_2012_10_31b.patch EMF import: - better handling of aberrant bitmap records - support for reading rarely encountered map modes (MM_LOENGLISH etc.) (Output is still always MM_TEXT) - better handling of EMF files with offset EMR_HEADER bounds fields - improved text import (snap font sizes to the nearest whole multiple of 1/32 points)

14d5f6c1726326ebd2b3e1576c8881c1a3e1599e 25-Oct-2012 David Mathog <>

changes_2012_10_22b.patch, changes_2012_10_24a.patch EMF import (Adobe Illustrator EMF files): - workaround for issue with page scaling ('MM_ANISOTROPIC', wrong units) - fix SETWORLDTRANSFORM operation - fix libUEMF to support older/shorter EMF header forms EMF import (general): - fix import of shapes (rectangles) without borders - handle EMF bitmap modes where a subsection of the image is extracted EMF export/import: - increased size in mm of the reference device by 100X on EMF export (significant when the dpi is calculated on reading the EMF back in) - changed dpi calculation: (sum of pixels ref device)/(sum of millimeter ref device)

d31ffa2a59dc504877e940cb4a3ba20744c36999 18-Oct-2012 David Mathog <>

changes_2012_10_18b.patch: Additional fix for text that starts with any of the characters 0x0-0x1F cast the tested character to unsigned to prevent dropping of some strings (follow-up to r11984)

ab4faca3dabd568e1904ca987c741c64fae883ed 13-Oct-2012 David Mathog <>

Fix SVG formatting (EMF import): A typo caused two extra spaces to be appended on the end of any text which was read in from an EMF file.

3eb34f9726277927ccb46091b08045b9fe658c29 09-Oct-2012 David Mathog <>

changes_2012_10_08a.patch: - image import from EMR_BITBLT, EMR_STRETCHBLT, and EMR_MASKBLT records - sets a default font name (Arial) (for EMFs which specify for a font) - drops text that starts with any of the characters 0x0-0x1F

1d808ea8c74453f750c42d11d230e35774f884c3 05-Oct-2012 David Mathog <>

changes_2012_10_04b.patch: fixes one small memory issue (bytes allocated and never deallocated, not a leak per se)

468c086269204fcf466da85214cfd260b4e88a7d 04-Oct-2012 David Mathog <>

update based on patch 'changes_2012_09_27b.patch'

bf59a669af4d335c3d05297bdf06cf4f5e0ea8a3 27-Sep-2012 David Mathog <>

fix compiler warnings with old GCC on Mac OS X and Solaris

e030de96747d0b1e707cde715000a65632b2e9a5 23-Sep-2012 ~suv <suv-sf@users.sourceforge.net>

Fix pointer issue in EMF code

00d0240eaf3986ebaeedcbeabbdb727b73a5934b 23-Sep-2012 ~suv <suv-sf@users.sourceforge.net>

Fixes bug #988601: omnibus patch for EMF input/output support (cross-platform)