Print near letter-quality multi-font documents and replace supplies less often. Powerful printheads last up to 300 million characters and re-inking ribbons that print up to 8 million characters are available.
Powerful print heads print up to 300 million characters and a robust mean time between failure of 12,500 POH*. 2MB of built-in flash memory for expanded bar code support, non-volatile fonts and remote management.*Power-on hours rated at 25 percent duty cycle
Loading ribbons and installing media options takes just seconds. The new operator panel gives easy access to all printer functions, with WYSIWYG font indicators. Get remote access to character and page counts to monitor supplies and page usage.
The fonts that are in printers can sometimes be useful and difficult to use in application program code. This article describes how to determine which printer-resident device fonts are available for use in a Win32 printer device context. The article also describes several problems that can happen when you try to use those printer fonts in application code.
In most cases, a software developer relies on the operating system to provide the fonts that will be used for its drawing. To do this, you can select an operating system-supplied font through the application programming interface (API) or through the common Choose Font dialog box. However, the application is typically not concerned with the particular font that is used, only it meets certain requirements and the user prefers the font. These requirements include:
Typically, when the application prints the document, the font (or a font that is similar to it) is used on the printer without any particular action from the application. This is generally the correct result for the application, and this produces good printed results at reasonable speeds.
However, sometimes an application developer may have to select only a certain font specifically from a target printer. Historically, this was necessary on impact-type printers (for example, dot-matrix printers) to obtain certain formatting or to speed up the printing.
Today, most printers are fundamentally designed as raster devices and can draw a dot (a pixel) on any part of the paper as efficiently as all of a character glyph. For most applications, it isn't an issue whether a character glyph is drawn as a whole form from a printer-resident definition or is drawn as a collection of pixels that the operating system provides. However, you may still want to use a font that only the printer provides. For example, this may occur because the font is unique and has no similar substitute in the operating system or perhaps because you want to avoid the overhead of downloading a font definition to the printer.
For the purposes of this article, device fonts are any fonts whose definition exists either permanently or transiently in the printer's memory. These device fonts provide a character glyph definition that can be addressed per character by the printer's page rasterizer hardware to ink the shape onto paper.
The operating system provides downloadable fonts, which are also known as soft fonts. When you print a document, the definition for the font is provided as part of the print job. When the printer processes the print job, the font definition is installed in the printer memory so that the font definition can be inked onto the printed page of the document.
Some argue that because the printer is drawing the character glyphs of the font, these fonts are device fonts. However, when a font definition is downloaded or when a glyph is drawn onto the printer through a bitmap, only some overhead or print job spool size is saved. This process occurs transparently to the application so that the font in the operating system can be used on the screen and on the printer. Because this article focuses on how to use device fonts that only the printer provides, this article doesn't describe how to use downloadable fonts.
Device font substitution occurs when there are two, distinct font definitions: one that the operating system uses, and one that the printer uses. That is, an application selects and uses a font in the operating system in a document on the screen. When you print the document, the printed output is drawn by using the similarly defined font that the printer provides. Therefore, the font in the operating system has been substituted on the printer with the printer-defined font.
This typically occurs on PostScript printers when a common Windows TrueType font is used. An example of this is the TrueType Arial font that is typically printed by using the PostScript font definition for the Helvetica font on most PostScript devices. This is an example of a substitution by using a similar font whose font name is different. In this case, you can typically find and use this similar font definition directly because the similar font definition is also exposed as a true device font. This is discussed later in this article.
Device font substitution also occurs when the font on the printer has the same name as the font that the operating system provides. This typically occurs on printers such as Hewlett-Packard LaserJet printers. Those printers typically have their own versions of the Windows core fonts such as Arial and Times New Roman. Although these fonts can also typically be found by looking for true device fonts, their use sometimes cannot be guaranteed because the printer drivers frequently select on their own or select through user settings whether to use the font that the operating system provides instead.
True device fonts are those that only have a definition on the printer. The only way that an application can use these fonts is for the application to specifically identify the font and to create it for use in the printer device context.
If you know enough information about a device, you can create a logical font description in a LOGFONT structure that will result in the realization of the device font. In particular, it is important to provide the correct information for the lfFacename member, the lfHeight member, and the character set of the font. Also, the lfOutPrecision member should contain an OUT_DEVICE_PRECIS flag to influence the font-mapping process to choose device fonts instead of similarly named system fonts.
If the description of the font isn't known, you can enumerate fonts to discover device fonts. To obtain a list of device fonts that the printer supports, use one of the font enumeration functions such asEnumFontFamiliesEx. Application code that is put in the callback function can examine the data that is handed to the callback function to determine which font instances describe a device font.
To enumerate all of the fonts that are available in a device context, you can use callback functions and the EnumFontFamiliesEx function from the Win32 application programming interface (API). To enumerate all of the fonts for a device context, you must call EnumFontFamiliesEx two times: first to get a list of font families, and a second time to get all of the distinct fonts that are in each font family.
To find all of the device fonts on a printer device context, you must enumerate all of the fonts of the printer device context. When each font is passed to the callback functions, the font is examined to determine if it is a device font. The PrinterDeviceFontEnum andPrinterDeviceFontFamiliesEnum callback functions in the following sample code perform this operation.
PrintDeviceFontList is the top-level function. PrintDeviceFontList performs two tasks by starting a print job on the printer device context and then invoking the first call to EnumFontFamiliesEx to start the font enumeration process. According to the Platform Software Development Kit (SDK) documentation, when you set the LOGFONT structure's lfCharSet member to the DEFAULT_CHARSET value, EnumFontFamiliesEx enumerates all of the font families. After the font enumeration is complete, the code completes the print job management task by calling the EndDoc method.
The PrinterDeviceFontFamiliesEnum callback function is called for each font family by the EnumFontFamiliesEx function. In that callback function, the code initially screens the font families to find only the device fonts that are marked by the FontType parameter. It also screens out any fonts that are marked as TrueType because those fonts are likely to be downloadable fonts. For those font families that are considered device fonts, the EnumFontFamiliesEx function is called again but is passed the ENUMLOGFONTEX structure that the callback function received. The use of the callback parameter as the input parameter to the second enumeration function call causes the second enumeration to list all of the distinct fonts in that font family.
You can use certain criteria of printer device fonts to distinguish these fonts from any other font that is enumerated. Specifically, look for the DEVICE_FONTTYPE value in the FontType callback function's DWORD parameter. Almost all of the fonts that are handed to the callback function with this value set are device fonts for the printer device context (except with Adobe fonts).
In the sample code, the PrinterDeviceFontEnum callback function is called by the second enumeration for each distinct font in the font family. The PrinterDeviceFontEnum callback function performs three tasks:
Prints a sample of the font onto the print job that is being created to demonstrate the use of the font. This callback function uses a function named IsSystemFont, which is part of the following sample code:
This function detects when a font that is marked as a device font but isn't a true device font (according to the definition in this article). This occurs when Adobe fonts are installed into the system through either the Adobe Type Manager or through the native Adobe rasterizer that is present in Windows 2000 or Windows XP.
When this occurs, the font is really a system-supplied font that is downloaded to the printer, which sometimes occurs with TrueType fonts. Unfortunately, there is no flag that you can use across Windows 98, Windows Millennium Edition (Me), Windows 2000, and Windows XP that indicates that the font is an Adobe font that the system provides (unlike TrueType fonts, which include a flag). There is an indication in the NEWTEXTMETRIC structure's ntmFlags member, but this is only available in Windows 2000 and later. Therefore, the code must resort to a process of elimination. The font is removed when IsSystemFontdetermines that the device font is provided by both the screen device context and the printer device context. 2b1af7f3a8