Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgextentmultitext.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgextentmultitext.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgextentmultitext.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgextentmultitext.html on line 8

PgExtentMultiText()

Calculate the extent of a multiline text string

Synopsis:

PhRect_t *PgExtentMultiText( PhRect_t *extent,
                             PhPoint_t *pos,
                             char *font,
                             char *str,
                             unsigned n,
                             int linespacing );

Library:

ph

Description:

This function determines the extent that would be occupied if str were rendered at pos, using font (which you should create by calling PfGenerateFontName()). The extent information is stored in the PhRect_t structure pointed to by extent.

The function calculates the extent of the first n characters of the string. To calculate the extent of the entire string, set n to zero. If you pass pos as NULL, it's assumed to be (0,0).

The linespacing is in pixels. A positive linespacing has the obvious effect: increased spacing between lines, and a taller extent. A negative linespacing causes the function to compute an extent for overlapping lines. Larger negative linespacing make the extent decrease in height. The minimum height of the extent is the height of font.

Returns:

The same pointer as extent, or NULL if an error occurred.

Examples:

The following fragment determines the extent of a multiline string drawn in 14-point Helvetica. The characters in neighboring lines overlap by 4 pixels.

PhRect_t extent;
char Helvetica14[MAX_FONT_TAG];

if(PfGenerateFontName("Helvetica", 0, 14, 
                      Helvetica14) == NULL) {
    perror("Unable to find font");
} else {
    if (PgExtentMultiText( &extent, NULL, Helvetica14,
          "First line\nSecond line\nThird line", 0, -4))
        printf( "Width: %d  Height: %d\n", 
                extent.lr.x - extent.ul.x + 1, 
                extent.lr.y - extent.ul.y + 1);
    else
        printf( "Error.\n" );
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PfGenerateFontName(), PgDrawMultiTextArea(), PgDrawTextArea(), PgExtentText(), PhPoint_t, PhRect_t

Text in the Raw Drawing and Animation chapter of the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgextentmultitext.html on line 148

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgextentmultitext.html on line 148