mRight(0.0f),
mUnderlinePosition(0.0f),
mUnderlineThickness(0.0f),
- mMeshRecordIndex(0u)
+ mMeshRecordIndex(0u),
+ mUnderlineChunkId(0u)
{
}
float mUnderlinePosition;
float mUnderlineThickness;
uint32_t mMeshRecordIndex;
+ uint32_t mUnderlineChunkId;
};
struct MaxBlockSize
float currentUnderlineThickness,
std::vector<MeshRecord>& meshContainer,
Vector<TextCacheEntry>& newTextCache,
- Vector<Extent>& extents)
+ Vector<Extent>& extents,
+ uint32_t underlineChunkId)
{
// Generate mesh data for this quad, plugging in our supplied position
AtlasManager::Mesh2D newMesh;
underlineGlyph,
currentUnderlinePosition,
currentUnderlineThickness,
- slot);
+ slot,
+ underlineChunkId);
}
void CreateActors(const std::vector<MeshRecord>& meshContainer,
const Vector2* const positionsBuffer = positions.Begin();
const Vector2 lineOffsetPosition(minLineOffset, 0.f);
+ //For septated underlined chunks. (this is for Markup case)
+ uint32_t underlineChunkId = 0u; // give id for each chunk.
+ bool isPreUnderlined = false; // status of underlined for previous glyph.
+
for(uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i)
{
const GlyphInfo& glyph = *(glyphsBuffer + i);
}
lastUnderlinedFontId = glyph.fontId;
+
} // underline
AtlasGlyphManager::GlyphStyle style;
currentUnderlineThickness,
meshContainer,
newTextCache,
- extents);
+ extents,
+ underlineChunkId);
lastFontId = glyph.fontId; // Prevents searching for existing blocksizes when string of the same fontId.
}
currentUnderlineThickness,
meshContainerOutline,
newTextCache,
- extents);
+ extents,
+ 0u);
+ }
+
+
+ //The new underlined chunk. Add new id if they are not consecutive indices (this is for Markup case)
+ // Examples: "Hello <u>World</u> Hello <u>World</u>", "<u>World</u> Hello <u>World</u>", "<u> World</u> Hello <u>World</u>"
+ if( isPreUnderlined && (isPreUnderlined != isGlyphUnderlined))
+ {
+ underlineChunkId++;
}
+ //Keep status of underlined for previous glyph to check consecutive indices
+ isPreUnderlined = isGlyphUnderlined;
}
} // glyphs
bool underlineGlyph,
float underlinePosition,
float underlineThickness,
- AtlasManager::AtlasSlot& slot)
+ AtlasManager::AtlasSlot& slot,
+ uint32_t underlineChunkId)
{
if(slot.mImageId)
{
right,
baseLine,
underlinePosition,
- underlineThickness);
+ underlineThickness,
+ underlineChunkId);
}
return;
right,
baseLine,
underlinePosition,
- underlineThickness);
+ underlineThickness,
+ underlineChunkId);
}
}
}
float right,
float baseLine,
float underlinePosition,
- float underlineThickness)
+ float underlineThickness,
+ uint32_t underlineChunkId)
{
bool foundExtent = false;
for(Vector<Extent>::Iterator eIt = extents.Begin(),
eIt != eEndIt;
++eIt)
{
- if(Equals(baseLine, eIt->mBaseLine))
+ if(Equals(baseLine, eIt->mBaseLine) && underlineChunkId == eIt->mUnderlineChunkId)
{
foundExtent = true;
if(left < eIt->mLeft)
extent.mUnderlinePosition = underlinePosition;
extent.mUnderlineThickness = underlineThickness;
extent.mMeshRecordIndex = index;
+ extent.mUnderlineChunkId = underlineChunkId;
extents.PushBack(extent);
}
}