We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Supporting old proprietary graphic formats

00:00

Formal Metadata

Title
Supporting old proprietary graphic formats
Title of Series
Number of Parts
542
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Some proprietary graphic formats from the 90s like WMF are device dependent and hard to support. The standard is hard to navigate and implement and a lot of bugs can show up. Creating files for unit testing is not necessarily easy either. Come and find out how WMF bugs are debugged, fixed and tested.
14
15
43
87
Thumbnail
26:29
146
Thumbnail
18:05
199
207
Thumbnail
22:17
264
278
Thumbnail
30:52
293
Thumbnail
15:53
341
Thumbnail
31:01
354
359
410
Lecture/Conference
File formatWindowLecture/Conference
VolumenvisualisierungData structurePairwise comparisonFile formatVector spaceRaster graphicsContext awarenessRootPersonal digital assistantQuery languageMetric systemFunction (mathematics)Software developerHoaxWordGlass floatRow (database)Electronic signaturePoint (geometry)ImplementationSuite (music)Execution unitTelephone number mappingComputer fileLatent heatCausalityQuery languageCartesian coordinate systemComputer fontParameter (computer programming)Vector spaceFile formatRaster graphicsUnit testingRoundness (object)Context awarenessSoftware bugData structureCross-platformSoftware testingDebuggerImplementationExpected valueElectronic signatureRow (database)Functional (mathematics)Software developerControl flowCASE <Informatik>RootExistenceDifferent (Kate Ryan album)Set (mathematics)Order (biology)Computer animationLecture/Conference
Program flowchart
Transcript: English(auto-generated)
Hello, my name is Paris and my talk is about supporting old proprietary graphic formats. Specifically we're going to be talking about the WMF and the EMF formats from Windows. So what is a WMF? And this also applies to the EMFs, but the WMF is a Windows
meta file. It is a graphics format that supports vector and raster operations, mostly vector. It was introduced in the early 1990s in comparison, a different vector format like the SVG was released in 2001. It is composed of a set of GDI drawing commands and structures.
These drawing commands are played back in order to render the graphic within what is known as the playback device context and it is not as widely supported as SVGs. Essentially this means that you can code this format into existence by writing some GDI functions. What are the difficulties
in supporting this format? So the WMF files are application and device dependent. The EMF files later that were later introduced try to solve this issue, but the WMF files are
more difficult in that way. The device context that is associated with a WMF file cannot be queried. That is, an application cannot retrieve the device resolution, data, font metrics, and so on. So if you made a WMF file for a specific device, you cannot really know. If you tried running on a
different device, you don't really know the device it was built for. There is a format specification for this, but a lot of things are missing and there are some edge cases with undefined behavior and pinpointing the root cause of a buggy file can be tricky.
So how do you debug a WMF? Well there's a lot of ways. I'm going to present the way that I do it usually. So you would want to get the drawing commands, the GDI drawing commands, and there is multiple ways of doing so, more than I listed. One is MSO Dumper. It is created and used by
LibreOffice developers and it dumps the drawing commands. Another one is the Metaphile Explorer. It allows for viewing and stepping through the drawing commands, so you can easily understand which command does what. And then there is the enum Metaphile GDI function, which is defined
in the GDI header, which allows to enumerate the drawing commands in WMF file and call a callback function. A similar function also exists for EMF files. This is an example of an EMF drawing command. WMF drawing commands look very similar of course. It's the function signature. It takes some parameters and this is what the record looks like within the file
if you open it in the aforementioned debugger. So it's very similar to the function signature itself. After you obtain the drawing commands, you want to debug. Because WMF is such a platform
dependent graphic format, sometimes it's good to compare with other WMF reader implementations like PowerPoint to understand exactly what the graphic looks like in other implementations.
Then you would want to identify which drawing commands cause the bug. You would, you know, the drawing commands that you obtained, you would step through them and try to pinpoint what exactly causes the bug. It is important to also reduce the relevant commands as much as possible. WMF files can contain thousands of drawing commands and stepping through all of
them is very tricky. A way to do this is to simplify the problematic file or make a new one that reproduces the bug in LibreOffice. And then you work around these buggy commands to find out what is wrong. Easier said than done, but yeah. Finally, you want to make
sure you didn't break something. It is good to create a unit test for your fix using the minimally reproducible example you created before. You run the appropriate test suits, you probably broke something, so you go back to step one and then you confirm that
round tripping works as expected. And then you also, I should mention, monitor the WMF file to the fix you made for WMF file to make sure it doesn't break something in the future. And that is all. Thank you.