void vsBuiltInFont::AppendCharacterToList( char c, vsDisplayList *list, const vsVector2D &offset, float size ) { int index = lookup_letterIndex(c); if ( index >= 0 ) { int *strokes = st_nick53[index]; int z = 0; bool inLineStrip = false; while ( strokes[z] >= 0 ) { int newVertID = strokes[z++]; if ( newVertID == 0 ) { inLineStrip = false; } else { if ( inLineStrip ) { list->LineTo( offset + (size * (P[newVertID]-baseline)) ); } else { list->MoveTo( offset + (size * (P[newVertID]-baseline)) ); inLineStrip = true; } } } } }
void vsBuiltInFont::BuildDisplayListFromString( vsDisplayList *list, const char *string, float size, float capSize, JustificationType j, const vsVector2D &offset_in ) { vsVector2D offset = offset_in; size_t len = strlen(string); if ( j != Justification_Left ) { BuildDisplayListFromString(list, string, size, capSize, Justification_Left); float width = GetDisplayListWidth(list); if ( j == Justification_Right ) offset.x = -width; if ( j == Justification_Center ) offset.x = -(width*0.5f); list->Clear(); } //float iniXOffset = offset.x; list->VertexBuffer(s_P); vsTransform2D t; for ( size_t i = 0; i < len; i++ ) { char thisChar = string[i]; float thisSize = GetSizeForCharacter(thisChar, size, capSize); int index = lookup_letterIndex(thisChar); if ( index < 57 && index >= 0 ) { vsAssert(index < 57, "Unknown char??"); offset.x += c_kerningFactor * thisSize; t.SetTranslation( offset-(thisSize*baseline) ); t.SetScale( vsVector2D(thisSize,thisSize) ); list->PushTransform(t); list->LineListBuffer( &s_I[index] ); list->PopTransform(); } // AppendCharacterToList( string[i], list, offset, thisSize ); offset.x += c_kerningFactor * thisSize; } list->ClearArrays(); }