HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] faxcover commentsX





Vyacheslav Frolov wrote:

> Lee Howard wrote:
>
> > At 06:54 PM 12/25/00 +0300, Vyacheslav Frolov wrote:
> > >
> > >
> > >Lee Howard wrote:
> > >
> > >> Can anyone confirm that the faxcover 'commentsX' symbols/parameters
> > >> function properly?  Or rather, can anyone confirm that they *don't*
> > >> function properly?  I'm having extreme trouble implementing the usage of
> > >> 'commentsX'...
> > >
> > >faxcover splits text at '\n' chars into CommentX, where X is
> > [1-9\:\;\<\=\>\?\@A-D].
> >
> > (I'm asking this for a matter of documentation correction if correct...) Do
> > you mean to say that the following paragraph from the faxcover manpage:
> >
> >        If the comments string is longer than 35 characters, it is
> >        broken,  on  word  boundaries,  into  multiple  POSTSCRIPT
> >        strings commentsX where X is the line number;  e.g.   com­
> >        ments2  for  the second line of comments.  By default fax­
> >        cover will generate 20 commentsX  strings,  emitting  null
> >        string values for empty lines.  This number can be changed
> >        with the -m option; see below.
> >
> > is incorrect in that first, the variable name is "CommentX" rather than
> > "commentsX" (capitalized and missing the s), and that the comments string
> > is *not* broken on word boundaries as explained, but rather as you have
> > described?
>
> Yes, it is. And "X is the line number" is incorrect too.

Hi Lee,

May be it's not very useful (I know you've done new manpage), but I've done new BreakIntoCommentX.
The following BreakIntoCommentX compatible with old manpage.
It creates dictionary as discrabed in the manpage and
    - breaks comments on linefeed (\n)
    - breaks long words (substrings without space or linefeed)

It seems that the faxcover's option for changing "35 characters" will be helpful too (/MaxLine 35
def).

Regards,
Vyacheslav.

----[cut]------------------------
/XtoCommentX {
% <X> XtoCommentX <commentsX>
    3 string cvs
    (comments)
    dup length dup 4 1 roll
    2 index length add string
    dup 0 4 -1 roll
    putinterval dup 4 -2 roll
    putinterval
} def

/MaxLine 35 def

/BreakIntoCommentX {
% <maxlines> <text> BreakIntoCommentX -
    exch 1 1 3 2 roll
    { XtoCommentX cvn () def } for
    dup length string copy 0 1 index 0 4 1 roll
    {
        linebreak 0 get eq {
            exch dup 0 3 index
            getinterval
            4 -1 roll
            1 add dup 5 1 roll
            XtoCommentX cvn exch def
            dup length 2 index sub 1 sub
            2 index 1 add exch
            getinterval
            exch
            pop 0
        }{
            1 add
        } ifelse
        dup MaxLine gt {
            exch
            MaxLine 1 sub -1 0 {
                2 copy get
                wordbreak 0 get eq {
                    mark 4 1 roll
                    {
                        2 copy 1 add 1 index length 1 index 1 add sub
                        getinterval
                        5 -1 roll
                        search { 3 -2 roll pop pop } if
                        length MaxLine gt {
                            4 -1 roll exec
                        }{
                            false
                        } ifelse
                    }
                    { true }
                    5 1 roll
                    linebreak 1 index wordbreak 7 3 roll
                    exec
                    counttomark 1 add 4 roll
                    cleartomark
                    { pop exit } if
                    2 copy
                    1 add 0 exch
                    getinterval
                    5 -1 roll
                    1 add dup 6 1 roll
                    XtoCommentX cvn exch def
                    2 copy 1 add
                    1 index length 1 index sub
                    getinterval
                    3 -1 roll pop
                    3 -2 roll 1 add sub
                    exch
                    exit
                } if
                pop
            } for
            exch
            dup MaxLine gt {
                pop dup 0 MaxLine
                getinterval
                3 -1 roll
                1 add dup 4 1 roll
                XtoCommentX cvn exch def
                dup length MaxLine sub
                MaxLine exch
                getinterval
                1
            } if
        }if
    } forall
    pop
    exch 1 add
    XtoCommentX cvn exch def
} def
----[cut]------------------------


Examples:


1. Break on  word  boundary
------[cut]------
/comments (12345 12345 12345) def
/MaxLine 15 def
20 comments BreakIntoCommentX
------[cut]------

Creates dictionary:

[/comments1 (12345 12345 )]
[/comments2 (12345)]
[/comments3 ()]
.....
[/comments20 ()]

2. Break on linefeed
------[cut]------
/comments (12345\n12345 12345) def
/MaxLine 15 def
20 comments BreakIntoCommentX
------[cut]------

Creates dictionary:

[/comments1 (12345)]
[/comments2 (12345 12345)]
[/comments3 ()]
....
[/comments20 ()]


3. Break long words
------[cut]------
/comments (12345 12345 12345) def
/MaxLine 1 def
20 comments BreakIntoCommentX
------[cut]------

Creates dictionary:

[/comments1 (1)]
[/comments2 (2)]
[/comments3 (3)]
[/comments4 (4)]
[/comments5 (5)]
[/comments6 ( )]
[/comments7 (1)]
[/comments8 (2)]
[/comments9 (3)]
[/comments10 (4)]
[/comments11 (5)]
[/comments12 ( )]
[/comments13 (1)]
[/comments14 (2)]
[/comments15 (3)]
[/comments16 (4)]
[/comments17 (5)]
[/comments18 ()]
[/comments19 ()]
[/comments20 ()]






____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions