Easeljs bitmap text for fonts
Printer devices use fonts
- 20 minutes to read
The fonts in printers can sometimes be useful and difficult to use in application program code. This article describes how to determine which printer fonts are available for use in a Win32 printer device context. The article also describes some problems that you may encounter when you try to use these printer fonts in your application code.
Original version of the product: Win32 printer device
Original KB number: 201978
In most cases, a software developer needs the operating system to provide the fonts that will be used in the drawing. You can do this through the application programming interface (API) or the dialog box Select a font select a font provided by the operating system. However, the application is usually not concerned with the particular font that is being used, only it meets certain requirements and the user prefers the font. These requirements include the following:
- The font must be a certain size.
- Font must contain characters (otherwise called glyphs).
- The font must have a specific style.
Typically, when the application prints the document, it uses the font (or a similar font) on the printer with no specific action from the application. This is usually the correct result for the application and will produce good printed results at a reasonable speed.
However, sometimes an application developer may just need to select a particular font that is specific to a target printer. Historically, this was necessary for impact-type printers (e.g. dot-matrix printers) in order to obtain certain formatting or to speed up printing.
Today most printers are basically designed as raster devices and can draw a point (pixel) on any part of the paper as efficiently as any character glyph. For most applications, it is not a problem whether a character symbol is drawn as a whole form from a printer-resident definition or drawn as a collection of pixels provided by the operating system. However, you may still want to use a font that is only provided by the printer. This could indicate, for example, that the font is unique and has no similar replacement in the operating system, or maybe because you want to avoid the overhead of downloading a font definition to the printer.
For the purposes of this article, device fonts are fonts whose definition resides in the printer's memory, either permanently or temporarily. These device fonts provide a character symbol definition that can be addressed per character by the printer's raster module hardware to reveal the shape on paper.
Device fonts can be categorized into three basic types:
True device fonts. For the purposes of this article, we are talking about fonts that are only supplied by the printer hardware and that you can only use on the printer.
Device font replacement. Fonts that exist in the operating system and are also provided by the printer hardware. In this case, the printer hardware can replace the operating system fonts.
Downloadable fonts. Fonts supplied by the operating system, but whose definition can be downloaded to the printer and used on the printer as if the printer hardware supplied the fonts directly.
The operating system offers downloadable fonts, also known as soft fonts. When you print a document, the font definition is provided as part of the print job. When the printer processes the print job, the font definition is installed in printer memory so that the font definition can be printed on the printed side of the document.
Some argue that because the printer draws the character symbols of the font, those fonts are device fonts. However, when a font definition is downloaded or a glyph is drawn over a bitmap on the printer, only a certain size is saved for the overhead or print job spool. This process is transparent 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 using device fonts that are only provided by the printer, this article does not describe how to use downloadable fonts.
Device font replacement
Device font substitution occurs when there are two different font definitions: one used by the operating system and one used by the printer. This means that 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 using the similarly defined font that the printer provides. Therefore, the font in the operating system has been replaced by the printer-defined font on the printer.
This usually occurs with PostScript printers when a common Windows TrueType font is used. An example of this is the Arial TrueType font, which is typically printed on most PostScript devices using the PostScript font definition for the Helvetica font. This is an example of a substitution using a similar font with a different font name. In this case, you can usually search for and use this similar font definition directly, since the similar font definition is also made available as a real device font. This is explained later in this article.
Device font substitution also occurs when the font on the printer has the same name as the font provided by the operating system. This usually occurs on printers such as Hewlett-Packard LaserJet printers. These printers usually have their own versions of the Windows core fonts such as Arial and Times New Roman. Although these fonts can usually also be found by searching for true device fonts, their use can sometimes not be guaranteed, as the printer drivers often make their own choices or choose via user settings whether the font provided by the operating system should be used.
True device fonts are those that have only one definition on the printer. The only way an application can use these fonts is for the application to specifically identify the font and 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 structure that leads to the realization of the device font. In particular, it is important to provide the correct information for the element, element, and character set of the font. The element should also contain a flag that affects the font mapping process to select device fonts instead of similarly named system fonts.
If you don't know the font description, you can enumerate fonts to identify device fonts. To get a list of the device fonts supported by the printer, use one of the font enumeration functions such as. Application code that is placed in the callback function can examine the data that is passed to the callback function to determine which font instances describe a device font.
Use real device fonts
The process of using a device font in a printer device context follows these general steps:
- Identify the actual device fonts by enumerating the fonts in a printer device context.
- Select fonts that are device-based only, as indicated by the flags and by elimination procedures.
- Use printer-specific metrics in mapping mode to accurately place the text drawn using the device font.
Enumerate the fonts of a printer device context
You can use callback functions and the Win32 application programming interface (API) function to enumerate all of the fonts available in a device context. To enumerate all the fonts for a device context, you must invoke twice: first to get a list of font families and a second time to get all the different fonts in each font family.
To find all device fonts in a printer device context, you must list all the fonts in the printer device context. When each font is passed to the callback functions, the font is checked to see if it is a device font. The and callback functions in the following sample code do this.
You can see in the sample code where the function is called twice. The first call is made in the function. The second call is in the callback function.
is the top-level function. performs two tasks by starting a print job in the printer device context and then making the first call to start the font enumeration process. The documentation for the Platform Software Development Kit (SDK) indicates when you set the structure of the structure to List All Font Families. After the font enumeration is complete, the code completes the job to manage print jobs by calling the method.
The callback function is called by the function for each font family. In this callback function, the code initially checks the font families to find only the device fonts marked with the parameter. It also shows any fonts marked as because those fonts are likely to be downloadable fonts. For these font families, which are considered device fonts, the function is called again, but the structure given by the callback function is passed. The use of the callback parameter as an input parameter for the second enumeration function call has the effect that the second enumeration lists all the different fonts in this font family.
Select device fonts
You can use certain printer device font criteria to distinguish these fonts from any other font that is enumerated. In particular, look for the value in the DWORD parameter of the callback function. Almost all fonts passed to the callback function with this specified value are device fonts for the printer device context (except for Adobe fonts).
In the sample code, the callback function is called from the second enumeration for each different font in the font family. The callback function performs three tasks:
Reuses the device font criteria to ensure that the function only processes fonts that are recognized as device fonts.
Searches for the font by using a different font enumeration to determine if the device font is also used in the system's Device Context screen.
Prints a sample of the font on the print job created to demonstrate how to use the font. This callback function uses a function called that is part of the following sample code:
This feature detects when a font that is marked as a device font is not a real device font (as defined in this article). This occurs when Adobe fonts are installed on the system through the Adobe Type Manager or through the native Adobe Rasterer that is present in Windows 2000 or Windows XP.
If so, the font is really a system-supplied font that is downloaded to the printer, which is sometimes what happens with TrueType fonts. Unfortunately, there is no label to use in Windows 98, Windows Millennium Edition (Me), Windows 2000, and Windows XP, which indicates that the font is a system-provided Adobe font (as opposed to TrueType fonts that contain a flag). There is a note in the structure of the structure, but this is only available in Windows 2000 and higher. Hence, the code has to resort to an elimination process. The font is removed when the device font is provided by both the Device Context screen and the Printer Device Context.
To avoid repeating examples of a font that is being scaled, the code also notes when a candidate font has already been used. Which implementation depends on the enumeration order of the fonts to see when sequential enumeration of a font is the same font but at a different scale. The code uses the function to remove fonts that are simply scaled differently.
The documentation for programming Windows operating systems does not state that font instances that differ only in terms of scaling are listed one after the other. The code example uses this method because that is how the enumeration works, and reducing the number of sample lines on the printed page is not an important feature of the demo code. If you want to rely on the elimination of different scales of the same font, you need to maintain a data structure of the device fonts used. The program then has to check the currently enumerated font using this data structure.
Scalable vs. bitmap fonts
There are two types of device fonts that can be listed on printers:
- Bitmap or raster fonts
- Scalable fonts
Bitmap fonts are fonts that have the definition of a character symbol of a fixed size. Scalable fonts are fonts that have a math-based definition in the printer so they can be drawn at any size. In other words: the size is scaled.
The classic example of a bitmap font is Courier 10 characters per inch (CPI). As the name suggests, this font is on hold from the transition from typewriters to impact-type printers. It is known as a bitmap font because the most common definition of the font was in a bitmap ROM image from a dot-matrix printer.
Examples of scalable, printer-resident fonts can be found in most PostScript printers, which typically have a standard set of PostScript fonts such as Helvetica and Times.
Non-scalable device fonts have a bit that is defined in the parameter of the callback function. This bit is represented by the symbol in the SDK. If the parameter for the callback function is not specified, the font is a scalable font. For an example of how to determine this, see the callback function of the sample code.
Drawing the device fonts
After fonts that are used as device fonts are found, the example uses them in the printer device context in which the enumeration was made. Device fonts are used similarly to other fonts in that a logical description is created with the function. This function call is passed to the one that was passed to the callback function for the font enumeration. After the has been created, it is used in the device context of the printer by selecting it with the function call in the device context.
Metrics for the device font are obtained from the function call. It is recommended that you work on print device contexts using the mapping mode, which is the default mapping mode for a device context. By using the mapping mode, you avoid math errors that can occur during the units conversion process of other mapping modes.
When using a device font in a printer device context, be careful not to transport the metrics for the font and character strings to other device contexts. This is especially true for storage device contexts.By definition, a storage device context is not the print job, but a temporary memory buffer with raster graphics and therefore cannot use a device font.
There is another important consideration when using printer fonts: you cannot provide a What-You-See-Is-What-You-Get-type preview for the print job. Fonts residing in the printer hardware cannot be drawn on the screen. The closest thing to getting a preview of the print job is to find a system-supplied font that has the general characteristics of a printer device font, and then draw the glyphs of that font on the screen by using the feature to locate the Signs simulate symbols on the printed page.
Problems using device fonts
The following problems can occur when using device fonts:
There is a device font, but the printer driver doesn't list it.
There are two reasons why you cannot find a device font by listing the fonts available to a printer device context:
- The printer driver was written to exclude this device font for some reason.
- The printer driver lists the font, but the font is not properly marked as device font in the parameter.
There are system fonts that appear to be listed as device fonts.
This problem occurs when a system-supplied font is downloaded to a printer.
If this is the case with TrueType fonts, the callback function of the font enumeration receives a call with the and the bits that were specified for the parameter. This is covered in the sample code by not including fonts that contain these combinations of bits.
This also happens with Adobe PostScript fonts installed in the system that are downloaded to the printer. One way to distinguish these fonts from the other device fonts is to find them in both a system screen device context and a printer device context. If the same font can be listed in both device contexts, the font may be downloaded to the printer when used in the printer device context.
My printer driver lists several scalable device fonts, but these are shown except for their size.
Many printer drivers number a scalable font by providing several different instances of the same font with different sizes. This is covered in the sample code by comparing the different instances of these fonts that are believed to be scalable using the function.
When the parameter for the callback function is set, the multiple bullets provide descriptions of specific instances of the non-scalable fonts for each size. Each callback lists the only sizes this font is available in.
Some printers do not appear to have device fonts.
That's true. Some printers, namely inkjet printers, do not provide device fonts. These printers are raster devices only and therefore do not have printer-resident font definitions.
- How do I install Reason 5 without a DVD
- How long is the Moneypak funding delay?
- Who fights ufc 162 fully
- Logan Howlett Tumblr Wallpaper
- Actiontec screenbeam mini2 how to connect
- Vw Kaefer screeching noise while driving a car
- Deactivate WhatsApp Nokia 500
- How many deaths in Hershey Park
- Mason jars Philippines wholesale products
- How to open ptab780
- Kamila wojciechowska maxmodels model
- How does the GPS vehicle tracker work
- Somehow wrong ppl chords in the key
- Burning pain in the thigh when sitting
- Philippe gohier massage everywhere
- Alexander Henry Fabric UK Wholesale Directory
- What does the Korean word hyung mean
- Talitha getty how did she die
- Inductosyn in cnc what is programmed
- How often to use miracle balm
- Who has viewed my instagram has paid apk
- Decemberists, what a terrible world Tracklist 101
- How to catch tancho koi sims 3
- Aerial photography Young actor who played