2.3.5.4 META_MOVETO Record

The META_MOVETO record sets the output position in the playback device context to a specified point.

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_MOVETO.

Y (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units.

X (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units.

See section 2.3.5 for the specification of other State record types

2.3.3.10 META_LINETO Record

The META_LINETO record draws a line from the drawing position that is defined in the playback device context up to, but not including, the specified point.

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_LINETO.

Y (2 bytes): A 16-bit signed integer that defines the vertical component of the drawing destination position, in logical units.

X (2 bytes): A 16-bit signed integer that defines the horizontal component of the drawing destination position, in logical units.

See section 2.3.3 for the specification of other Drawing records.

2.3.3 Drawing Record Types

This section defines the Drawing Record Types, which specify records that perform graphics output. These records use graphics objects and properties specified in the Playback Device Context (section 3.1.5).

The following are the Drawing Record Types.

Name Section Description
META_ARC 2.3.3.1 Draws an elliptical arc.
META_CHORD 2.3.3.2 Draws a chord.
META_ELLIPSE 2.3.3.3 Draws an ellipse.
META_EXTFLOODFILL 2.3.3.4 Fills an area with the brush that is defined in the playback device context.
META_EXTTEXTOUT 2.3.3.5 Outputs a character string with optional opaquing and clipping.
META_FILLREGION 2.3.3.6 Fills a region using a specified brush.
META_FLOODFILL 2.3.3.7 Fills an area of the output surface with the brush that is defined in the playback device context.
META_FRAMEREGION 2.3.3.8 Draws a border around a specified region using a specified brush.
META_INVERTREGION 2.3.3.9 Draws a region in which the colors are inverted.
META_LINETO 2.3.3.10 Draws a line from the drawing position that is defined in the playback device context up to, but not including, a specified position.
META_PAINTREGION 2.3.3.11 Paints the specified region using the brush that is defined in the playback device context.
META_PATBLT 2.3.3.12 Paints a specified rectangle by using the brush that is defined in the playback device context.
META_PIE 2.3.3.13 Draws a pie-shaped wedge bounded by the intersection of an ellipse and two radial lines.
META_POLYLINE 2.3.3.14 Draws a series of line segments by connecting the points in the specified array.
META_POLYGON 2.3.3.15 Paints a polygon consisting of two or more vertices connected by straight lines.
META_POLYPOLYGON 2.3.3.16 Paints a series of closed polygons.
META_RECTANGLE 2.3.3.17 Paints a rectangle.
META_ROUNDRECT 2.3.3.18 Paints a rectangle with rounded corners.
META_SETPIXEL 2.3.3.19 Sets the pixel at specified coordinates to a specified color.
META_TEXTOUT 2.3.3.20 Outputs a character string.

 
2.3.3.1 META_ARC Record 
The META_ARC record draws an elliptical arc. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction YEndArc 
XEndArc YStartArc 
XStartArc BottomRect 
RightRect TopRect 
LeftRect 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ARC. 
YEndArc (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the ending point of the radial line defining the ending point of the arc. 
XEndArc (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the ending point of the radial line defining the ending point of the arc. 
YStartArc (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the ending point of the radial line defining the starting point of the arc. 
XStartArc (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the ending point of the radial line defining the starting point of the arc. 
BottomRect (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the bounding rectangle. 
RightRect (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the lower-right corner of the bounding rectangle. 
TopRect (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the bounding rectangle. 
LeftRect (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the bounding rectangle. 
116 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.2 META_CHORD Record 
The META_CHORD record draws a chord, which is defined by a region bounded by the intersection of an ellipse with a line segment. The chord is outlined using the pen and filled using the brush that are defined  in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction YRadial2 
XRadial2 YRadial1 
XRadial1 BottomRect 
RightRect TopRect 
LeftRect 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_CHORD. 
YRadial2 (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical coordinates, of the endpoint of the second radial. 
XRadial2 (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical coordinates, of the endpoint of the second radial. 
YRadial1 (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical coordinates, of the endpoint of the first radial. 
XRadial1 (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical coordinates, of the endpoint of the first radial. 
BottomRect (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the bounding rectangle. 
RightRect (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the lower-right corner of the bounding rectangle. 
TopRect (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the bounding rectangle. 
LeftRect (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the bounding rectangle. 
See section 2.3.3 for the specification of other Drawing records. 

2.3.3.3 META_ELLIPSE Record

The META_ELLIPSE record draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. The ellipse is outlined by using the pen and is filled by using the brush; these are defined in the playback device context.

0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction BottomRect 
RightRect TopRect 
LeftRect

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_ELLIPSE.

BottomRect (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the bounding rectangle.

RightRect (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the lower-right corner of the bounding rectangle.

TopRect (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the bounding rectangle.

LeftRect (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the bounding rectangle.

See section 2.3.3 for the specification of other Drawing records. 2.3.3.4 META_EXTFLOODFILL Record The META_EXTFLOODFILL record fills an area with the brush that is defined in the playback device context. 0 1 2 3 4 5 6 7 8 9 1 0 1 2 3 4 5 6 7 8 9 2 0 1 2 3 4 5 6 7 8 9 3 0 1 RecordSize RecordFunction Mode ColorRef Y X RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 118 / 210 [MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_EXTFLOODFILL. Mode (2 bytes): A 16-bit unsigned integer that defines the fill operation to be performed. This member MUST be one of the values in the FloodFill Enumeration table. ColorRef (4 bytes): A 32-bit ColorRef Object that defines the color value. Y (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the point to be set. X (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the point to be set. See section 2.3.3 for the specification of other Drawing records.

2.3.3.5 META_EXTTEXTOUT Record

The META_EXTTEXTOUT record outputs text by using the font, background color, and text color that are defined in the playback device context. Optionally, dimensions can be provided for clipping, opaquing, or both.

0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Y 
X StringLength 
fwOpts Rectangle (optional) 
... 
... String (variable) 
... 
Dx (variable) 
... 

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_EXTTEXTOUT.

Y (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, where the text string is to be located.

X (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, where the text string is to be located.

StringLength (2 bytes): A 16-bit signed integer that defines the length of the string.

fwOpts (2 bytes): A 16-bit unsigned integer that defines the use of the application-defined rectangle. This member can be a combination of one or more values in the ExtTextOutOptions Flags (section 2.1.2.2).

Rectangle (8 bytes): An optional 8-byte Rect Object (section 2.2.2.18) that defines the dimensions, in logical coordinates, of a rectangle that is used for clipping, opaquing, or both.

String (variable): A variable-length string that specifies the text to be drawn. The string does not need to be null-terminated, because StringLength specifies the length of the string. If the length is odd, an extra byte is placed after it so that the following member (optional Dx) is aligned on a 16-bit boundary.

Dx (variable): An optional array of 16-bit signed integers that indicate the distance between origins of adjacent character cells. For example, Dx[i] logical units separate the origins of character cell i and character cell i + 1. If this field is present, there MUST be the same number of values as there are characters in the string.

See section 2.3.3 for the specification of other Drawing records.

 
2.3.3.6 META_FILLREGION Record 
The META_FILLREGION record fills a region using a specified brush. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Region 
Brush 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_FILLREGION. 
Region (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the region to be filled. 
Brush (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the brush to use for filling the region. 
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.7 META_FLOODFILL Record 
The META_FLOODFILL record fills an area of the output surface with the brush that is defined in the playback device context. 
120 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction ColorRef 
... YStart 
XStart 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_FLOODFILL. 
ColorRef (4 bytes):  A 32-bit ColorRef Object that defines the color value. 
YStart (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the point where filling is to start. 
XStart (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the point where filling is to start. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.8 META_FRAMEREGION Record 
The META_FRAMEREGION record draws a border around a specified region using a specified brush. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Region 
Brush Height 
Width 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_FRAMEREGION. 
Region (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the region to be framed. 
Brush (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the Brush to use for filling the region. 
121 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Height (2 bytes):  A 16-bit signed integer that defines the height, in logical units, of the region frame. 
Width (2 bytes):  A 16-bit signed integer that defines the width, in logical units, of the region frame. 
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.9 META_INVERTREGION Record 
The META_INVERTREGION record draws a region in which the colors are inverted. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Region 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_INVERTREGION. 
Region (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the region to be inverted. 
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.3 for the specification of other Drawing records. 

2.3.3.10 META_LINETO Record

The META_LINETO record draws a line from the drawing position that is defined in the playback device context up to, but not including, the specified point.

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_LINETO.

Y (2 bytes): A 16-bit signed integer that defines the vertical component of the drawing destination position, in logical units.

X (2 bytes): A 16-bit signed integer that defines the horizontal component of the drawing destination position, in logical units.

See section 2.3.3 for the specification of other Drawing records.

2.3.3.11 META_PAINTREGION Record 
The META_PAINTREGION record paints the specified region by using the brush that is defined in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Region 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_PAINTREGION. 
Region (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the region to be inverted.  
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.12 META_PATBLT Record 
The META_PATBLT record paints a specified rectangle using the brush that is defined in the playback device context. The brush color and the surface color or colors are combined using the specified raster operation. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction RasterOperation 
... Height 
Width YLeft 
XLeft 
123 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_PATBLT. 
RasterOperation (4 bytes):  A 32-bit unsigned integer that defines the raster operation code. This code MUST be one of the values in the Ternary Raster Operation enumeration table. 
Height (2 bytes):  A 16-bit signed integer that defines the height, in logical units, of the rectangle. 
Width (2 bytes):  A 16-bit signed integer that defines the width, in logical units, of the rectangle. 
YLeft (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the upperleft corner of the rectangle to be filled. 
XLeft (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the upperleft corner of the rectangle to be filled. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.13 META_PIE Record 
The META_PIE record draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials. The pie is outlined by using the pen and filled by using the brush that are defined in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction YRadial2 
XRadial2 YRadial1 
XRadial1 BottomRect 
RightRect TopRect 
LeftRect 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_PIE. 
YRadial2 (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical coordinates, of the endpoint of the second radial. 
XRadial2 (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical coordinates, of the endpoint of the second radial. 
124 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
YRadial1 (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical coordinates, of the endpoint of the first radial. 
XRadial1 (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical coordinates, of the endpoint of the first radial. 
BottomRect (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the bounding rectangle. 
RightRect (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the lower-right corner of the bounding rectangle. 
TopRect (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the bounding rectangle. 
LeftRect (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the bounding rectangle. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.14 META_POLYLINE Record 
The META_POLYLINE record draws a series of line segments by connecting the points in the specified array. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction NumberOfPoints 
aPoints (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_POLYLINE. 
NumberOfPoints (2 bytes):  A 16-bit signed integer that defines the number of points in the array. 
aPoints (variable):  A NumberOfPoints array of 32-bit PointS Objects, in logical units. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.15 META_POLYGON Record 
The META_POLYGON record paints a polygon consisting of two or more vertices connected by straight lines. The polygon is outlined by using the pen and filled by using the brush and polygon fill mode that are defined in the playback device context. 
125 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction NumberofPoints 
aPoints (variable) 
... 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_POLYGON. 
NumberofPoints (2 bytes):  A 16-bit signed integer that defines the number of points in the array. 
aPoints (variable):  A NumberOfPoints array of 32-bit PointS Objects (section 2.2.2.16), in logical units. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.16 META_POLYPOLYGON Record 
The META_POLYPOLYGON record paints a series of closed polygons. Each polygon is outlined by using the pen and filled by using the brush and polygon fill mode; these are defined in the playback device context. The polygons drawn by this function can overlap. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction PolyPolygon (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_POLYPOLYGON. 
PolyPolygon (variable):  A variable-sized PolyPolygon Object (section 2.2.2.17) that defines the point information. 
See section 2.3.3 for the specification of other Drawing records. 
126 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.3.17 META_RECTANGLE Record 
The META_RECTANGLE record paints a rectangle. The rectangle is outlined by using the pen and filled by using the brush that are defined  in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction BottomRect 
RightRect TopRect 
LeftRect 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_RECTANGLE. 
BottomRect (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the rectangle. 
RightRect (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the lower-right corner of the rectangle. 
TopRect (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the rectangle. 
LeftRect (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the rectangle. 
See section 2.3.3 for the specification of other Drawing records. 
2.3.3.18 META_ROUNDRECT Record 
The META_ROUNDRECT record paints a rectangle with rounded corners. The rectangle is outlined using the pen and filled using the brush, as defined in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Height 
Width BottomRect 
RightRect TopRect 
LeftRect 
127 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_ROUNDRECT. 
Height (2 bytes):  A 16-bit signed integer that defines the height, in logical coordinates, of the ellipse used to draw the rounded corners. 
Width (2 bytes):  A 16-bit signed integer that defines the width, in logical coordinates, of the ellipse used to draw the rounded corners. 
BottomRect (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the rectangle. 
RightRect (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the lower-right corner of the rectangle. 
TopRect (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the rectangle. 
LeftRect (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the rectangle. 
See section 2.3.3 for the specification of other Drawing records. 

2.3.3.19 META_SETPIXEL Record

The META_SETPIXEL record sets the pixel at the specified coordinates to the specified color.

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETPIXEL.

ColorRef (4 bytes): A ColorRef Object (section 2.2.2.8) that defines the color value.

Y (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the point to be set.

X (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the point to be set.

See section 2.3.3 for the specification of other Drawing records.

2.2.2.8 ColorRef Object

The ColorRef Object defines the RGB color.

Red (1 byte): An 8-bit unsigned integer that defines the relative intensity of red.

Green (1 byte): An 8-bit unsigned integer that defines the relative intensity of green.

Blue (1 byte): An 8-bit unsigned integer that defines the relative intensity of blue.

Reserved (1 byte): An 8-bit unsigned integer that MUST be 0x00.

2.3.3.20 META_TEXTOUT Record

The META_TEXTOUT record outputs a character string at the specified location by using the font, background color, and text color that are defined in the playback device context.

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_TEXTOUT.

StringLength (2 bytes): A 16-bit signed integer that defines the length of the string, in bytes, pointed to by String.

String (variable): The size of this field MUST be a multiple of two. If StringLength is an odd number, then this field MUST be of a size greater than or equal to StringLength + 1. A variable-length string that specifies the text to be drawn. The string does not need to be null-terminated, because StringLength specifies the length of the string. The string is written at the location specified by the XStart and YStart fields.

YStart (2 bytes): A 16-bit signed integer that defines the vertical (y-axis) coordinate, in logical units, of the point where drawing is to start.

XStart (2 bytes): A 16-bit signed integer that defines the horizontal (x-axis) coordinate, in logical units, of the point where drawing is to start.

See section 2.3.3 for the specification of other Drawing records.

2.3.4 Object Record Types 
This section defines the Object Record Types, which create and manage the graphics objects specified in the Playback Device Context (section 3.1.5). 
The following are the Object Record Types. 
Name Section Description 
META_CREATEBRUSHINDIRECT 2.3.4.1 Creates a Brush Object (section 2.2.1.1) from a LogBrush Object (section 2.2.2.10). 
META_CREATEFONTINDIRECT 2.3.4.2 Creates a Font Object (section 2.2.1.2). 
META_CREATEPALETTE 2.3.4.3 Creates a Palette Object (section 2.2.1.3). 
129 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Name Section Description 
META_CREATEPATTERNBRUSH 2.3.4.4  Creates a Brush Object with a pattern specified by a bitmap. 
META_CREATEPENINDIRECT 2.3.4.5 Creates a Pen Object (section 2.2.1.4). 
META_CREATEREGION 2.3.4.6 Creates a Region Object (section 2.2.1.5). 
META_DELETEOBJECT 2.3.4.7 Deletes an existing object. 
META_DIBCREATEPATTERNBRUSH 2.3.4.8 Creates a Brush Object with a pattern specified by a DIB. 
META_SELECTCLIPREGION 2.3.4.9 Specifies the clipping region in the playback device context with a specified Region Object. 
META_SELECTOBJECT 2.3.4.10 Specifies a graphics object in the playback device context. 
META_SELECTPALETTE 2.3.4.11 Specifies the palette in the playback device context with a specified Palette Object. 
Whenever a graphics object is created by one of the preceding metafile records, the following actions are implied: 
? The object MUST always be assigned the lowest-numbered available index in the WMF Object Table (section 3.1.4.1). 
? Subsequent WMF records MUST refer to the object by its assigned WMF Object Table index. 
? The object MUST NOT be used in drawing operations until a META_SELECTOBJECT record is received that specifies the object's index. 
? The object MUST remain available for selection until a META_DELETEOBJECT (section 2.3.4.7) record is received that specifies the object's index. 
For further information concerning object indexes and the WMF Object Table, see Managing Objects (section 3.1.4). 
2.3.4.1 META_CREATEBRUSHINDIRECT Record 
The META_CREATEBRUSHINDIRECT record creates a Brush Object (section 2.2.1.1) from a LogBrush Object (section 2.2.2.10). 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction LogBrush 
... 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_CREATEBRUSHINDIRECT. 
130 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
LogBrush (8 bytes): LogBrush Object data that defines the brush to create. The BrushStyle field specified in the LogBrush Object SHOULD be BS_SOLID, BS_NULL, or BS_HATCHED; otherwise, a default Brush Object MAY be created. See the following table for details. 
The following table shows the types of Brush Objects created by the META_CREATEBRUSHINDIRECT record, according to the BrushStyle Enumeration (section 2.1.1.4) value in the LogBrush Object specified by the LogBrush field. 
BrushStyle Brush Object created 
BS_SOLID A solid-color Brush Object. 
BS_NULL An empty Brush Object. 
BS_PATTERN A default object, such as a solid-color black Brush Object, SHOULD be created.<56> 
BS_DIBPATTERNPT Same as preceding BS_PATTERN. 
BS_HATCHED A hatched Brush Object. 
See section 2.3.4 for the specification of other object records. 
2.3.4.2 META_CREATEFONTINDIRECT Record 
The META_CREATEFONTINDIRECT record creates a Font Object (section 2.2.1.2). 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Font (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration value META_CREATEFONTINDIRECT. 
Font (variable): Font Object data that defines the font to create. 
See section 2.3.4 for the specification of other object records. 
2.3.4.3 META_CREATEPALETTE Record 
The META_CREATEPALETTE record creates a Palette Object (section 2.2.1.3). 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Palette (variable) 
131 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration value META_CREATEPALETTE. 
Palette (variable): Palette Object data that defines the palette to create. The Start field in the Palette Object MUST be set to 0x0300. 
See section 2.3.4 for the specification of other object records. 
2.3.4.4 META_CREATEPATTERNBRUSH Record 
The META_CREATEPATTERNBRUSH record creates a brush object with a pattern specified by a bitmap.<57> 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Bitmap16 (14 bytes) 
... 
... 
Reserved (18 bytes) 
... 
... 
... Pattern (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_CREATEPATTERNBRUSH. 
Bitmap16 (14 bytes): A partial Bitmap16 object (section 2.2.2.1), which defines parameters for the bitmap that specifies the pattern for the brush. Fields not described below are specified in section 2.2.2.1. 
132 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
Type Width 
Height WidthBytes 
Planes BitsPixel Bits 
... 
Bits (4 bytes): This field MUST be ignored. 
Reserved (18 bytes): This field MUST be ignored. 
Pattern (variable): A variable-length array of bytes that defines the bitmap pixel data that composes the brush pattern. The length of this field, in bytes, can be computed from bitmap parameters as follows. 
 
(((Width * BitsPixel + 15) >> 4) << 1) * Height 
The Width, BitsPixel, and Height values are specified in the Bitmap16 field of this record. 
The BrushStyle enumeration (section 2.1.1.4) value for the brush object created by this record MUST be BS_PATTERN. 
See section 2.3.4 for the specification of other WMF object records. 
2.3.4.5 META_CREATEPENINDIRECT Record 
The META_CREATEPENINDIRECT record creates a Pen Object (section 2.2.1.4). 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Pen 
... 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration value META_CREATEPENINDIRECT. 
Pen (10 bytes): Pen Object data that defines the pen to create. 
See section 2.3.4 for the specification of other object records. 
133 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.4.6 META_CREATEREGION Record 
The META_CREATEREGION record creates a Region Object (section 2.2.1.5). 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Region (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration value META_CREATEREGION. 
Region (variable): Region Object data that defines the region to create. 
See section 2.3.4 for the specification of other object records. 
2.3.4.7 META_DELETEOBJECT Record 
The META_DELETEOBJECT record deletes an object, including Bitmap16, Brush, DeviceIndependentBitmap, Font, Palette, Pen, and Region. After the object is deleted, its index in the WMF Object Table is no longer valid but is available to be reused. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction ObjectIndex 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_DELETEOBJECT. 
ObjectIndex (2 bytes): A 16-bit unsigned integer used to index into the WMF Object Table to get the object to be deleted. 
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.4 for the specification of other Object records. 
2.3.4.8 META_DIBCREATEPATTERNBRUSH Record 
The META_DIBCREATEPATTERNBRUSH record creates a Brush Object (section 2.2.1.1) with a pattern specified by a DeviceIndependentBitmap (DIB) Object (section 2.2.2.9). 
134 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Style 
ColorUsage Target (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_DIBCREATEPATTERNBRUSH. 
Style (2 bytes): A 16-bit unsigned integer that defines the brush style. The legal values for this field are defined as follows: if the value is not BS_PATTERN, BS_DIBPATTERNPT MUST be assumed. These values are specified in the BrushStyle Enumeration (section 2.1.1.4). 
ColorUsage (2 bytes): A 16-bit unsigned integer that defines whether the Colors field of a DIB Object contains explicit RGB values, or indexes into a palette. 
If the Style field specifies BS_PATTERN, a ColorUsage value of DIB_RGB_COLORS MUST be used regardless of the contents of this field.  
If the Style field specified anything but BS_PATTERN, this field MUST be one of the values in the ColorUsage Enumeration (section 2.1.1.6). 
Target (variable): Variable-bit DIB Object data that defines the pattern to use in the brush. 
The following table shows the types of Brush Objects created by the META_DIBCREATEPATTERNBRUSH record, according to BrushStyle Enumeration values. 
BrushStyle ColorUsage Brush Object created 
BS_SOLID Same as the following BS_DIBPATTERNPT. Same as the following BS_DIBPATTERNPT. 
BS_NULL Same as the following BS_DIBPATTERNPT. Same as the following BS_DIBPATTERNPT. 
BS_PATTERN A ColorUsage Enumeration value, which SHOULD define how to interpret the logical color values in the brush pattern. 
A BS_PATTERN Brush Object that SHOULD contain a pattern defined by a Bitmap16 Object. 
BS_DIBPATTERNPT A ColorUsage Enumeration value, which SHOULD define how to interpret the logical color values in the brush pattern. 
A BS_DIBPATTERNPT Brush Object that SHOULD contain a pattern defined by a DIB Object. 
BS_HATCHED Same as the preceding BS_DIBPATTERNPT. Same as preceding BS_DIBPATTERNPT. 
See section 2.3.4 for the specification of other object records. 
135 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.4.9 META_SELECTCLIPREGION Record 
The META_SELECTCLIPREGION record specifies a Region Object (section 2.2.1.5) to be the current clipping region. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Region 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SELECTCLIPREGION. 
Region (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the region to be inverted. 
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.4 for the specification of other Object records. 

2.3.4.10 META_SELECTOBJECT Record

The META_SELECTOBJECT record specifies a graphics object for the playback device context. The new object replaces the previous object of the same type, unless if the previous object is a palette object. If the previous object is a palette object, then the META_SELECTPALETTE record MUST be used instead of the META_SELECTOBJECT record, because the META_SELECTOBJECT record does not support replacing the palette object type. 0 1 2 3 4 5 6 7 8 9 1 0 1 2 3 4 5 6 7 8 9 2 0 1 2 3 4 5 6 7 8 9 3 0 1 RecordSize RecordFunction ObjectIndex

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SELECTOBJECT.

ObjectIndex (2 bytes): A 16-bit unsigned integer used to index into the WMF Object Table to get the object to be selected.

The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information.

See section 2.3.4 for the specification of other Object records.

2.3.4.11 META_SELECTPALETTE Record 
The META_SELECTPALETTE record defines the current logical palette with a specified Palette Object. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Palette 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SELECTPALETTE. 
Palette (2 bytes):  A 16-bit unsigned integer used to index into the WMF Object Table to get the Palette Object to be selected. 
The WMF Object Table refers to an indexed table of WMF Objects that are defined in the metafile. See section 3.1.4.1 for more information. 
See section 2.3.4 for the specification of other Object records. 
2.3.5 State Record Types 
This section defines the State record types, which define and manage the graphics properties specified in the Playback Device Context (section 3.1.5). 
The following are the State record types. 
Name Section Description 
META_ANIMATEPALETTE 2.3.5.1 Redefines entries in the logical palette that is defined in the playback device context with a specified Palette Object (section 2.2.1.3). 
META_EXCLUDECLIPRECT 2.3.5.2 Sets the clipping region that is defined in the playback device context to the existing clipping region minus a specified rectangle. 
META_INTERSECTCLIPRECT 2.3.5.3 Sets the clipping region that is defined in the playback device context to the intersection of the existing clipping region and a specified rectangle. 
META_MOVETO 2.3.5.4 Sets the output position in the playback device context to a specified point. 
META_OFFSETCLIPRGN 2.3.5.5 Moves the clipping region that is defined in the playback device context by specified offsets. 
META_OFFSETVIEWPORTORG 2.3.5.6 Moves the viewport origin in the playback device context by specified horizontal and vertical offsets. 
META_OFFSETWINDOWORG 2.3.5.7 Moves the output window origin in the playback device context by specified horizontal and vertical offsets. 
META_REALIZEPALETTE 2.3.5.8 Maps entries from the logical palette that is defined in the playback device context to the system palette. 
137 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Name Section Description 
META_RESIZEPALETTE 2.3.5.9 Redefines the size of the logical palette that is defined in the playback device context. 
META_RESTOREDC 2.3.5.10 Restores the playback device context from a previously saved device context. 
META_SAVEDC 2.3.5.11 Saves the playback device context for later retrieval. 
META_SCALEVIEWPORTEXT 2.3.5.12 Scales the horizontal and vertical extents of the viewport that is defined in the playback device context using the ratios formed by specified multiplicands and divisors. 
META_SCALEWINDOWEXT 2.3.5.13 Scales the horizontal and vertical extents of the output window that is defined in the playback device context using the ratios formed by specified multiplicands and divisors. 
META_SETBKCOLOR 2.3.5.14 Sets the background color in the playback device context to a specified color. 
META_SETBKMODE 2.3.5.15 Sets the background mix mode in the playback device context. 
META_SETLAYOUT 2.3.5.16 Defines the layout orientation in the playback device context. 
META_SETMAPMODE 2.3.5.17 Defines the mapping mode in the playback device context. 
META_SETMAPPERFLAGS 2.3.5.18 Defines the algorithm that the font mapper uses when it maps logical fonts to physical fonts. 
META_SETPALENTRIES 2.3.5.19 Defines RGB color values in a range of entries in the logical palette that is defined in the playback device context. 
META_SETPOLYFILLMODE 2.3.5.20 Defines polygon fill mode in the playback device context for graphics operations that fill polygons. 
META_SETRELABS 2.3.5.21 Undefined and MUST be ignored. 
META_SETROP2 2.3.5.22 Defines the foreground raster operation mixing mode in the playback device context. 
META_SETSTRETCHBLTMODE 2.3.5.23 Defines the bitmap stretching mode in the playback device context. 
META_SETTEXTALIGN 2.3.5.24 Defines text-alignment values in the playback device context. 
META_SETTEXTCHAREXTRA 2.3.5.25 Defines inter-character spacing for text justification in the playback device context. 
META_SETTEXTCOLOR 2.3.5.26 Defines the text foreground color in the playback device context. 
META_SETTEXTJUSTIFICATION 2.3.5.27 Defines the amount of space to add to break characters in a string of justified text. 
META_SETVIEWPORTEXT 2.3.5.28 Defines the horizontal and vertical extents of the viewport in the playback device context. 
META_SETVIEWPORTORG 2.3.5.29 Defines the viewport origin in the playback device context. 
META_SETWINDOWEXT 2.3.5.30 Defines the horizontal and vertical extents of the output window in the playback device context. 
META_SETWINDOWORG 2.3.5.31 Defines the output window origin in the playback device context. 
 
138 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.5.1 META_ANIMATEPALETTE Record 
The META_ANIMATEPALETTE record redefines entries in the logical palette that is defined in the playback device context with the specified Palette object (section 2.2.1.3). 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Palette (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ANIMATEPALETTE. 
Palette (variable): A variable-sized Palette object that specifies a logical palette. 
The logical palette that is specified by the Palette object in this record is the source of the palette changes, and the logical palette that is currently selected into the playback device context is the destination. Entries in the destination palette with the PC_RESERVED PaletteEntryFlag (section 2.1.1.22) set SHOULD be modified by this record, and entries with that flag clear SHOULD NOT be modified. If none of the entries in the destination palette have the PC_RESERVED flag set, then this record SHOULD have no effect. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.2 META_EXCLUDECLIPRECT Record 
The META_EXCLUDECLIPRECT record sets the clipping region in the playback device context to the existing clipping region minus the specified rectangle. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Bottom 
Right Top 
Left 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_EXCLUDECLIPRECT. 
139 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Bottom (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the rectangle. 
Right (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the lowerright corner of the rectangle. 
Top (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the rectangle. 
Left (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the rectangle. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.3 META_INTERSECTCLIPRECT Record 
The META_INTERSECTCLIPRECT record sets the clipping region in the playback device context to the intersection of the existing clipping region and the specified rectangle. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Bottom 
Right Top 
Left 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_INTERSECTCLIPRECT. 
Bottom (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the lower-right corner of the rectangle. 
Right (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the lowerright corner of the rectangle. 
Top (2 bytes): A 16-bit signed integer that defines the y-coordinate, in logical units, of the upper-left corner of the rectangle. 
Left (2 bytes): A 16-bit signed integer that defines the x-coordinate, in logical units, of the upper-left corner of the rectangle. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.4 META_MOVETO Record 
The META_MOVETO record sets the output position in the playback device context to a specified point. 
140 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Y 
X 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_MOVETO. 
Y (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units. 
X (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.5 META_OFFSETCLIPRGN Record 
The META_OFFSETCLIPRGN record moves the clipping region in the playback device context  by the specified offsets. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction YOffset 
XOffset 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_OFFSETCLIPRGN. 
YOffset (2 bytes): A 16-bit signed integer that defines the number of logical units to move up or down. 
XOffset (2 bytes): A 16-bit signed integer that defines the number of logical units to move left or right. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.6 META_OFFSETVIEWPORTORG Record 
The META_OFFSETVIEWPORTORG record moves the viewport origin in the playback device context by specified horizontal and vertical offsets. 
141 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction YOffset 
XOffset 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_OFFSETVIEWPORTORG. 
YOffset (2 bytes):  A 16-bit signed integer that defines the vertical offset, in device units. 
XOffset (2 bytes):  A 16-bit signed integer that defines the horizontal offset, in device units. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.7 META_OFFSETWINDOWORG Record 
The META_OFFSETWINDOWORG record moves the output window origin in the playback device context by specified horizontal and vertical offsets. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction YOffset 
XOffset 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_OFFSETWINDOWORG. 
YOffset (2 bytes):  A 16-bit signed integer that defines the vertical offset, in device units. 
XOffset (2 bytes):  A 16-bit signed integer that defines the horizontal offset, in device units. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.8 META_REALIZEPALETTE Record 
The META_REALIZEPALETTE record maps entries from the logical palette that is defined in the playback device context to the system palette. 
142 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_REALIZEPALETTE. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.9 META_RESIZEPALETTE Record 
The META_RESIZEPALETTE record redefines the size of the logical palette that is defined in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction NumberOfEntries 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_RESIZEPALETTE. 
NumberOfEntries (2 bytes):  A 16-bit unsigned integer that defines the number of entries in the logical palette. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.10 META_RESTOREDC Record 
The META_RESTOREDC record restores the playback device context from a previously saved device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction nSavedDC 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
143 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_RESTOREDC. 
nSavedDC (2 bytes): A 16-bit signed integer that defines the saved state to be restored. If this member is positive, nSavedDC represents a specific instance of the state to be restored. If this member is negative, nSavedDC represents an instance relative to the current state. 
See section 3.1.5 for a description of the state defined by the playback device context. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.11 META_SAVEDC Record 
The META_SAVEDC record saves the playback device context for later retrieval. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SAVEDC. 
See section 3.1.5 for a description of the state defined by the playback device context. 
See section State Record Types (section 2.3.5) for the specification of other State record types. 
2.3.5.12 META_SCALEVIEWPORTEXT Record 
The META_SCALEVIEWPORTEXT record scales the horizontal and vertical extents of the viewport that is defined in the playback device context by using the ratios formed by the specified multiplicands and divisors. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction yDenom 
yNum xDenom 
xNum 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SCALEVIEWPORTEXT. 
144 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
yDenom (2 bytes):  A 16-bit signed integer that defines the amount by which to divide the result of multiplying the current y-extent by the value of the yNum member. 
yNum (2 bytes):  A 16-bit signed integer that defines the amount by which to multiply the current yextent. 
xDenom (2 bytes): A 16-bit signed integer that defines the amount by which to divide the result of multiplying the current x-extent by the value of the xNum member. 
xNum (2 bytes):  A 16-bit signed integer that defines the amount by which to multiply the current xextent. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.13 META_SCALEWINDOWEXT Record 
The META_SCALEWINDOWEXT record scales the horizontal and vertical extents of the output window that is defined in the playback device context by using the ratios formed by specified multiplicands and divisors. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction yDenom 
yNum xDenom 
xNum 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SCALEWINDOWEXT. 
yDenom (2 bytes):  A 16-bit signed integer that defines the amount by which to divide the result of multiplying the current y-extent by the value of the yNum member. 
yNum (2 bytes):  A 16-bit signed integer that defines the amount by which to multiply the current yextent. 
xDenom (2 bytes):  A 16-bit signed integer that defines the amount by which to divide the result of multiplying the current x-extent by the value of the xNum member. 
xNum (2 bytes):  A 16-bit signed integer that defines the amount by which to multiply the current xextent. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.14 META_SETBKCOLOR Record 
The META_SETBKCOLOR record sets the background color in the playback device context to a specified color, or to the nearest physical color if the device cannot represent the specified color. 
145 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction ColorRef 
... 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETBKCOLOR. 
ColorRef (4 bytes):  A 32-bit ColorRef Object that defines the color value. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.15 META_SETBKMODE Record 
The META_SETBKMODE record defines the background raster operation mix mode in the playback device context. The background mix mode is the mode for combining pens, text, hatched brushes, and interiors of filled objects with background colors on the output surface. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction BkMode 
Reserved (optional) 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETBKMODE. 
BkMode (2 bytes): A 16-bit unsigned integer that defines background mix mode. This MUST be one of the values in the MixMode Enumeration (section 2.1.1.20). 
Reserved (2 bytes): An optional 16-bit field that MUST be ignored.<58> 
See section 2.3.5 for the specification of other State record types. 
2.3.5.16 META_SETLAYOUT Record 
The META_SETLAYOUT record defines the layout orientation in the playback device context.<59> The layout orientation determines the direction in which text and graphics are drawn 
146 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Layout 
Reserved 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETLAYOUT. 
Layout (2 bytes): A 16-bit unsigned integer that defines the layout of text and graphics. This MUST be one of the values in the Layout Enumeration (section 2.1.1.13). 
Reserved (2 bytes): A 16-bit field that MUST be ignored. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.17 META_SETMAPMODE Record 
The META_SETMAPMODE record defines the mapping mode in the playback device context. The mapping mode defines the unit of measure used to transform page-space units into device-space units, and also defines the orientation of the device's x and y axes. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction MapMode 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETMAPMODE. 
MapMode (2 bytes): A 16-bit unsigned integer that defines the mapping mode. This MUST be one of the values enumerated in the MapMode Enumeration table. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.18 META_SETMAPPERFLAGS Record 
The META_SETMAPPERFLAGS record defines the algorithm that the font mapper uses when it maps logical fonts to physical fonts. 
147 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction MapperValues 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETMAPPERFLAGS. 
MapperValues (4 bytes):  A 32-bit unsigned integer that defines whether the font mapper attempts to match a font aspect ratio to the current device aspect ratio. If bit zero is set, the mapper selects only matching fonts. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.19 META_SETPALENTRIES Record 
The META_SETPALENTRIES record defines RGB color values in a range of entries in the logical palette that is defined in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Palette (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETPALENTRIES. 
Palette (variable): A Palette object (section 2.2.1.3), which defines the palette information. 
The META_SETPALENTRIES record modifies the logical palette that is currently selected in the playback device context. A META_SELECTPALETTE record (section 2.3.4.11) MUST have been used to specify that logical palette in the form of a Palette object (section 2.2.1.3) prior to the occurrence of the META_SETPALENTRIES record in the metafile. A Palette object is one of the graphics objects that is maintained in the playback device context during playback of the metafile. See Graphics Objects (section 1.3.2) for more information. 
See section 2.3.5 for the specification of other State record types. 
148 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.5.20 META_SETPOLYFILLMODE Record 
The META_SETPOLYFILLMODE record sets polygon fill mode in the playback device context for graphics operations that fill polygons. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction PolyFillMode 
Reserved (optional) 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETPOLYFILLMODE. 
PolyFillMode (2 bytes): A 16-bit unsigned integer that defines polygon fill mode. This MUST be one of the values in the PolyFillMode Enumeration (section 2.1.1.25). 
Reserved (2 bytes): An optional 16-bit field that MUST be ignored.<60> 
See section 2.3.5 for the specification of other State record types. 
2.3.5.21 META_SETRELABS Record 
The META_SETRELABS record is reserved and not supported. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETRELABS. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.22 META_SETROP2 Record 
The META_SETROP2 record defines the foreground raster operation mix mode in the playback device context. The foreground mix mode is the mode for combining pens and interiors of filled objects with foreground colors on the output surface. 
149 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction DrawMode 
Reserved (optional) 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETROP2. 
DrawMode (2 bytes): A 16-bit unsigned integer that defines the foreground binary raster operation mixing mode. This MUST be one of the values in the Binary Raster Operation Enumeration (section 2.1.1.2). 
Reserved (2 bytes): An optional 16-bit field that MUST be ignored.<61> 
See section 2.3.5 for the specification of other State record types. 
2.3.5.23 META_SETSTRETCHBLTMODE Record 
The META_SETSTRETCHBLTMODE record defines the bitmap stretching mode in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction StretchMode 
Reserved (optional) 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETSTRETCHBLTMODE. 
StretchMode (2 bytes): A 16-bit unsigned integer that defines bitmap stretching mode. This MUST be one of the values in the StretchMode Enumeration (section 2.1.1.30). 
Reserved (2 bytes): An optional 16-bit field that MUST be ignored.<62> 
See section 2.3.5 for the specification of other State record types. 
2.3.5.24 META_SETTEXTALIGN Record 
The META_SETTEXTALIGN record defines text-alignment values in the playback device context. 
150 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction TextAlignmentMode 
Reserved (optional) 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration (section 2.1.1.1) value META_SETTEXTALIGN. 
TextAlignmentMode (2 bytes): A 16-bit unsigned integer that defines text alignment. This value MUST be a combination of one or more TextAlignmentMode Flags (section 2.1.2.3) for text with a horizontal baseline, and VerticalTextAlignmentMode Flags (section 2.1.2.4) for text with a vertical baseline. 
Reserved (2 bytes): An optional 16-bit field that MUST be ignored.<63> 
See section 2.3.5 for the specification of other State record types. 
2.3.5.25 META_SETTEXTCHAREXTRA Record 
The META_SETTEXTCHAREXTRA record defines inter-character spacing for text justification in the playback device context. Spacing is added to the white space between each character, including break characters, when a line of justified text is output. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction CharExtra 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETTEXTCHAREXTRA. 
CharExtra (2 bytes): A 16-bit unsigned integer that defines the amount of extra space, in logical units, to be added to each character. If the current mapping mode is not MM_TEXT, this value is transformed and rounded to the nearest pixel. For details about setting the mapping mode, see META_SETMAPMODE (section 2.3.5.17). 
See section 2.3.5 for the specification of other state record types. 
2.3.5.26 META_SETTEXTCOLOR Record 
The META_SETTEXTCOLOR record defines the text foreground color in the playback device context. 
151 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction ColorRef 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETTEXTCOLOR. 
ColorRef (4 bytes): A 32-bit ColorRef Object that defines the color value. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.27 META_SETTEXTJUSTIFICATION Record 
The META_SETTEXTJUSTIFICATION record defines the amount of space to add to break characters in a string of justified text. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction BreakCount 
BreakExtra 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration value META_SETTEXTJUSTIFICATION. 
BreakCount (2 bytes):  A 16-bit unsigned integer that specifies the number of space characters in the line. 
BreakExtra (2 bytes):  A 16-bit unsigned integer that specifies the total extra space, in logical units, to be added to the line of text. If the current mapping mode is not MM_TEXT, the value identified by the BreakExtra member is transformed and rounded to the nearest pixel. For details about setting the mapping mode, see META_SETMAPMODE (section 2.3.5.17). 
See section 2.3.5 for the specification of other State record types. 
2.3.5.28 META_SETVIEWPORTEXT Record 
The META_SETVIEWPORTEXT record sets the horizontal and vertical extents of the viewport in the playback device context. 
152 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Y 
X 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETVIEWPORTEXT. 
Y (2 bytes):  A 16-bit signed integer that defines the vertical extent of the viewport in device units. 
X (2 bytes):  A 16-bit signed integer that defines the horizontal extent of the viewport in device units. 
See section 2.3.5 for the specification of other State record types. 
2.3.5.29 META_SETVIEWPORTORG Record 
The META_SETVIEWPORTORG record defines the viewport origin in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Y 
X 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETVIEWPORTORG. 
Y (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units. 
X (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units. 
See section 2.3.5 for the specification of other State record types.

2.3.5.30 META_SETWINDOWEXT Record

The META_SETWINDOWEXT record defines the horizontal and vertical extents of the output window in the playback device context. 0 1 2 3 4 5 6 7 8 9 1 0 1 2 3 4 5 6 7 8 9 2 0 1 2 3 4 5 6 7 8 9 3 0 1 RecordSize RecordFunction Y X

RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record.

RecordFunction (2 bytes): A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETWINDOWEXT.

Y (2 bytes): A 16-bit signed integer that defines the vertical extent of the window in logical units.

X (2 bytes): A 16-bit signed integer that defines the horizontal extent of the window in logical units.

See section 2.3.5 for the specification of other State record types.

 
2.3.5.31 META_SETWINDOWORG Record 
The META_SETWINDOWORG record defines the output window origin in the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction Y 
X 
RecordSize (4 bytes):  A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes):  A 16-bit unsigned integer that defines this WMF record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_SETWINDOWORG. 
Y (2 bytes):  A 16-bit signed integer that defines the y-coordinate, in logical units. 
X (2 bytes):  A 16-bit signed integer that defines the x-coordinate, in logical units. 
See section 2.3.5 for the specification of other State record types. 
2.3.6 Escape Record Types 
This section defines the Escape Record Types, which specify extensions to metafile functionality. The generic format of all escape records is specified by the META_ESCAPE (section 2.3.6.1) record. 
The following are the escape record types. 
154 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Name Section Description 
ABORTDOC 2.3.6.2 Stops processing the current document. 
BEGIN_PATH 2.3.6.3 Opens a path. 
CHECK_JPEGFORMAT 2.3.6.4 Determines whether it can handle the given JPEG image. 
CHECK_PNGFORMAT 2.3.6.5 Determines whether it can handle the given PNG image. 
CLIP_TO_PATH 2.3.6.6 Applies a function to the current PostScript clipping path. 
CLOSE_CHANNEL 2.3.6.7 Same as ENDDOC. 
DOWNLOAD_FACE 2.3.6.8 Sets the font face name on the output device. 
DOWNLOAD_HEADER 2.3.6.9 Downloads sets of PostScript procedures. 
DRAW_PATTERNRECT 2.3.6.10 Draws a rectangle with a defined pattern. 
ENCAPSULATED_POSTSCRIPT 2.3.6.11 Sends arbitrary encapsulated PostScript (EPS) data directly to the printer driver. 
END_PATH 2.3.6.12 Ends a path.  
ENDDOC 2.3.6.13 Notifies the printer driver that a new print job is ending.  
EPS_PRINTING 2.3.6.14 Indicates the start and end of EPS printing. 
EXTTEXTOUT 2.3.6.15 Draws text using the currently selected font, background color, and text color. 
GET_COLORTABLE 2.3.6.16 Gets color table values from the printer driver. 
GET_DEVICEUNITS 2.3.6.17 Gets the device units currently configured on the output device. 
GET_EXTENDED_TEXTMETRICS 2.3.6.18 Gets the extended text metrics that are currently configured on the printer driver. 
GET_FACENAME 2.3.6.19 Gets the font face name currently configured on the output device. 
GET_PAIRKERNTABLE 2.3.6.20 Gets the font kern table currently defined on the output device. 
GET_PHYSPAGESIZE 2.3.6.21 Retrieves the physical page size currently selected on the output device. 
GET_PRINTINGOFFSET 2.3.6.22 Retrieves the offset from the upper-left corner of the physical page where the actual printing or drawing begins. 
GET_PS_FEATURESETTING 2.3.6.23 Queries the printer driver for information about PostScript features supported on the output device. 
GET_SCALINGFACTOR 2.3.6.24 Retrieves the scaling factors for the x-axis and the y-axis of a printer. 
META_ESCAPE_ENHANCED_METAFILE 2.3.6.25 Used to embed an EMF metafile within a WMF metafile. 
METAFILE_DRIVER 2.3.6.26 Queries the printer driver about its support for metafiles on the output device. 
NEWFRAME 2.3.6.27 Notifies the printer driver that the application has finished writing to a page. 
155 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Name Section Description 
NEXTBAND 2.3.6.28 Notifies the printer driver that the application has finished writing to a band. 
PASSTHROUGH 2.3.6.29 Passes through arbitrary data to the printer driver. 
POSTSCRIPT_DATA 2.3.6.30 Sends arbitrary PostScript data to the output device. 
POSTSCRIPT_IDENTIFY 2.3.6.31 Sets the printer driver to either PostScript-centric or GDIcentric mode. 
POSTSCRIPT_IGNORE 2.3.6.32 Notifies the output device to ignore PostScript data. 
POSTSCRIPT_INJECTION 2.3.6.33 Inserts a block of raw data into a PostScript stream. 
POSTSCRIPT_PASSTHROUGH 2.3.6.34 Sends arbitrary data directly to a printer driver, which is expected to process this data only when in PostScript mode. 
OPEN_CHANNEL 2.3.6.35 Acts the same as STARTDOC, with a NULL document and output filename, and data in raw mode. 
QUERY_DIBSUPPORT 2.3.6.36 Queries the printer driver about its support for DIBs on the output device. 
QUERY_ESCSUPPORT 2.3.6.37 Queries the printer driver to determine whether a specific WMF escape function is supported on the output device. 
SET_COLORTABLE 2.3.6.38 Sets color table values. 
SET_COPYCOUNT 2.3.6.39 Sets the number of copies. 
SET_LINECAP 2.3.6.40 Specifies the line-ending mode to use in drawing to the output device. 
SET_LINEJOIN 2.3.6.41 Specifies the line-joining mode to use in drawing to the output device. 
SET_MITERLIMIT 2.3.6.42 Sets the limit for the length of miter joins to use in drawing to the output device. 
SPCLPASSTHROUGH2 2.3.6.43 Enables documents to include private procedures and other arbitrary data in documents. 
STARTDOC 2.3.6.44 Notifies the printer driver that a new print job is starting. 
 
2.3.6.1 META_ESCAPE Record 
The META_ESCAPE record specifies extensions to WMF functionality that are not directly available through other records defined in the RecordType enumeration (section 2.1.1.1). The MetafileEscapes enumeration (section 2.1.1.17) lists these extensions. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
156 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
ByteCount EscapeData (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be from the MetafileEscapes enumeration. 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the EscapeData field. 
EscapeData (variable): An array of bytes of size ByteCount. 
Every META_ESCAPE record MUST include a MetafileEscapes function specifier, followed by arbitrary data. The data SHOULD NOT contain position-specific data that assumes the location of a particular record within the metafile, because one metafile might be embedded within another. 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.2 ABORTDOC Record 
The ABORTDOC record stops processing the current document and erases everything drawn since the last STARTDOC record was processed. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0002 (ABORTDOC) from MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.3 BEGIN_PATH Record 
The BEGIN_PATH record opens a path. 
157 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1000 (BEGIN_PATH) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.4 CHECK_JPEGFORMAT Record 
The CHECK_JPEGFORMAT record specifies whether the printer driver supports JPEG image output. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount JPEGBuffer (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1017 (CHECK_JPEGFORMAT) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the JPEGBuffer field. 
JPEGBuffer (variable): A buffer of JPEG image data. 
See section 2.3.6 for the specification of other escape record types. 
158 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.6.5 CHECK_PNGFORMAT Record 
The CHECK_PNGFORMAT record queries the driver to see if it can handle the given PNG image and parses the PNG image to determine whether the driver can support it. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount PNGBuffer (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1018 (CHECK_PNGFORMAT) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the PNGBuffer field. 
PNGBuffer (variable): A buffer of PNG image data. 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.6 CLIP_TO_PATH Record 
The CLIP_TO_PATH record applies a function to the current PostScript clipping path. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount ClipFunction 
Reserved1 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in this record. This value MUST be 0x0000000E. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines the record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
159 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1001 (CLIP_TO_PATH) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the record data that follows. This value MUST be 0x0004. 
ClipFunction (2 bytes): A 16-bit unsigned integer that defines the function to apply to the PostScript clipping path. This value MUST be a PostScriptClipping enumeration (section 2.1.1.27) value. 
Name Value 
CLIP_SAVE 0x0000 
CLIP_RESTORE 0x0001 
CLIP_INCLUSIVE 0x0002 
Reserved1 (2 bytes): This value SHOULD be zero and SHOULD be ignored by the client.<64> 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.7 CLOSE_CHANNEL Record 
The CLOSE_CHANNEL record notifies the printer driver that the current print job is ending. This is the same function as the ENDDOC record. A CLOSE_CHANNEL record MUST be preceded by an OPEN_CHANNEL record. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The low-order byte MUST match the low-order byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1010 (CLOSE_CHANNEL) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.8 DOWNLOAD_FACE Record 
The DOWNLOAD_FACE record sends the font face. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
160 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The low-order byte MUST match the low-order byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0202 (DOWNLOAD_FACE) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.9 DOWNLOAD_HEADER Record 
The DOWNLOAD_HEADER record instructs the driver to download all sets of PostScript procedures. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be set to 0x100F (DOWNLOAD_HEADER) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.10 DRAW_PATTERNRECT Record 
The DRAW_PATTERNRECT record draws a rectangle with a defined pattern. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
161 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
ByteCount Position 
... 
... Size 
... 
... Style 
Pattern 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0019 (DRAW_PATTERNRECT) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the record data that follows. This MUST be 0x0014. 
Position (8 bytes): A PointL object (section 2.2.2.15) that defines the position of the rectangle. 
Size (8 bytes): A PointL object that defines the dimensions of the rectangle. 
Style (2 bytes): A 16-bit unsigned integer that defines the style. 
Pattern (2 bytes): A 16-bit unsigned integer that defines the pattern. 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.11 ENCAPSULATED_POSTSCRIPT Record 
The ENCAPSULATED_POSTSCRIPT record sends arbitrary PostScript data directly to a printer driver. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount Size 
... Version 
... Points (24 bytes) 
... 
162 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
... 
... Data (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The low-order byte MUST match the low-order byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1014 (ENCAPSULATED_POSTSCRIPT) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the record data that follows. This value SHOULD be greater than or equal to the value of the Size field.<65> 
Size (4 bytes): A 32-bit unsigned integer that specifies the total size, in bytes, of the Size, Version, Points, and Data fields. 
Version (4 bytes): A 32-bit unsigned integer that defines the PostScript language level. 
Points (24 bytes): An array of three PointL objects (section 2.2.2.15) that define the output parallelogram in 28.4 FIX device coordinates. 
Data (variable): The PostScript data. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.12 END_PATH Record 
The END_PATH record specifies the end of a path. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1002 (END_PATH) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
163 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
2.3.6.13 ENDDOC Record 
The ENDDOC record notifies the printer driver that the current print job is ending. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x000B (ENDDOC) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.14 EPS_PRINTING Record 
The EPS_PRINTING record indicates the start or end of Encapsulated PostScript (EPS) printing. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount SetEpsPrinting 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0021 (EPS_PRINTING) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the SetEpsPrinting field. This MUST be 0x0002. 
SetEpsPrinting (2 bytes): A 16-bit unsigned integer that indicates the start or end of EPS printing. If the value is nonzero, the start of EPS printing is indicated; otherwise, the end is indicated. 
164 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Value Meaning 
Start 0x0000 < value 
The start of EPS printing. 
End 0x0000 
The end of EPS printing. 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.15 EXTTEXTOUT Record 
The EXTTEXTOUT record draws text using the currently selected font, background color, and text color. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0200 (EXTTEXTOUT) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.16 GET_COLORTABLE Record 
The GET_COLORTABLE record gets color table values from the printer driver. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount Start 
ColorTableBuffer (variable) 
... 
165 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in this record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines the record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1)  value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0005 (GET_COLORTABLE) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the record data that follows. 
Start (2 bytes): A 16-bit unsigned integer that defines the offset from the beginning of the record to the start of the color table data in the ColorTable field. 
ColorTableBuffer (variable): A buffer containing the color table that is obtained from the printer driver, which is not required to be contiguous with the static part of the record. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
UndefinedSpace (variable) 
... 
ColorTable (variable) 
... 
UndefinedSpace (variable): An optional field that MUST be ignored. 
ColorTable (variable): An array of bytes that define the color table. The location of this field within the record is specified by the Start field. 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.17 GET_DEVICEUNITS Record 
The GET_DEVICEUNITS record gets the current device units. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
166 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x002A (GET_DEVICEUNITS) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.18 GET_EXTENDED_TEXTMETRICS Record 
The GET_EXTENDED_TEXTMETRICS record gets the extended text metrics that are currently configured on the printer driver and applies them to the playback device context. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines the record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0100 (GET_EXTENDED_TEXTMETRICS) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.19 GET_FACENAME Record 
The GET_FACENAME record gets the font face name. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
167 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0201 (GET_FACENAME) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.20 GET_PAIRKERNTABLE Record 
The GET_PAIRKERNTABLE record gets the font kern table. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x0102 (GET_PAIRKERNTABLE) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.21 GET_PHYSPAGESIZE Record 
The GET_PHYSPAGESIZE record retrieves the physical page size and copies it to a specified location. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x000C (GET_PHYSPAGESIZE) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
168 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.22 GET_PRINTINGOFFSET Record 
The GET_PRINTINGOFFSET record retrieves the offset from the upper-left corner of the physical page where the actual printing or drawing begins. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x000D (GET_PRINTINGOFFSET) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.23 GET_PS_FEATURESETTING Record 
The GET_PS_FEATURESETTING record is used to query the driver concerning PostScript features. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount Feature 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x1019 (GET_PS_FEATURESETTING) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the Feature field. This MUST be 0x0004. 
169 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
Feature (4 bytes): A 32-bit signed integer that identifies the feature setting being queried. Possible values are defined in the PostScriptFeatureSetting enumeration (section 2.1.1.28). 
See section 2.3.6 for the specification of other escape record types. 
2.3.6.24 GET_SCALINGFACTOR Record 
The GET_SCALINGFACTOR record retrieves the scaling factors for the x-axis and the y-axis of a printer. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the WMF record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType Enumeration table value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x000E (GET_SCALINGFACTOR) from the MetafileEscapes Enumeration table. 
ByteCount (2 bytes): A 16-bit unsigned integer that MUST be 0x0000. 
See section 2.3.6 for the specification of other Escape record types. 
2.3.6.25 META_ESCAPE_ENHANCED_METAFILE Record 
The META_ESCAPE_ENHANCED_METAFILE record is used to embed an EMF metafile within a WMF metafile. The EMF metafile is broken up into sections, each represented by one META_ESCAPE_ENHANCED_METAFILE record. 
0 1 2 3 4 5 6 7 8 9 
1 0 1 2 3 4 5 6 7 8 9 
2 0 1 2 3 4 5 6 7 8 9 
3 0 1 
RecordSize 
RecordFunction EscapeFunction 
ByteCount CommentIdentifier 
... CommentType 
... Version 
... Checksum 
Flags 
170 / 210 
[MS-WMF] - v20160714 Windows Metafile Format Copyright © 2016 Microsoft Corporation Release: July 14, 2016 
CommentRecordCount 
CurrentRecordSize 
RemainingBytes 
EnhancedMetafileDataSize 
EnhancedMetafileData (variable) 
... 
RecordSize (4 bytes): A 32-bit unsigned integer that defines the number of WORDs in the record. 
RecordFunction (2 bytes): A 16-bit unsigned integer that defines this record type. The lower byte MUST match the lower byte of the RecordType enumeration (section 2.1.1.1) value META_ESCAPE. 
EscapeFunction (2 bytes): A 16-bit unsigned integer that defines the escape function. The value MUST be 0x000F (META_ESCAPE_ENHANCED_METAFILE) from the MetafileEscapes enumeration (section 2.1.1.17). 
ByteCount (2 bytes): A 16-bit unsigned integer that specifies the size, in bytes, of the record data that 
----------------------------------------