>Scott, >You will see many differences with the "\n" characters in Root text >strings. > > - With Postscript the backslash will give a blank > - On X11 with the new TrueTypeFonts the backslash is ignored > - on X11 with the old fonts a backslash generates a new line on the >screen > - on NT, a backslash generates a blank > >In TText, TPaveLabels, TPaveText, we are not planning to support the >"\n" >action as being a new line. > >Rene Brun Hi, I suspected it might be related to the different output engines. My data objects generate multiline debug reports which I like to be able to dump to stdout or to a Pavetext (the reports are just (char*)s). So, if any are interested, the following dumb little kludge will break strings on '\n' characters and call AddText multiple times to get new lines without having to delve into the mysteries of the display systems. Seems to work OK for me. Int_t TPaveText::AddLines(const Text_t *inbuf) { // Adds single or multiple lines to this PaveText, breaking on '\n' characters // returns the number of lines printed // Int_t insize = strlen(inbuf); Int_t cnt = 0; Int_t linecount = 1; const Int_t linesize = 255; Text_t outline[linesize]; for(Int_t n=0;n<insize;n++){ if(inbuf[n] != '\n'){ sprintf((outline + cnt++),"%c",inbuf[n]); if(cnt == linesize){ //break after linesize characters linecount++; cnt = 0; AddText(outline); sprintf(outline,""); } } else { //break on newline character linecount++; cnt = 0; pt->AddText(outline); sprintf(outline,""); } } AddText(outline); //print what is left in outline return linecount; }
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:29 MET