WMF Driver
The WMF driver creates Windows Enhanced Metafile output. The output can be saved either to a file or sent directly to a printer.
The WMF driver is a 24-bit device. For more information on 24-bit color and the WMF driver, see
"Handling 24-bit Color".
Selecting the WMF Driver
To enable WMF as the current graphics device, enter the following command:
SET_PLOT, 'WMF'
This causes PV-WAVE to use the WMF driver for producing subsequent graphics output. Once the WMF driver is enabled via SET_PLOT, the DEVICE procedure is used to control its actions, as described in
"Controlling the WMF Driver with DEVICE Keywords".
Listing the Current Settings for the WMF Driver
Use the command:
INFO, /Device
to view the current WMF driver settings.
Sending PV-WAVE Output Directly to a Printer
The following steps can be used to send Windows Metafile output directly to a Windows printer:
1. Select the WMF driver:
SET_PLOT, 'WMF'
2. Indicate output should be sent directly to the printer:
DEVICE, /Print
3. Select the printer to send output to (if other than the default printer):
printer = WIN32_PICK_PRINTER()
or:
DEVICE, Set_Printer='printer_name'
4. Execute graphics commands (PLOT, SURFACE, XYOUTS, etc.)
5. Close the Windows Metafile and the output is sent to the printer:
DEVICE, /Close_File
Handling 24-bit Color
The WMF driver is a 24-bit device. Colors specified with this device must conform to the PV‑WAVE 24-bit color convention, which is a PV‑WAVE long integer with the red, green, and blue color values occupying the lower three bytes, in order, from the least significant byte. For instance, color values less than 256 are considered to be shades of red. If the Pseudo_Color keyword is set to 8, color values less than 256 are taken to be indices into the PV‑WAVE color map. Colors greater than 256 are still interpreted as 24-bit colors.
Because the WMF driver is a 24-bit device, you need to specify application colors as RGB values in hexadecimal notation, rather than as an index into a color table.
To ensure that colors display correctly on all types of devices, we recommend that you use the WoColorConvert function whenever you specify a color index in your code.
WoColorConvert returns the RGB color value on 24-bit devices and the color table index on 8-bit devices. By using WoColorConvert with all color index values in your code, you ensure that your application colors will appear properly on all types of devices.
For example:
TEK_COLOR
PLOT, DIST(10), Color=WoColorConvert(5)
If your code might be used with 8 and 24-bit displays, and/or the WMF driver, we recommend you use the WoColorConvert function to ensure that colors display correctly.
Additional Text Formatting Commands
The following text formatting commands are new and can be used with the PostScript, WIN32, WMF, and X drivers. These commands can only be used when hardware fonts are enabled (!P.Font=0).
!FB—Switch to the bold face of the current font.
!FI—Switch to the italic face of the current font.
!FU—Underline the current font.
!FN—Switch to the normal form of the current font.
!Pxx—Switch to point size
xx of current font, where
xx is a two digit integer (01–99).
Refer to the PV‑WAVE User’s Guide for a comprehensive list of text formatting commands.
Controlling the WMF Driver with DEVICE Keywords
The following keywords to the DEVICE procedure provide control over the WMF driver:
BoundBySize—Use this keyword to set the bounding rectangle according to Xsize and Ysize.
Close_File—Closes the currently open Windows Metafile. If the Print keyword was specified, the file will be sent directly to the selected printer.
Direct_Color—If set to 24, the WMF driver interprets all colors as 24-bit. For the WMF driver, this keyword is synonymous with the True_Color keyword. (Example: Direct_Color=24)
Filename—Specifies the name of a file to save the Windows Metafile output in. This keyword must be used prior to any graphics commands. If a graphics command is used and neither the Print nor Filename keyword has been specified, a Windows File Selector will be displayed.
Font—Specifies the name of the font used when the hardware font is selected (that is, when !P.Font=0). For example, to select the font 14 point New Times Roman bold, use the following DEVICE call:
DEVICE, Font='Times New Roman, 14, bold'
WAVE> DEVICE, Font=WIN32_PICK_FONT()
the Font dialog box appears. Pick the font and font characteristics that you wish to use, and click OK. The font that you selcct is automatically set by the DEVICE command.
note | To avoid typing the font name, use the WIN32_PICK_FONT function to select a font interactively from a dialog box. For example, if you enter this command: |
Get_Fontmap—Returns list of current font map settings. If /Get_Fontmap is specified, the information is printed to the screen. If a variable name is specified (e.g., Get_Fontmap=varname), a string array is returned.
The information returned by Get_Fontmap is in the same form as the strings specified with Set_Fontmap. The only exception to this pattern is that the first string returned in a string array is labeled as font 0 and is the current default font.
Get_Graphics_Function—See the description of the
Get_Graphics_Function keyword in
"WIN32 Driver".
Get_Write_Mask—See the description of the
Get_Write_Mask keyword in
"WIN32 Driver".
Inches—By default, the Xoffset, Xsize, Yoffset, and Ysize keywords are specified in centimeters. However, if Inches is present and nonzero, these keywords are taken to be in inches instead.
Landscape—PV-WAVE normally generates plots with portrait orientation (the x-axis is along the short dimension of the page). If Landscape is present, landscape orientation (the x-axis is along the long dimension of the page) is used instead. This keyword only works if /Print is used.
note | In both portrait and landscape mode, the x offset is measured as a displacement along the page’s short dimension, and y offset is measured as a displacement along the page’s long dimension. This may cause you some confusion when you are trying to orient graphics on a landscape page. The following figure demonstrates the correct way to specify offset for PostScript’s landscape mode. |
Max_Lines—Sets the maximum number of identical line segments that will be cached before forcing a screen redraw. The WIN32 driver uses an internal cache for drawing line segments. Instead of drawing each line individually, lines with common characteristics are drawn as a group. This feature increases drawing efficiency and rendering speed. To disable Max_Lines, set the keyword equal to one. (Default: 500 lines.)
Max_Pens—Sets the maximum number of pens that will be cached before forcing a screen redraw. (Default: 10 pens, each of which can hold 500 line segments.) To disable Max_Pens, set the keyword equal to one.
note | The line caching feature of your graphics hardware may affect some PV‑WAVE behavior that is familiar to you. In general, this applies to any operation that depends on the order in which lines are drawn. For example, using OPLOT with the color set to the background color to erase drawn lines may not work as expected. This is because some or all of the second set of lines may be drawn before the first set they were intended to overwrite. To avoid this, use the EMPTY procedure to force the driver to empty the line cache first. |
Portrait—If Portrait is present, PV‑WAVE generates plots using portrait orientation, the default. This keyword only works if /Print is used.
Print—If present and non-zero, specifies that output should be sent directly to the selected Windows printer when the Windows Metafile is closed. As described in
"Sending PV-WAVE Output Directly to a Printer", either the
Set_Printer keyword or the WIN32_PICK_PRINTER function can be used to select a destination printer. If neither is used, the default Windows printer is used. The
Print keyword must be specified before any output is made to the Windows Metafile.
Pseudo_Color—If set to 8, the WMF driver interprets 8-bit color values (that is, color values less than 256) as color map indices rather than as 24-bit colors. (Example: Pseudo_Color=8)
Set_Character_Size—A two-element vector that changes the standard width of the vector-drawn fonts and the space allocated above the line of text. The first element in the vector contains the new character width, and the second element contains the number of pixels above the line of text. By default, characters are approximately 8-pixels wide, with 12 pixels between lines.
Set_Fontmap—Associates specific font characteristics with a particular hardware font command. This keyword can be used to specify a single string containing the information for one font, or an array of strings containing the information for multiple fonts.
For example, to associate 16 point Helvetica italic with font command !5, use the following DEVICE call:
DEVICE, Set_Fontmap='5 Helvetica, 16, italics'
Now, whenever the !5 font command appears in a text string, the text output appears in 16 point Helvetica italic. This keyword only affects hardware fonts (that is, when !P.Font=0).
note | A default font mapping is defined in a configuration file that is read when the WMF driver is initialized. For information on this configuration file, see the Fonts chapter in the PV‑WAVE User’s Guide. |
Set_Graphics_Function—See the description of the
Set_Graphics_Function keyword in
"WIN32 Driver".
Set_Write_Mask—See the description of the
Set_Write_Mask keyword in
"WIN32 Driver". Under Windows, the write mask can range from 0 to 255.
Thickness—Specifies the thickness (in millimeters) of lines drawn into the Windows Metafile. The default thickness is 2.
True_Color—If set to 24, the WMF driver interprets all colors as 24-bit. For the WMF driver, this keyword is synonymous with the Direct_Color keyword. (Example: True_Color=24)
Xoffset—Specifies the x position on the page of the lower-left corner of output. Xoffset is specified in centimeters unless Inches is specified. This keyword only works if /Print is used.
Xsize—Specifies the width of output PV‑WAVE generates. Xsize is specified in centimeters unless Inches is specified.
Yoffset—Specifies the y position on the page of the lower-left corner of output generated by PV‑WAVE. Yoffset is specified in centimeters unless Inches is specified. This keyword only works if /Print is used.
Ysize—Specifies the height of output generated by PV‑WAVE. Ysize is specified in centimeters unless Inches is specified.