Revision: c2ca0b4400aa Branch: default Author: John Boyer <john.boyer@xxxxxxxxxxxxxxxxx> Date: Thu Aug 8 11:53:51 2013 Log: fixes to running header and footer http://code.google.com/p/liblouisutdml/source/detail?r=c2ca0b4400aa Modified: /liblouisutdml/transcriber.c ======================================= --- /liblouisutdml/transcriber.c Thu Aug 8 06:09:46 2013 +++ /liblouisutdml/transcriber.c Thu Aug 8 11:53:51 2013 @@ -970,14 +970,18 @@ void set_runninghead_string (widechar * chars, int length) { - ud->running_head_length = minimum (length, ud->cells_per_line - 9); + if (length > (sizeof (ud->running_head) / CHARSIZE)) + length = sizeof (ud->running_head) / CHARSIZE - 4; + ud->running_head_length = length; memcpy (ud->running_head, chars, ud->running_head_length * CHARSIZE); } void set_footer_string (widechar * chars, int length) { - ud->footer_length = minimum (length, ud->cells_per_line - 9); + if (length > (sizeof (ud->footer) / CHARSIZE)) + length = sizeof (ud->footer) / CHARSIZE - 4; + ud->footer_length = length; memcpy (ud->footer, chars, ud->footer_length * CHARSIZE); } @@ -1575,7 +1579,7 @@ if (length > numCells) { int k; - length = numCells - 4; + length = numCells - 2; for (k = length; toCenter[k] != ' ' && k >= 0; k--); if (k > 0) length = k - 1; @@ -1586,10 +1590,13 @@ return 0; if (!insertWidechars (toCenter, length)) return 0; - if (!insertCharacters (blanks, trailingBlanks)) - return 0; - if (!insertWidechars (pageNumberString, pageNumberLength)) - return 0; + if (pageNumberLength > 0) + { + if (!insertCharacters (blanks, trailingBlanks)) + return 0; + if (!insertWidechars (pageNumberString, pageNumberLength)) + return 0; + } return 1; } For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com