Strange tab character width results

Hello Jules,

I was trying to get the width of a tab character and I discovered this strange (?) behaviour. I will use the TextLayout method,  of course, but could you please tell me what is happening here that I do not understand?

Font    f(17);
int     indent;

indent = f.getStringWidth("\t");

// here indent is 0

GlyphArrangement    ga;

ga.addLineOfText(f, "\t", 0.0f, 0.0f);
Rectangle<float>    r = ga.getBoundingBox(0, 1, true);
indent = roundToInt(r.getWidth());

// here indent is 0

TextLayout          tl;
AttributedString    as;
as.append("\t", f);
tl.createLayout(as, 100);
indent = tl.getWidth();

// here indent is 28



The width of a tab isn't something that the font supplies! Typically a font won't contain an actual glyph for a tab, or will just have a placeholder for it - attempting to measure it makes no sense!

Of course, now I understand, I was dealing with a tab as a space, thanks!