D-Type Font Engine is by far the most complex component of D-Type Engine. Its function is to manage fonts and font instances, provide applications with font information in a manner that is independent of the underlying font format, and render glyphs within the fonts to the output surface of the application's choice. In this process, colors and, optionally, advanced style effects are applied.
D-Type Font Engine consists of the following main components:
The visual appearance of any glyph rendered by D-Type Font Engine depends on several parameters. The most important ones are described below:
Character code (Unicode) or, alternatively, font dependent glyph index uniquely identifies the glyph to be rendered. Applications can use dtCharDoOutput to draw glyphs by their Unicode character code or dtGlyphDoOutput to draw glyphs by their font dependent glyph index.
Style is a set of style properties that are applied to the glyph during rendering. These include: color, transparency and various special effects such as shadow, glow, pattern fill, emboss, blur, emboldening etc. D-Type Engine uses the Output object to hold information about the current style. See the dtOutputSetStyleAttribs and dtOutputSetStyleEffects functions for details.
Type is a set of typographical properties that are applied to the glyph during rendering. These include: font, transformation (size, skew, rotation, etc.) and outline appearance (normal, outlined, dilated). D-Type Engine uses the Typesetter object to hold information about the current type. See the dtTypesetterSetTypeAttribs, dtTypesetterSetTypeEffects and dtTypesetterSetTypeEffectsTransformed functions for details.
Position defines the placement of the glyph on the screen or other output surface. This is simply the (X, Y) coordinate of the glyph's origin point. Two identical glyphs that have a different location on the screen might have slightly different bitmap images due to different sub-pixel offsets. Positioning can be controlled by calling the dtTypesetterSetPositioning and dtTypesetterSetSubpixels function.
Hinting has impact on how the glyph's outline interacts with the pixel grid during the rasterization process. Different hinting modes will produce different bitmap images. The desired hinting mode can be specified by calling the dtTypesetterSetHinting function.
A typical life cycle of an application that relies on D-Type Font Engine is briefly summarized in the following table:
Step | Function |
---|---|
1. Initialize D-Type Engine | dtEngineIniViaStream |
2. Add (additional) font(s) to the Font Catalog | dtFontAddViaStream, dtFontAddViaStreams |
3. Obtain font information (optional) | dtFontGetSysStatus, dtFontGetMetrics, dtFontGetMMAxisInfo, dtFontGetStringValue, dtFontGetNumericValue |
4. Add additional font instances to the Font Catalog (optional for multiple-master and variable fonts) | dtFontAddAsMMInstance |
5. Set destination surface (D-Type's Memory Surface or Windows Device Context) and its clipping region to the Output | dtOutputSetAsMDC, dtOutputSetAsHDC |
6. Select a style to the Output. | dtOutputSetStyleAttribs or dtOutputSetStyleEffects |
7. Select a type to the Typesetter. | dtTypesetterSetTypeAttribs or dtTypesetterSetTypeEffects |
8. Draw glyphs or text | dtGlyphDoOutput, dtCharDoOutput dtxGlyphsDoOutput, dtxCharsDoOutput, dtxGlyphsDoOutput_Arc, dtxCharsDoOutput_Arc |
9. Deinitialize D-Type Engine | dtEngineExt |
Please note that the above table only identifies the most important steps and functions. Your application might need additional steps and/or functions.