When I write it with img.DrawText(txt,0.1, 0.35, "Multiline");
The linebreaks are gone or ignored.
Thx
Olivier
My guess is you're writing it fine.
Have you tried looking at it in a text editor.
Unless it's something that has been added very recently, img.DrawText does not have a MultiLine option.
GetTextSize was added so you can calculate for yourself where the line breaks and where to start drawing the next line.
function OnStart() {
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
//text = "Hello\nWorld";
text = app.ReadFile( "/sdcard/testfile.txt" );
txt = app.CreateText( text, 0.8, 0.2, "Multiline" );
txt.SetTextSize( 12 );
txt.SetTextColor( "#ff6666ff" );
txt.SetBackColor( "#ffffffff" );
lay.AddChild( txt );
app.AddLayout( lay );
}
And here the textfile content:
09/09/2018,57,57,0,0,0,0,00:00:02\n09/09/2018,60,60,0,0,0,0,00:00:01\n
If you put this in a textfile does it break the line with above code?
If it looks like
a\nb
in a text editor, it isn't a line break.
In a text editor, a line break should look like
a
b
But that's still not going to help you with your DrawText problem.
Did you read my last pist?