Index

C/C++ Functions

dtGlyphDoTransform

DT_SLONG dtGlyphDoTransform(DT_DTENGINE engine, DT_ID_ULONG glyph_index, DT_FLOAT x, DT_FLOAT y, DT_ID_SWORD flag, DT_SLONG max_points, DT_ID_UBYTE i_arr[], DT_FLOAT x_arr[], DT_FLOAT y_arr[], DT_BMP* memory_bitmap)

Short Description: Scale glyph - floating point version

dtGlyphDoTransformFrac

DT_SLONG dtGlyphDoTransformFrac(DT_DTENGINE engine, DT_ID_ULONG glyph_index, DT_SFRAC_L x, DT_SFRAC_L y, DT_ID_SWORD flag, DT_SLONG max_points, DT_ID_UBYTE i_arr[], DT_SFRAC_L x_arr[], DT_SFRAC_L y_arr[], DT_BMP* memory_bitmap)

Short Description: Scale glyph - fractional version

dtCharDoTransform

DT_SLONG dtCharDoTransform(DT_DTENGINE engine, DT_ID_ULONG char_code, DT_FLOAT x, DT_FLOAT y, DT_ID_SWORD flag, DT_SLONG max_points, DT_ID_UBYTE i_arr[], DT_FLOAT x_arr[], DT_FLOAT y_arr[], DT_BMP* memory_bitmap)

Short Description: Scale character - floating point version

dtCharDoTransformFrac

DT_SLONG dtCharDoTransformFrac(DT_DTENGINE engine, DT_ID_ULONG char_code, DT_SFRAC_L x, DT_SFRAC_L y, DT_ID_SWORD flag, DT_SLONG max_points, DT_ID_UBYTE i_arr[], DT_SFRAC_L x_arr[], DT_SFRAC_L y_arr[], DT_BMP* memory_bitmap)

Short Description: Scale character - fractional version

These functions process a single glyph represented by a Unicode character code (or font dependent glyph index) and retrieve its transformed (scaled) bitmap and/or outline description in pixels units. The glyph is processed by the Typesetter which provides type (e.g. font, transformation, outline expansion), hinting and positioning attributes to the glyph.

The Typesetter processes the outline curve in precisely the same way as in dtGlyphDoOutput or dtCharDoOutput. This means that hinting and outline transformations are preserved. Also, if the retrieved outline description is passed back to D-Type Rasterizer via the dtShapeDoOutput function (and without applying any additional transformations), the resulting 8-bit grayscale bitmap image will look the same as if the glyph was rendered by a direct call to dtGlyphDoOutput or dtCharDoOutput*.

dtGlyphDoTransformFrac is identical to dtGlyphDoTransform except that some of its parameters are 24.8 signed fractional values. Similarly, dtCharDoTransformFrac is identical to dtCharDoTransform except that some of its parameters are 24.8 signed fractional values. For more details on fractional units, see the D-Type Units section of this document.

*Exception: Font outline thickness and expansion are ignored in this case!

Parameters

ParameterDescription

engine

Handle of the previously created Standard Engine instance.

char_code

Unicode character code of the glyph to be processed.

glyph_index

Font dependent index of the glyph to be processed.

x

Glyph's X coordinate in pixels.

y

Glyph's Y coordinate in pixels.

flag

Type of processing to perform. Presently, this can be one of the following:

  • flag = 0 — Only return the glyph's extent.

  • flag = 1 — Return the glyph's extent and its outline description.

  • flag = 2 — Return the glyph's extent and attempt to provide a pointer to its plain 8-bit grayscale memory bitmap. This option is currently not supported but may be implemented in the future.

  • flag = 3 — Return the glyph's extent, its outline description and also attempt to provide a pointer to its plain 8-bit grayscale memory bitmap. This option is currently not supported but may be implemented in the future.

max_points

Specifies the size of the 3-dimensional array into which the function copies the glyph's transformed outline description.

i_arr, x_arr, y_arr

A 3-dimensional array into which the function copies the glyph's transformed outline description.

memory_bitmap

Either a valid pointer to the DT_BMP structure or DV_NULL. If memory_bitmap is a valid pointer to the DT_BMP structure, then the engine will attempt to return information about the glyph's extent (and in the future its plain 8-bit grayscale memory bitmap). If successful, the structure's members will hold the following information:

  • memory_bitmap.m — Presently this function cannot render the bitmap. As a result, this will be set to DV_NULL.

  • memory_bitmap.l — Presently this function cannot render the bitmap. As a result, this will be set to 0.

  • memory_bitmap.w — width of the bitmap/extent in pixels as defined by the DT_BMP structure

  • memory_bitmap.h — height of the bitmap/extent in pixels as defined by the DT_BMP structure

  • memory_bitmap.x — horizontal distance between the bitmap's/extent's left edge and glyph's origin in pixels as defined by the DT_BMP structure

  • memory_bitmap.y — vertical distance between the glyph's origin and bitmap's/extent's top edge in pixels as defined by the DT_BMP structure

If you do not wish to retrieve information about the glyph's extent, simply set memory_bitmap to DV_NULL.

Return Value

If successful, the function returns the actual number of points needed for the outline description. Otherwise, the return value is -1.

If the 3-dimensional array is not large enough to accept all the outline points (i.e. max_points is less than the return value, the function copies only the first max_points elements into the 3-dimensional array (i.e. the array will be truncated). In this case, your application can increase the size of the 3-dimensional array and call this function again with the updated value for max_points.

Note: Recommended value for max_points is 500.

Comments

The i_arr array contains instructions that describe the corresponding pair of coordinates in the x_arr and y_arr arrays. Possible values for i_arr are:

The following table describes how the 3-dimensional array should be interpreted. Please note that Quadratic B-Spline curves require two consecutive rows in the 3-dimensional array while Bézier curves require three consecutive rows.

i_arr x_arr y_arr
New Contour

16

X1 in pixels

Y1 in pixels

Line

20

X1 in pixels

Y1 in pixels

Quadratic B-Spline Curve

25

X1 in pixels

Y1 in pixels

n

X2 in pixels

Y2 in pixels

Bézier Curve

24

X1 in pixels

Y1 in pixels

n

X2 in pixels

Y2 in pixels

0

X3 in pixels

Y3 in pixels

Note: n = recommended number of curve segments

 

Index