** Function: tftprintln ** similar to tft->println(), but allows to include margin **********************************************************************/
| 1312 | ** similar to tft->println(), but allows to include margin |
| 1313 | **********************************************************************/ |
| 1314 | void tftprintln(String txt, int margin, int numlines) { |
| 1315 | int size = txt.length(); |
| 1316 | if (numlines == 0) numlines = (tftHeight - 2 * margin) / (tft->getTextsize() * 8); |
| 1317 | int nchars = (tftWidth - 2 * margin) / (6 * tft->getTextsize()); // 6 pixels of width fot a letter size 1 |
| 1318 | int x = tft->getCursorX(); |
| 1319 | int start = 0; |
| 1320 | while (size > 0 && numlines > 0) { |
| 1321 | if (tft->getCursorX() < margin) tft->setCursor(margin, tft->getCursorY()); |
| 1322 | nchars = (tftWidth - tft->getCursorX() - margin) / |
| 1323 | (6 * tft->getTextsize()); // 6 pixels of width fot a letter size 1 |
| 1324 | tft->println(txt.substring(0, nchars)); |
| 1325 | txt = txt.substring(nchars); |
| 1326 | size -= nchars; |
| 1327 | numlines--; |
| 1328 | } |
| 1329 | } |
| 1330 | /********************************************************************* |
| 1331 | ** Function: tftprintln |
| 1332 | ** similar to tft->println(), but allows to include margin |
no test coverage detected