Ejemplo n.º 1
0
void
vsBuiltInFont::BuildDisplayListFromCharacter( vsDisplayList *list, char c, float size, float capSize )
{
	char thisChar = c;
	float thisSize = size;

	if ( thisChar == ' ' )
	{
		// half width spaces, because that looks better.
		thisSize *= c_spaceKerning;
	}
	else if ( IsCap(thisChar) )
	{
		thisSize = capSize;
	}

	AppendCharacterToList( thisChar, list, vsVector2D::Zero, thisSize );
}
Ejemplo n.º 2
0
void
vsBuiltInFont::BuildDisplayListFromCharacter( vsDisplayList *list, char c, float size, float capSize )
{
	char thisChar = c;
	char upperChar = toupper(thisChar);
	float thisSize = size;
	
	if ( thisChar == ' ' )
	{
		// half width spaces, because that looks better.
		thisSize *= c_spaceKerning;
	}
	else if ( upperChar >= 'A' && upperChar <= 'Z' && thisChar == upperChar && capSize > 0.f )
	{
		thisSize = capSize;
	}
	
	AppendCharacterToList( thisChar, list, vsVector2D::Zero, thisSize );
}
Ejemplo n.º 3
0
void
vsBuiltInFont::BuildDisplayListFromString( vsDisplayList *list, const char *string, float size, float capSize, JustificationType j )
{
	vsVector2D offset = vsVector2D::Zero;
	size_t len = strlen(string);
	
	if ( j != Justification_Left )
	{
		float width = GetStringWidth(string, size, capSize);
		
		if ( j == Justification_Right )
			offset.Set(-width, 0.f);
		if ( j == Justification_Center )
			offset.Set(-(width*0.5f), 0.f);
	}
	
	for ( size_t i = 0; i < len; i++ )
	{
		char thisChar = string[i];
		char upperChar = toupper(thisChar);
		float thisSize = size;
		
		if ( thisChar == ' ' )
		{
			// half width spaces, because that looks better.
			thisSize *= c_spaceKerning;
		}
		else if ( upperChar >= 'A' && upperChar <= 'Z' && thisChar == upperChar && capSize > 0.f )
		{
			thisSize = capSize;
		}
		
		offset.x += c_kerningFactor * thisSize;
		AppendCharacterToList( string[i], list, offset, thisSize );
		offset.x += c_kerningFactor * thisSize;
	}
}