The most recent fixes for TextLayout cause a new problem. It seems that newline characters (ie. Newline::getDefault()) will sometimes be printed out in labels as a symbol (we have seen square symbols and ‘!’) depending on the font.
Hmm, well all I changed was to make sure leading whitespace in a string gets printed. Presumably this is just on windows?
Sorry, its on Mac, CoreGraphicsContext
Just double checked, the problem was introduced in this commit:
by the line:
t.font.getGlyphPositions (getTrimmedEndIfNotAllWhitespace (t.text), newGlyphs, xOffsets);
whereas the old version:
t.font.getGlyphPositions (t.text.trimEnd(), newGlyphs, xOffsets);
does not produce the issue. However, the old version cause problems with tabs in the code editor.
Can you give me a code snippet that shows the problem?
Ok, so i debugged it and this is the problem:
The new getTrimmedEndIfNotAllWhitespace will return a “\n” on a “\n” input. This goes into t.font.getGlyphPositions which in my case returns a glyph to be added to the token list. It happens only for some fonts, but I suppose its a simple condition that a newline should not be added to the glyph list.
Ok, I can’t reproduce it with a normal font, but perhaps this would help:
[code] static String getTrimmedEndIfNotAllWhitespace (const String& s)
String trimmed (s.trimEnd());
if (trimmed.isEmpty() && ! s.isEmpty())
trimmed = s.replaceCharacters ("\r\n\t", " ");
Yes, that works fine.