[liblouis-liblouisxml] Re: Help! C programmers

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 7 Aug 2013 08:25:54 -0500

The change is beter in centerHeadFoot, because it takes account of page 
numbers. For example, if there is no page number at the top of the page 
a header will have more room.

John

On Wed, Aug 07, 2013 at 02:07:12PM +0200, Bert Frees wrote:
> I think the small change in centerHeadFoot, or probably better, in
> set_runninghead_string, is exactly what's Paul is looking for, but he's
> having trouble understanding what widechar is all about.
> 
> What about something like this? I haven't tested it.
> 
> =============================================================
> transcriber.c, line 987:
> =============================================================
> int
> truncate (widechar * char, int length, int max_length)
> {
>   if (length <= max_length)
>     return length;
>   for (length = max_length; length > 0; length--)
>     if (char[length] == ' ')
>       return length;
>   return max_length;
> }
> 
> void
> set_runninghead_string (widechar * chars, int length)
> {
>   ud->running_head_length = truncate (chars, length, ud->cells_per_line -
> 9);
>   memcpy (ud->running_head, chars, ud->running_head_length * CHARSIZE);
> }
> =============================================================
> 
> 
> 
> 2013/8/7 John J. Boyer <john.boyer@xxxxxxxxxxxxxxxxx>
> 
> > Paul,
> >
> > I'm not sure what you are trying to do. A relatively small change to the
> > centerHeadFoot function would be enough to shorten the length to just
> > before the last space. It seems to me that you could also determine if
> > the header is too long by using the lou_allround tool. It will show you
> > the translation. The length of the translation should not be more than
> > the number of cells per line minus 10. That will give you a better
> > header than letting a long one be truncated, even to the last space.
> >
> > I hope this really is of help.
> >
> > John
> >

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: