private float MeasureNextlineLength(string text)
{
var isMonospacingActive = IsMonospacingActive();
float xOffset = 0;
for (var i = 0; i < text.Length; i++)
{
var c = text[i];
if (c == '\r' || c == '\n')
{
break;
}
if (isMonospacingActive)
{
xOffset += MonoSpaceWidth();
}
else
{
QFontGlyph glyph;
if (c == ' ')
{
xOffset += (float)Math.Ceiling(Font.meanGlyphWidth * Options.WordSpacing);
}
else if (Font.CharSetMapping.TryGetValue(c, out glyph)) //normal character
{
xOffset +=
(float)
Math.Ceiling(glyph.rect.Width + Font.meanGlyphWidth * Options.CharacterSpacing +
Font.GetKerningPairCorrection(i, text, null));
}
}
}
return(xOffset);
}