These functions provide essential metrics for a single glyph represented by a Unicode character code (or font dependent glyph index).
Parameter | Description |
---|---|
engine |
Handle of the previously created Standard Engine instance. |
font_index |
Font index of the font or font instance in the Font Catalog. |
char_code |
Unicode character code of the glyph. |
glyph_index |
Font dependent index of the glyph. |
advance_width |
A valid pointer to the DT_UWORD type that will receive the advance width of the glyph in font units. However, if you do not wish to receive the value of the above parameter, you may set this pointer to DV_NULL. |
extent |
A pointer to the DT_RECT_SWORD structure that will receive the glyph's extent. This is the minimum (x, y) and maximum (x, y) coordinate for the glyph in font units. If you do not wish to receive this information, you may set the extent pointer to DV_NULL. Otherwise, this must be a valid pointer to the DT_RECT_SWORD structure. See the comments below for additional details. |
The return value is 1 if the function was successful. Otherwise, the function returns 0.
As mentioned above, the glyph's extent represents its minimum (x, y) and maximum (x, y) coordinate. This calculation, however, takes into account only control points that define the glyph's outline description and not the glyph's outline itself. Since the control points can be either on-curve or off-curve points, the extent returned by this function may not be the glyph's smallest possible enclosing box. Generally, the returned extent will be either the glyph's smallest possible enclosing box or it will be its very close approximation (i.e. slightly bigger). In either case, applications can be certain that the extent returned by this function will always fully enclose the referenced glyph. For well constructed glyphs (glyphs in which the control points are placed at most horizontal or vertical extremes), this box will always be their smallest possible enclosing box.
The advance width returned by this function is copied directly from the font file. Therefore, its accuracy depends on how accurately this information is stored in the font file itself.