Example #1
0
unsigned int iV_GetCountedTextWidth(const char* string, size_t string_length)
{
	float boundingbox[8];
	float pixel_width, point_width;

	glcMeasureCountedString(GL_FALSE, string_length, string);
	if (!glcGetStringMetric(GLC_BOUNDS, boundingbox))
	{
		debug(LOG_ERROR, "Couldn't retrieve a bounding box for the string \"%s\" of length %u", string, (unsigned int)string_length);
		return 0;
	}

	point_width = getGLCPointWidth(boundingbox);
	pixel_width = getGLCPointToPixel(point_width);
	return (unsigned int)pixel_width;
}
Example #2
0
int iV_GetTextBelowBase(void)
{
	float point_base_y = iV_GetMaxCharBaseY();
	float point_bottom_y;
	float boundingbox[8];
	float pixel_height, point_height;

	if (!glcGetMaxCharMetric(GLC_BOUNDS, boundingbox))
	{
		debug(LOG_ERROR, "Couldn't retrieve a bounding box for the character");
		return 0;
	}

	point_bottom_y = boundingbox[1];
	point_height = point_bottom_y - point_base_y;
	pixel_height = getGLCPointToPixel(point_height);
	return (int)pixel_height;
}