Supporting old proprietary graphic formats
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
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 | 10.5446/61572 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 2023184 / 542
2
5
10
14
15
16
22
24
27
29
31
36
43
48
56
63
74
78
83
87
89
95
96
99
104
106
107
117
119
121
122
125
126
128
130
132
134
135
136
141
143
146
148
152
155
157
159
161
165
166
168
170
173
176
180
181
185
191
194
196
197
198
199
206
207
209
210
211
212
216
219
220
227
228
229
231
232
233
236
250
252
256
258
260
263
264
267
271
273
275
276
278
282
286
292
293
298
299
300
302
312
316
321
322
324
339
341
342
343
344
351
352
354
355
356
357
359
369
370
372
373
376
378
379
380
382
383
387
390
394
395
401
405
406
410
411
413
415
416
421
426
430
437
438
440
441
443
444
445
446
448
449
450
451
458
464
468
472
475
476
479
481
493
494
498
499
502
509
513
516
517
520
522
524
525
531
534
535
537
538
541
00:06
Lecture/Conference
00:18
File formatWindowLecture/Conference
00:55
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
05:44
Program flowchart
Transcript: English(auto-generated)
00:40
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
01:02
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.
01:24
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
01:47
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
02:02
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
02:22
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.
02:42
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
03:01
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
03:20
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
03:44
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
04:02
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.
04:20
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
04:46
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
05:07
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
05:22
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.
Recommendations
Series of 18 media
Series of 13 media