/// <summary>
/// Gets the width of a range of characters.
/// </summary>
/// <param name="startIdx">the first index to calculate</param>
/// <param name="lastIdx">the last inclusive index to calculate</param>
/// <returns>the sum of all widths</returns>
public float GetWidth(int startIdx, int lastIdx)
{
var c = (char)0;
PdfChunk ck = null;
float width = 0;
for (; startIdx <= lastIdx; ++startIdx)
{
var surrogate = Utilities.IsSurrogatePair(Text, startIdx);
if (surrogate)
{
width += DetailChunks[startIdx].GetCharWidth(Utilities.ConvertToUtf32(Text, startIdx));
++startIdx;
}
else
{
c = Text[startIdx];
ck = DetailChunks[startIdx];
if (PdfChunk.NoPrint(ck.GetUnicodeEquivalent(c)))
{
continue;
}
width += DetailChunks[startIdx].GetCharWidth(c);
}
}
return(width);
}