ufmGetCharMetrics(3w) ufmGetCharMetrics(3w)
ufmGetCharMetrics - get character metrics by character code
#include <ufm.h>
int ufmGetCharMetrics(unsigned int nTypefaceHandles,
unsigned int *typefaceHandles, int charCodeType,
unsigned int nCharCodes, void *charCodes,
unsigned int *nCharMetrics, ufmCharMetrics **charMetrics)
ufmGetCharMetrics gets the scalable metrics for specified character codes
from font metric files. If ufmGetCharMetrics does not find the metrics
for a specified character code, it returns the metrics for the default
character. Set nCharCodes to 0 if you want to get character metrics for
all characters in a specified typeface.
You can get scalable character metrics only for those typefaces which
have the flag scalableMetrics set to 1 in their ufmTypeface data
structures, that is, for those typefaces for which font metric files were
found.
nTypefaceHandles specifies the number of entries (typeface handles) in
the array typefaceHandles.
typefaceHandles specifies one or more handles for open typefaces. Use
the function ufmOpenTypeface to open a typeface, and get a handle for
that typeface.
If you specify more than one typeface handle, ufmGetCharMetrics will find
the font metric files for specified typefaces. Then it will look for the
scalable metrics data for a specified character in the font metric file
for the first specified typeface. If it does not find that data in that
file, it will look for that data in the next font metrics file. It will
stop looking as soon as it finds the requested character metrics data.
If it cannot find that data for a specified character, it will return the
metrics data for the default character. If ufmGetCharMetrics cannot find
the metrics data even for the default character, it will return an error
code.
charCodeType specifies a 1-byte character code (UFM_BYTE1), a Unicode
UCS-2 code (UFM_UCS2), a Unicode UCS-4 code (UFM_UCS4), a 2-byte
character code (UFM_BYTE2), or a 4-byte character code (UFM_BYTE4).
nCharCodes specifies the number of elements in the array charCodes. Set
nCharCodes to 0 if you want character metrics data for all characters in
a specified typeface. If you want character metrics data for only some
characters, use the array charCodes to specify the character codes of
those characters.
Page 1
ufmGetCharMetrics(3w) ufmGetCharMetrics(3w)
ufmGetCharMetrics stores the character metrics data it finds into an
array of data structures of the type (ufmCharMetrics). Then it returns
the number of entries (nCharMetrics) in that array and the address of
that array (charMetrics).
When you are finished with the array (charMetrics), you can free it by
calling ufmFreeCharMetrics with the argument values that were returned by
ufmGetCharMetrics.
All scalable metrics values provided by ufmGetCharMetrics are specified
in ems. You can scale such values to an appropriate point size by using
the formula:
scaled value = scalable-value x point-size x resolution / 72.0
You can scale such values to an appropriate pixel size by using the
formula:
scaled-value = scalable-value x pixel-size
The character advance width in pixels for a given resolution can be
calculated from the scalable character advance width in ems by using the
formula:
advance-width = scalable-advance-width x point-size x resolution / 72.0
The result is usually rounded to the nearest pixel.
ufmFreeCharMetrics(3w), ufmGetCharMetricsByName, ufmOpenTypeface(3w).
If ufmGetCharMetrics is not able to allocate the memory it needs, it will
return the value UFM_OUT_OF_MEMORY. If the values of one or more
arguments are not valid, ufmGetCharMetrics will return the value
UFM_INVALID_VALUE. UFM_OUT_OF_MEMORY and UFM_INVALID_VALUE are defined
in the header file <ufm.h>.
PPPPaaaaggggeeee 2222 [ Back ]
|