PfFractionalExtentText()

Calculate the extent rectangle of a text string, using fractional scaling

Synopsis:

#include <photon/Pf.h>
PhRect_t *PfFractionalExtentText(
             PhRect_t *extent,
             PhPoint_t const *pos,
             const char *font,
             long xsize,
             long ysize,
             const char *str,
             int len );

Arguments:

extent
A pointer to a PhRect_t structure where the function stores the string's extent. For the interpretation of the members of this structure, see below.
pos
NULL, or a pointer to a PhPoint_t structure that defines an offset that you want to apply to the extent.
font
The base font to use when calculating the extent. You should create this argument by calling PfGenerateFontName().
xsize, ysize
The size of the font in 16.16 fixed-point format.
str
The UTF-8 multibyte string whose extent you want to determine.
len
The number of bytes in the string. If len is 0, PfExtentText() assumes that it's strlen(str).

Library:

ph

Description:

This function calculates the extent rectangle of a text string. The base font determines the ascender and descender values of the extent. The xsize and ysize arguments define the size of the font in 16.16 fixed-point format.


Note: This function is intended to be used with scalable fonts. If a bitmap font is provided, an attempt is made to map the font to a scalable equivalent, though success isn't guaranteed.

PfFractionalExtentText() stores the text extent in the PhRect_t pointed to by extent. The members are used as follows:

ul.x
The left bearing.
lr.x
The maximum x distance.
ul.y
The ascender.
lr.y
The descender.

The baseline of the font is at position y=0; the width of the string is lr.x - min(ul.x, 0) + 1. The height of the string is lr.y - ul.y + 1.

If metrics for the base font have been loaded locally (see PfLoadMetrics()) then this extent may be calculated internally; otherwise a request is sent to the font server.

Returns:

A pointer to the extent rectangle (extent) if successful, NULL otherwise.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PfExtent(), PfExtentCx(), PfExtentText(), PfExtentTextToRect(), PfGenerateFontName(), PfLoadMetrics(), PgExtentText(), PhPoint_t, PhRect_t

Fonts chapter of the Photon Programmer's Guide