Index

C/C++ Functions

dtGlyphGetMetricsPlus

DT_SWORD dtGlyphGetMetricsPlus(DT_DTENGINE engine, DT_ID_SWORD font_index, DT_ID_ULONG glyph_index, DT_ADVANCE* advance, DT_RECT_SWORD* extent, DT_SWORD reserved)

Short Description: Get glyph metrics - horizontal and vertical

dtCharGetMetricsPlus

DT_SWORD dtCharGetMetricsPlus(DT_DTENGINE engine, DT_ID_SWORD font_index, DT_ID_ULONG char_code, DT_ADVANCE* advance, DT_RECT_SWORD* extent, DT_SWORD reserved)

Short Description: Get character metrics - horizontal and vertical

These functions provide horizontal and vertical metrics for a single glyph represented by a Unicode character code (or font dependent glyph index).

Parameters

ParameterDescription

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

A pointer to the DT_ADVANCE structure that will receive the horizontal and vertical origin, advance width and advance height of the glyph in font units.

However, if you do not wish to receive this information, you may set the advance pointer to DV_NULL. Otherwise, this must be a valid pointer to the DT_ADVANCE structure.

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.

Return Value

The return value is 1 if the function was successful. Otherwise, the function returns 0.

Comments

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 vertical origin, advance width and advance height returned by this function are copied directly from the font file. Therefore, their accuracy depends on how accurately this information is stored in the font file itself. The horizontal origin of the glyph will always be returned as 0.

 

Index