glcGetStringCharMetric(3G) OpenGL Character Renderer
NAMEglcGetStringCharMetric - retrieve character metric from measurement
buffer
C SPECIFICATION
GLfloat* glcGetStringCharMetric( GLint inIndex,
GLCenum inMetric,
GLfloat *outVec )
PARAMETERS
inIndex Specifies which element in the string to measure.
inMetric Specifies the metric to measure, either GLC_BASELINE or
GLC_BOUNDS.
outVec Specifies a vector in which to store value of inMetric for the
specified character.
DESCRIPTIONglcGetStringCharMetric retrieves a character metric from the GLC
measurement buffer and stores it in outVec. To store a string in the
measurement buffer, call glcMeasureCountedString or glcMeasureString.
The position of the character to measure is specified by inIndex. The
metric, either GLC_BASELINE or GLC_BOUNDS, is specified by inMetric.
If the command does not raise an error, its return value is outVec. If
inMetric is GLC_BOUNDS, the vector returned in outVec starts in the
lower left corner and continues in a counterclockwise direction.
EXAMPLES
The following example first calls glcMeasureString to store the string
"hello" in the measurement buffer. It then retrieves both the baseline
and the bounding box for the whole string, then for each individual
character.
GLfloat overallBaseline[4];
GLfloat overallBoundingBox[8];
GLfloat charBaselines[4][5];
GLfloat charBoundingBoxes[8][5];
GLint i;
glcMeasureString(GL_TRUE, "hello");
glcGetStringMetric(GLC_BASELINE, overallBaseline);
glcGetStringMetric(GLC_BOUNDS, overallBoundingBox);
Page 1
glcGetStringCharMetric(3G) OpenGL Character Renderer
for (i = 0 ; i < 5 ; ++i) {
glcGetStringCharMetric(i, GLC_BASELINE, charBaselines[i]);
glcGetStringCharMetric(i, GLC_BOUNDS, charBoundingBoxes[i]);
}
NOTESglcGetStringCharMetric is useful if you're interested in the metric of a
character as it appears in a string, that is, influenced by kerning,
ligatures, and so on. To measure a character as if it started at the
origin, call glcGetCharMetric.
ERRORS
GLC_PARAMETER_ERROR is generated if inIndex is less than zero or is
greater than or equal to the value of the variable
GLC_MEASURED_CHAR_COUNT.
SEE ALSO
glcGetCharMetric, glcGetMaxCharMetric, glcMeasureCountedString,
glcMeasureString
Page 2