+ float u = HALF / uv.x;
+ float v = HALF / uv.y;
+ float thickness = eIt->mLineThickness;
+ float ShiftLineBy = (underlineType == Text::Underline::Type::DOUBLE) ? (thickness * ONE_AND_A_HALF) : (thickness * HALF);
+ float baseLine = eIt->mBaseLine + eIt->mUnderlinePosition - ShiftLineBy;
+ float tlx = eIt->mLeft;
+ float brx = eIt->mRight;
+
+ if(underlineType == Text::Underline::Type::DASHED)
+ {
+ float dashTlx = tlx;
+ float dashBrx = tlx;
+
+ 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);
+ }
+ }
+ }
+ }
+
+ void GenerateStrikethrough(std::vector<MeshRecord>& meshRecords,
+ Vector<Extent>& extents,
+ const StrikethroughStyleProperties& viewStrikethroughProperties,
+ const std::map<uint32_t, StrikethroughStyleProperties>& mapStrikethroughChunkIdWithProperties)
+ {
+ AtlasManager::Mesh2D newMesh;
+ unsigned short faceIndex = 0;
+ for(Vector<Extent>::ConstIterator eIt = extents.Begin(),
+ eEndIt = extents.End();
+ eIt != eEndIt;
+ ++eIt)
+ {
+ AtlasManager::Vertex2D vert;
+ uint32_t index = eIt->mMeshRecordIndex;
+ Vector2 uv = mGlyphManager.GetAtlasSize(meshRecords[index].mAtlasId);
+
+ auto pairStrikethroughChunkIdWithProperties = mapStrikethroughChunkIdWithProperties.find(eIt->mStrikethroughChunkId);
+
+ const StrikethroughStyleProperties strikethroughProperties = (pairStrikethroughChunkIdWithProperties == mapStrikethroughChunkIdWithProperties.end())
+ ? viewStrikethroughProperties
+ : pairStrikethroughChunkIdWithProperties->second;
+
+ const Vector4& strikethroughColor = strikethroughProperties.colorDefined ? strikethroughProperties.color : viewStrikethroughProperties.color;
+
+ // Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
+ float u = HALF / uv.x;
+ float v = HALF / uv.y;
+ float thickness = eIt->mLineThickness;
+ float tlx = eIt->mLeft;
+ float brx = eIt->mRight;
+ float strikethroughPosition = eIt->mStrikethroughPosition;
+
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = strikethroughPosition;