+ while((dashTlx >= tlx) && (dashTlx < brx) && ((dashTlx + dashedUnderlineWidth) <= brx))
+ {
+ dashBrx = dashTlx + dashedUnderlineWidth;
+
+ //The top left edge of the underline
+ vert.mPosition.x = dashTlx;
+ vert.mPosition.y = baseLine;
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = ZERO;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ //The top right edge of the underline
+ vert.mPosition.x = dashBrx;
+ vert.mPosition.y = baseLine;
+ vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ //The bottom left edge of the underline
+ vert.mPosition.x = dashTlx;
+ vert.mPosition.y = baseLine + thickness;
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = v;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ //The bottom right edge of the underline
+ vert.mPosition.x = dashBrx;
+ vert.mPosition.y = baseLine + thickness;
+ vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ dashTlx = dashBrx + dashedUnderlineGap; // The next dash will start at the right of the current dash plus the gap
+
+ // Six indices in counter clockwise winding
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+ newMesh.mIndices.PushBack(faceIndex);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 3u);
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+
+ faceIndex += 4;
+
+ Toolkit::Internal::AtlasMeshFactory::AppendMesh(meshRecords[index].mMesh, newMesh);
+ }
+ }
+ else
+ {
+ // It's either SOLID or DOUBLE so we need to generate the first solid underline anyway.
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = baseLine;
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = ZERO;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ vert.mPosition.x = brx;
+ vert.mPosition.y = baseLine;
+ vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = baseLine + thickness;
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = v;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ vert.mPosition.x = brx;
+ vert.mPosition.y = baseLine + thickness;
+ vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ // Six indices in counter clockwise winding
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+ newMesh.mIndices.PushBack(faceIndex);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 3u);
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+ faceIndex += 4;
+
+ Toolkit::Internal::AtlasMeshFactory::AppendMesh(meshRecords[index].mMesh, newMesh);
+
+ if(underlineType == Text::Underline::Type::DOUBLE)
+ {
+ baseLine += 2 * thickness;
+
+ //The top left edge of the underline
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = baseLine; // Vertical start of the second underline
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = ZERO;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ //The top right edge of the underline
+ vert.mPosition.x = brx;
+ vert.mPosition.y = baseLine;
+ vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ //The bottom left edge of the underline
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = baseLine + thickness; // Vertical End of the second underline
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = v;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ //The bottom right edge of the underline
+ vert.mPosition.x = brx;
+ vert.mPosition.y = baseLine + thickness;
+ vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
+ newMesh.mVertices.PushBack(vert);
+
+ // Six indices in counter clockwise winding
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+ newMesh.mIndices.PushBack(faceIndex);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 3u);
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+
+ faceIndex += 4;
+
+ Toolkit::Internal::AtlasMeshFactory::AppendMesh(meshRecords[index].mMesh, newMesh);
+ }
+ }