Re: First attempt of printing barcodes with groff

Oliver Corff <[email protected]>
Newsgroups gmane.comp.printing.groff.general
Message-ID <[email protected]>
Hi Alexis,

thank you very much! Your suggestions work like a charm and the result 
begins to look like a real barcode.

There is still a lot of tweaking necessary but the proof of concept 
demonstrates a fundamental feasability as soon as you comment out the 
.nop \n[mynum]\c line (which just shows the current digit).

Best regards,

Oliver.


On 27/11/2025 08:30, Alexis (surryhill) wrote:
> Hello Oliver,
>
> regarding your question 2. to avoid linebreaks I believe
> the main issues are within the while loop:
>
>    - leading blank space before \n+[mynum]
>    - missing \c after \n+[mynum]
>    - missing leading . before the \}
>
> The following achieves what I think you are looking for:
>
> .while (\n[mynum] < \n[@count]) \{
> .       barcode 9876543210 \n[mynum]
> \n+[mynum]\c
> .\}
>
> In addition I'd like to recommend the following minor
> improvements—although not strictly necessary I think
> they are good practice—as they have helped me avoid
> pitfalls in the past:
>
>    - adding a \ for line continuation to the opening curly brace
>      on the while line
>    - using nop to indent the \n+[mynum] line
>    - decrementing the while loop counter in the while condition
>
> .nr mynum \n[@count] 1
> .while (\n-[mynum] > 0) \{\
> .       barcode 9876543210 \n[mynum]
> .       nop \n[mynum]\c
> .\}
>
> Hope this helps, and please do share your progress on barcodes,
> I'm curious!
>
>
> Best
> Alexis
>
>
> P.S.: I'm using groff built from latest the commit f42d6c6d2
>
-- 
Dr. Oliver Corff
mailto:[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.