diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/pst-barcode/Changes | 52 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pst-barcode/barcode.pdf | bin | 216794 -> 228289 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pst-barcode/barcode.tex | 158 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pst-barcode/pst-barcode.tex | 6 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro | 1382 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-barcode/pst-barcode.sty | 3 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/pst-barcode.tpm | 6 |
7 files changed, 1319 insertions, 288 deletions
diff --git a/Master/texmf-dist/doc/latex/pst-barcode/Changes b/Master/texmf-dist/doc/latex/pst-barcode/Changes index be3e3676d26..17ab2457dbf 100644 --- a/Master/texmf-dist/doc/latex/pst-barcode/Changes +++ b/Master/texmf-dist/doc/latex/pst-barcode/Changes @@ -1,7 +1,10 @@ ----- pst-barcode.tex -2005-07-26 Changes to the documentation and the syntax - of psbarcode (hv) -2005-07-26 first version (hv) +0.04 2006-07-23 - adding support for the ISBN-13 code + - printing the code from the current point and + no more from the origin +0.03 2005-07-26 - Changes to the documentation and the syntax + of psbarcode (hv) +0.02 2005-07-26 - first version (hv) ----- pst-barcode.sty @@ -9,10 +12,43 @@ ----- pst-barcode.pro -2005-10-24 A new encoder for the bar codes used by the - Australian Postal Service was added. -2005-10-17 adding a checksum for code 2of5 encoder -2005-10-14 some more changes to the possible charcters +2006-03-04 - An encoder for the Reduced Space Symbology RSS Expanded was added. + - The incorrect definition of the USPS FIM-B symbol was fixed. + - An encoder for the Reduced Space Symbology RSS Limited was added. + The efficiency of RSS-14 was improved. + - An encoder for the new OneCode symbology used by the US + Postal Service was added. + - The FIM symbols now render according to their specification. + - The Postnet, Royal Mail, AusPost and KIX encoders were amended + so that the metrics of their default symbols confirms + strongly to their respective specifications. + - The encoders now pass an array containing the widths of the + bar space succession to the renderer allowing for sub-point + horizontal precision. + - The default border positions for EAN and UPC symbols were + amended to properly enclose the human readable text. + - The colour support code was fixed to prevent overwriting of + the current colour when values are left unspecified. + - The logic to guard whitespace in EAN symbols was migrated + from the encoders to the renderer. + - The whitespace guard symbols are now drawn directly making them + independant of any font. + - The inter-guard bar height of EANs and UPCs was amended. + - The renderer was amended to support the passing of encoder + specific arguments. + - The options barcolor, textcolor, bordercolor, showbackground + and backgroundcolor were added to the renderer. + - A flaw in the derivation of the top border height was fixed. + - add support for the new ISBN-13 + - printing the code from the current point + - The performance of the renderer was improved by avoiding + unnecessary calls of setfont + - The auspost encoder was extended to support the customer + information field. +2005-10-24 - A new encoder for the bar codes used by the + Australian Postal Service was added. +2005-10-17 - adding a checksum for code 2of5 encoder +2005-10-14 - some more changes to the possible charcters 2005-09-26 - A new encoder was added to support the generation of miscellaneous symbols. - Support for generation of FIM symbols used on @@ -20,5 +56,3 @@ 2005-09-15 added Kix -- Dutch mail 2005-09-17 choose the right syntax for saving the length 2005-09-08 some more tweaks to the code -0.02 2005-08-02 sync to barcode.ps (hv) -0.01 2005-07-26 first version (hv) diff --git a/Master/texmf-dist/doc/latex/pst-barcode/barcode.pdf b/Master/texmf-dist/doc/latex/pst-barcode/barcode.pdf Binary files differindex 132333f711c..8f85434f353 100644 --- a/Master/texmf-dist/doc/latex/pst-barcode/barcode.pdf +++ b/Master/texmf-dist/doc/latex/pst-barcode/barcode.pdf diff --git a/Master/texmf-dist/doc/latex/pst-barcode/barcode.tex b/Master/texmf-dist/doc/latex/pst-barcode/barcode.tex index 70c1b41b9df..fe8f3541c39 100644 --- a/Master/texmf-dist/doc/latex/pst-barcode/barcode.tex +++ b/Master/texmf-dist/doc/latex/pst-barcode/barcode.tex @@ -5,6 +5,8 @@ \usepackage{pst-barcode} \let\PSTfileversion\fileversion \usepackage[ps2pdf,colorlinks,linktocpage]{hyperref} +\usepackage{breakurl} +\def\CMD#1{\texttt{\textbackslash #1}} \title{Package \texttt{pst-barcode}\\ \footnotesize v. \PSTfileversion} @@ -18,11 +20,11 @@ \begin{center} \begin{tabular}{@{}>{\ttfamily}lll@{}} \textrm{\emph{file name}} & \emph{meaning} & \emph{version}\\\hline -pst-barcode.sty & \LaTeX\ style file -- wrapper & 2005-07-24\\ -pst-barcode.tex & \TeX\ file -- PS interface & 2005-07-26\\ -pst-barcode.pro & PostScript file & 2005-10-17\\ -barcode.tex & documentation source & 2005-09-16\\ -barcode.pdf & documentation PDF & 2005-09-16\\ +pst-barcode.sty & \LaTeX\ style file -- wrapper & 2006-07-23\\ +pst-barcode.tex & \TeX\ file -- PS interface & 2006-07-23\\ +pst-barcode.pro & PostScript file & 2006-07-23\\ +barcode.tex & documentation source & 2006-07-23\\ +barcode.pdf & documentation PDF & 2006-07-23\\ \end{tabular} \end{center} @@ -96,7 +98,7 @@ or the \verb+\makebox+ macro. \subsection{Examples for the TeX options} -\begin{LTXexample}[pos=t] +\begin{LTXexample}[pos=t,preset=\centering] \begin{pspicture}(3.5,1.2in) \psbarcode{12345678}{includetext}{ean8} \end{pspicture} @@ -111,7 +113,7 @@ or the \verb+\makebox+ macro. \newpage \subsection{Examples for the PostScript options} -\begin{LTXexample}[pos=t] +\begin{LTXexample}[pos=t,preset=\centering] \begin{pspicture}(3.5,1.2in) \psbarcode{12345678}{includetext guardwhitespace height=0.6}{ean8} \end{pspicture} @@ -126,7 +128,7 @@ or the \verb+\makebox+ macro. \end{pspicture} \end{LTXexample} -\begin{LTXexample}[pos=t] +\begin{LTXexample}[pos=t,preset=\centering] \begin{pspicture}(3.5,1.2in) \psbarcode{12345678}{includetext guardwhitespace}{ean8} \end{pspicture} @@ -136,6 +138,31 @@ or the \verb+\makebox+ macro. \end{LTXexample} +\section{Usage} +By default the barcode has a width and a height of zero. Using the \CMD{parbox} +macro or the \verb+pspicture+ environment can reserve the needed space for +the barcode. The \CMD{fbox} in the following examples is used +only for demonstration. + + +\begin{LTXexample}[width=.5\linewidth] +foo +\fbox{% + \parbox[b][1in]{1.5in}{\psbarcode{241078}{includetext width=1.5 height=1}{code39}}} +bar +\end{LTXexample} + +\bigskip +\begin{LTXexample}[width=.5\linewidth] +foo +\fbox{% +\begin{pspicture}(0,-8pt)(1.5in,1in) + \psbarcode{241078}{includetext width=1.5 height=1}{code39} +\end{pspicture}} +bar +\end{LTXexample} + + \section{Possible barcodes} The following section shows the symbologies that are supported by @@ -261,26 +288,38 @@ try the support mailing list. \end{pspicture} \end{LTXexample} +\newpage \subsection{ISBN} +An ISBN symbol is really an EAN-13 with a particular prefix, 978 for the older ISBN-10 format, and others for the new ISBN-13 format. \begin{description} \item[Characters] \verb+-0123456789+ -\item[Data] 9 or 10 digits seperated appropriately with dashes +\item[Data] 9 or 10 digits for ISBN-10 seperated appropriately with dashes +\item[Data] 12 or 13 digits for ISBN-13 seperated appropriately with dashes \item[Options]~\\ \begin{tabular}{l|l} Option & Feature\\ \hline \texttt{includetext} & Enable human readable text\\ \end{tabular} -\item[Notes] If just 9 digits are entered then the human readable +\item[Notes] If just 9 (ISBN-10) or 12 (ISBN-13) digits are entered then the human readable, ISBN check digit is calculated automatically \end{description} +\smallskip +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(3,1in) +\psbarcode{3-86541-114}{includetext guardwhitespace}{isbn} +\end{pspicture} +\end{LTXexample} + +\bigskip\enlargethispage{2ex} \begin{LTXexample}[width=.3\linewidth] \begin{pspicture}(3,1in) -\psbarcode{1-58880-149}{includetext guardwhitespace}{isbn} +\psbarcode{978-3-86541-114}{includetext guardwhitespace}{isbn} \end{pspicture} \end{LTXexample} + \subsection{Code-39} \begin{description} @@ -350,6 +389,7 @@ for the initial character set. UCC/EAN-128s must have a manditory \end{LTXexample} +\newpage \subsection{Interleaved 2 of 5 and ITF-14} \begin{description} @@ -448,7 +488,7 @@ for the initial character set. UCC/EAN-128s must have a manditory \end{description} \begin{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,0.5in) +\begin{pspicture}(5,0.3in) \psbarcode{1203AA12}{includetext}{kix} \end{pspicture} \end{LTXexample} @@ -469,28 +509,58 @@ for the initial character set. UCC/EAN-128s must have a manditory \end{description} \begin{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,0.5in) +\begin{pspicture}(5,0.3in) \psbarcode{1139549554}{includetext}{auspost} \end{pspicture} \end{LTXexample} +\subsection{onecode} +United States Postal Service, replaces POSTNET and PLANET symbols. +Each barcode can be 20, 25, 29, or 31 digits long, depending on the type of ZIP code present. Each digit has four possible states, so one digit represents numbers 0-3. +\begin{description} +\item[Characters] \verb!0123456789! +\item[Data] Variable number digits +\iffalse +\item[Options]~\\ + \begin{tabular}{l|l} + Option & Feature\\ \hline + \texttt{includetext} & Enable human readable text\\ + \end{tabular} +\fi +\end{description} + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(5,0.3in) +\psbarcode{0123456709498765432101234567891}{includetext}{onecode} +\end{pspicture} +\end{LTXexample} \subsection{Symbol} The purpose of the symbol encoder is to store the definitions of miscellaneous barcode symbols such as the FIM symbols used by the US Postal Service on their reply mail. -\begin{LTXexample}[width=.2\linewidth] -\begin{pspicture}(1cm,.5in) -\psbarcode{fima}{includetext}{symbol} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fima}{}{symbol} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fimb}{}{symbol} \end{pspicture} -\begin{pspicture}(1cm,.5in) -\psbarcode{fimb}{includetext}{symbol} -\end{pspicture}\\ -\begin{pspicture}(1cm,.5in) -\psbarcode{fimc}{includetext}{symbol} +\end{LTXexample} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fimc}{}{symbol} \end{pspicture} -\begin{pspicture}(1cm,.5in) -\psbarcode{fimd}{includetext}{symbol} +\end{LTXexample} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fimd}{}{symbol} \end{pspicture} \end{LTXexample} @@ -498,7 +568,7 @@ symbols such as the FIM symbols used by the US Postal Service on their reply mai \subsection{MSI} \begin{description} -\item[Characters] \verb!01234B6789! +\item[Characters] \verb!0123456789! \item[Data] Variable number digits \item[Options]~\\ \begin{tabular}{l|l} @@ -529,12 +599,48 @@ symbols such as the FIM symbols used by the US Postal Service on their reply mai \item[Notes] Check digits are always added automatically. \end{description} -\begin{LTXexample}[pos=t] -\begin{pspicture}(12,1in) +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(0,-2mm)(12,1in) \psbarcode{0123456789ABCDEF}{includetext}{plessey} \end{pspicture} \end{LTXexample} +\subsection{Reduced Space Symbology (RSS)} +This is a family that includes RSS-14\textregistered, RSS Limited\textregistered, +and RSS Expanded\textregistered{} (\url{http://www.gs1.org/productssolutions/barcodes/technical/rss.html}). RSS-14 and RSS Limited encode Global Trade Item +Numbers (GTINs). RSS Expanded will encode any of the GS1 System identification +numbers as well as all other Application Identifiers. +RSS is used in the healthcare industry. + +\begin{description} +\item[Characters] \verb!0123456789! +\item[Data] Variable number digits +\end{description} + +\subsubsection{rss14} + +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{24012345678905}{height=0.3}{rss14} +\end{pspicture} +\end{LTXexample} + +\subsubsection{rsslimited} +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{00978186074271}{height=0.3}{rsslimited} +\end{pspicture} +\end{LTXexample} + +\subsubsection{rssexpanded} +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{000000010011001010100001000000010000}{height=0.3}{rssexpanded} +\end{pspicture} +\end{LTXexample} + + + \section{Code Commentary} This commentary assumes familiarity with the PostScript language\footnote{The PostScript Language Tutorial and Cookbook diff --git a/Master/texmf-dist/doc/latex/pst-barcode/pst-barcode.tex b/Master/texmf-dist/doc/latex/pst-barcode/pst-barcode.tex index 8c4c0e4e81b..98449a8430c 100644 --- a/Master/texmf-dist/doc/latex/pst-barcode/pst-barcode.tex +++ b/Master/texmf-dist/doc/latex/pst-barcode/pst-barcode.tex @@ -19,8 +19,8 @@ \let\PSTBarcodeLoaded\endinput \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi % -\def\fileversion{0.03} -\def\filedate{2005/09/17} +\def\fileversion{0.04} +\def\filedate{2006/07/23} \message{`PST-barcode' v\fileversion, \filedate\space (tb,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -48,7 +48,7 @@ \psk@barcode@scalex\space \psk@barcode@scaley\space \psk@barcode@transx\space \psk@barcode@transy\space translate scale rotate - (#1) (#2) #3\space barcode + 0 0 moveto (#1) (#2) #3\space barcode grestore }% \end@SpecialObj% diff --git a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro index 31667b82ba7..0054cdac340 100644 --- a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro +++ b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro @@ -4,10 +4,10 @@ %%EndComments %%EndProlog -% Barcode Writer in Pure PostScript - Version 2005-10-24 +% Barcode Writer in Pure PostScript - Version 2006-05-26 % http://www.terryburton.co.uk/barcodewriter/ % -% Copyright (c) 2005 Terry Burton - tez@terryburton.co.uk +% Copyright (c) 2006 Terry Burton - tez@terryburton.co.uk % % Permission is hereby granted, free of charge, to any % person obtaining a copy of this software and associated @@ -47,16 +47,14 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string - + /includetext false def % Enable/disable text /textfont /Helvetica def /textsize 12 def - /textpos -2 def + /textpos -4 def /height 1 def - /guardwhitespace false def - /guardpos (unset) def % Parse the input options options { @@ -67,11 +65,6 @@ /textfont textfont cvlit def /textsize textsize cvr def /textpos textpos cvr def - guardpos (unset) eq { - /guardpos textpos 1 add def - } { - /guardpos guardpos cvr def - } ifelse /height height cvr def /barlen barcode length def % Length of the code @@ -113,14 +106,8 @@ ] def /sbs barlen 1 sub 4 mul 11 add string def - - guardwhitespace { - /txt barlen 1 add array def - txt barlen [(>) 99 guardpos textfont textsize] put - } { - /txt barlen array def - } ifelse - + /txt barlen array def + % Put the start character sbs 0 encs 10 get putinterval @@ -148,7 +135,7 @@ /enc revenc def } if sbs i 1 sub 4 mul 3 add enc putinterval % Put encoded digit into sbs - txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textpos textfont 0] put + txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textpos textfont textsize] put } for % Put the middle character @@ -164,26 +151,28 @@ pop pop % Discard seek and post /enc encs indx get def % Get the indxth encoding sbs i 1 sub 4 mul 8 add enc putinterval % Put encoded digit into sbs - txt i [barcode i 1 getinterval i 1 sub 7 mul 8 add textpos textfont 0] put + txt i [barcode i 1 getinterval i 1 sub 7 mul 8 add textpos textfont textsize] put } for % Put the end character sbs barlen 1 sub 4 mul 8 add encs 12 get putinterval - + % Return the arguments /retval 4 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put includetext { - retval (bhs) [height height 12{height .1 sub}repeat height height 12{height .1 sub}repeat height height] put - retval (bbs) [0 0 12{.1}repeat 0 0 12{.1}repeat 0 0] put + retval (bhs) [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] put + retval (bbs) [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] put retval (txt) txt put } { retval (bhs) [30{height}repeat] put retval (bbs) [30{0}repeat] put } ifelse - retval (opt) renderopts put + retval (opt) useropts put + retval (guardrightpos) 10 put + retval (borderbottom) 5 put retval - + end } bind def @@ -196,16 +185,14 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text /textfont /Helvetica def /textsize 12 def - /textpos -2 def + /textpos -4 def /height 1 def - /guardwhitespace false def - /guardpos (unset) def % Parse the input options options { @@ -216,11 +203,6 @@ /textfont textfont cvlit def /textsize textsize cvr def /textpos textpos cvr def - guardpos (unset) eq { - /guardpos textpos 1 add def - } { - /guardpos guardpos cvr def - } ifelse /height height cvr def % Create an array containing the character mappings @@ -235,14 +217,7 @@ /barlen barcode length def % Length of the code /sbs barlen 4 mul 11 add string def - - guardwhitespace { - /txt barlen 2 add array def - txt barlen [(<) -9 guardpos textfont textsize] put - txt barlen 1 add [(>) 69 guardpos textfont textsize] put - } { - /txt barlen array def - } ifelse + /txt barlen array def % Put the start character sbs 0 encs 10 get putinterval @@ -273,7 +248,7 @@ pop pop % Discard seek and post /enc encs indx get def % Get the indxth encoding sbs i 4 mul 8 add enc putinterval % Put encoded digit into sbs - txt i [barcode i 1 getinterval i 7 mul 8 add textpos textfont 0] put + txt i [barcode i 1 getinterval i 7 mul 8 add textpos textfont textsize] put } for % Put the end character @@ -281,16 +256,19 @@ % Return the arguments /retval 4 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put includetext { - retval (bhs) [height height 8{height .1 sub}repeat height height 8{height .1 sub}repeat height height] put - retval (bbs) [0 0 8{.1}repeat 0 0 8{.1}repeat 0 0] put + retval (bhs) [height height 8{height .075 sub}repeat height height 8{height .075 sub}repeat height height] put + retval (bbs) [0 0 8{.075}repeat 0 0 8{.075}repeat 0 0] put retval (txt) txt put } { retval (bhs) [22{height}repeat] put retval (bbs) [22{0}repeat] put } ifelse - retval (opt) renderopts put + retval (opt) useropts put + retval (guardleftpos) 10 put + retval (guardrightpos) 10 put + retval (borderbottom) 5 put retval end @@ -305,13 +283,13 @@ 0 begin /options exch def - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text /textfont /Helvetica def /textsize 12 def - /textpos -2 def + /textpos -4 def /height 1 def % Parse the input options @@ -396,7 +374,7 @@ i 11 eq { % Last digit is after guard bars txt 11 [barcode 11 1 getinterval 96 textpos textfont textsize 2 sub] put } { - txt i [barcode i 1 getinterval i 7 mul 8 add textpos textfont 0] put + txt i [barcode i 1 getinterval i 7 mul 8 add textpos textfont textsize] put } ifelse } for @@ -405,16 +383,17 @@ % Return the arguments /retval 4 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put includetext { - retval (bhs) [4{height}repeat 10{height .1 sub}repeat height height 10{height .1 sub}repeat 5{height}repeat] put - retval (bbs) [0 0 0 0 10{.1}repeat 0 0 10{.1}repeat 0 0 0 0 0] put + retval (bhs) [4{height}repeat 10{height .075 sub}repeat height height 10{height .075 sub}repeat 5{height}repeat] put + retval (bbs) [0 0 0 0 10{.075}repeat 0 0 10{.075}repeat 0 0 0 0 0] put retval (txt) txt put } { retval (bhs) [31{height}repeat] put retval (bbs) [31{0}repeat] put } ifelse - retval (opt) renderopts put + retval (opt) useropts put + retval (borderbottom) 5 put retval end @@ -429,13 +408,13 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text /textfont /Helvetica def /textsize 12 def - /textpos -2 def + /textpos -4 def /height 1 def % Parse the input options @@ -539,16 +518,17 @@ % Return the arguments /retval 4 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put includetext { - retval (bhs) [height height 12{height .1 sub}repeat height height height] put - retval (bbs) [0 0 12{.1}repeat 0 0 0] put + retval (bhs) [height height 12{height .075 sub}repeat height height height] put + retval (bbs) [0 0 12{.075}repeat 0 0 0] put retval (txt) txt put } { retval (bhs) [17{height}repeat] put retval (bbs) [17{0}repeat] put } ifelse - retval (opt) renderopts put + retval (opt) useropts put + retval (borderbottom) 5 put retval end @@ -563,16 +543,14 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text /textfont /Helvetica def /textsize 12 def /textpos (unset) def - /height 0.7 def - /guardwhitespace false def - /guardpos (unset) def + /height 0.7 def % Parse the input options options { @@ -588,11 +566,6 @@ } { /textpos textpos cvr def } ifelse - guardpos (unset) eq { - /guardpos textpos 1 add def - } { - /guardpos guardpos cvr def - } ifelse /barlen barcode length def % Length of the code @@ -625,14 +598,8 @@ /mirrormap mirrormaps checksum get def /sbs 31 string def - - guardwhitespace { - /txt 6 array def - txt 5 [(>) 49 guardpos textfont textsize] put - } { - /txt 5 array def - } ifelse - + /txt 5 array def + 0 1 4 { /i exch def @@ -665,13 +632,16 @@ % Return the arguments /retval 4 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [16{height}repeat] put retval (bbs) [16{0}repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put + retval (guardrightpos) 10 put + retval (guardrightypos) textpos 4 add put + retval (bordertop) 10 put retval end @@ -686,7 +656,7 @@ 0 begin /options exch def % We are given an options string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text @@ -694,8 +664,6 @@ /textsize 12 def /textpos (unset) def /height 0.7 def - /guardwhitespace false def - /guardpos (unset) def % Parse the input options options { @@ -711,11 +679,6 @@ } { /textpos textpos cvr def } ifelse - guardpos (unset) eq { - /guardpos textpos 1 add def - } { - /guardpos guardpos cvr def - } ifelse /barlen barcode length def % Length of the code @@ -733,13 +696,7 @@ /mirrormap [(00) (01) (10) (11)] barcode 0 2 getinterval cvi 4 mod get def /sbs 13 string def - - guardwhitespace { - /txt 3 array def - txt 2 [(>) 22 guardpos textfont textsize] put - } { - /txt 2 array def - } ifelse + /txt 2 array def 0 1 1 { /i exch def @@ -773,13 +730,16 @@ % Return the arguments /retval 4 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [12{height}repeat] put retval (bbs) [12{0}repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put + retval (guardrightpos) 10 put + retval (guardrightypos) textpos 4 add put + retval (bordertop) 10 put retval end @@ -795,7 +755,7 @@ 0 begin /options exch def % We are given an options string - /renderopts options def + /useropts options def /isbntxt exch def % We are given the isbn text with dashes /includetext false def % Enable/disable ISBN text @@ -894,7 +854,7 @@ } ifelse } if - args (opt) renderopts put + args (opt) useropts put args end @@ -909,7 +869,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text @@ -1006,13 +966,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1027,7 +987,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def % Enable/disable checkdigit @@ -1090,7 +1050,7 @@ pop pop % Discard seek and post /enc encs indx get def % Get the indxth encoding sbs i 10 mul 10 add enc putinterval % Put encoded digit into sbs - txt i 1 add [barcode i 1 getinterval i 1 add 16 mul textpos textfont 0] put + txt i 1 add [barcode i 1 getinterval i 1 add 16 mul textpos textfont textsize] put /checksum checksum indx add def } for @@ -1099,26 +1059,26 @@ /checksum checksum 43 mod def sbs barlen 10 mul 10 add encs checksum get putinterval includecheckintext { - txt barlen 1 add [barchars checksum 1 getinterval barlen 1 add 16 mul textpos textfont 0] put + txt barlen 1 add [barchars checksum 1 getinterval barlen 1 add 16 mul textpos textfont textsize] put } { - txt barlen 1 add [() barlen 1 add 16 mul textpos textfont 0] put + txt barlen 1 add [() barlen 1 add 16 mul textpos textfont textsize] put } ifelse sbs barlen 10 mul 20 add encs 43 get putinterval - txt barlen 2 add [(*) barlen 2 add 16 mul textpos textfont 0] put + txt barlen 2 add [(*) barlen 2 add 16 mul textpos textfont textsize] put } { sbs barlen 10 mul 10 add encs 43 get putinterval - txt barlen 1 add [(*) barlen 1 add 16 mul textpos textfont 0] put + txt barlen 1 add [(*) barlen 1 add 16 mul textpos textfont textsize] put } ifelse - + % Return the arguments /retval 2 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1133,7 +1093,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def % Enable/disable checkdigit @@ -1226,13 +1186,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1247,7 +1207,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def % Enable/disable checkdigit @@ -1355,13 +1315,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1370,6 +1330,601 @@ /interleaved2of5 load 0 1 dict put % --END ENCODER interleaved2of5-- +% --BEGIN ENCODER rss14-- +/rss14 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 1 def + /linkage false def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /getRSSwidths { + /mw exch def + /nm exch def + /val exch def + /j 0 def /i 0 def { + /v () def + mw 1 ne {/v i mw 4 string cvrs def} if + 0 v {48 sub add} forall 4 add nm eq { + j val eq {exit} if + /j j 1 add def + } if + /i i 1 add def + } loop + [4 {1} repeat v {47 sub} forall] v length 4 getinterval + } bind def + + /binval [barcode {48 sub} forall] def + /binval [linkage {1} {0} ifelse binval 0 13 getinterval {} forall] def + + 0 1 12 { + /i exch def + binval i 1 add 2 copy get binval i get 4537077 mod 10 mul add put + binval i binval i get 4537077 idiv put + } for + /right binval 13 get 4537077 mod def + binval 13 2 copy get 4537077 idiv put + + /left 0 def + /i true def + 0 1 13 { + /j exch def + binval j get + dup 0 eq i and { + pop + } { + /i false def + /left left 3 -1 roll 10 13 j sub exp cvi mul add def + } ifelse + } for + + /d1 left 1597 idiv def + /d2 left 1597 mod def + /d3 right 1597 idiv def + /d4 right 1597 mod def + + /tab164 [ + 160 0 12 4 8 1 161 1 + 960 161 10 6 6 3 80 10 + 2014 961 8 8 4 5 31 34 + 2714 2015 6 10 3 6 10 70 + 2840 2715 4 12 1 8 1 126 + ] def + + /tab154 [ + 335 0 5 10 2 7 4 84 + 1035 336 7 8 4 5 20 35 + 1515 1036 9 6 6 3 48 10 + 1596 1516 11 4 8 1 81 1 + ] def + + /i 0 def { + d1 tab164 i get le { + tab164 i 1 add 7 getinterval {} forall + /d1te exch def /d1to exch def + /d1mwe exch def /d1mwo exch def + /d1ele exch def /d1elo exch def + /d1gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d2 tab154 i get le { + tab154 i 1 add 7 getinterval {} forall + /d2te exch def /d2to exch def + /d2mwe exch def /d2mwo exch def + /d2ele exch def /d2elo exch def + /d2gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d3 tab164 i get le { + tab164 i 1 add 7 getinterval {} forall + /d3te exch def /d3to exch def + /d3mwe exch def /d3mwo exch def + /d3ele exch def /d3elo exch def + /d3gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d4 tab154 i get le { + tab154 i 1 add 7 getinterval {} forall + /d4te exch def /d4to exch def + /d4mwe exch def /d4mwo exch def + /d4ele exch def /d4elo exch def + /d4gs exch def + exit + } if + /i i 8 add def + } loop + + /d1wo d1 d1gs sub d1te idiv d1elo d1mwo getRSSwidths def + /d1we d1 d1gs sub d1te mod d1ele d1mwe getRSSwidths def + /d2wo d2 d2gs sub d2to mod d2elo d2mwo getRSSwidths def + /d2we d2 d2gs sub d2to idiv d2ele d2mwe getRSSwidths def + /d3wo d3 d3gs sub d3te idiv d3elo d3mwo getRSSwidths def + /d3we d3 d3gs sub d3te mod d3ele d3mwe getRSSwidths def + /d4wo d4 d4gs sub d4to mod d4elo d4mwo getRSSwidths def + /d4we d4 d4gs sub d4to idiv d4ele d4mwe getRSSwidths def + + /d1w 8 array def + 0 1 3 { + /i exch def + d1w i 2 mul d1wo i get put + d1w i 2 mul 1 add d1we i get put + } for + + /d2w 8 array def + 0 1 3 { + /i exch def + d2w 7 i 2 mul sub d2wo i get put + d2w 6 i 2 mul sub d2we i get put + } for + + /d3w 8 array def + 0 1 3 { + /i exch def + d3w 7 i 2 mul sub d3wo i get put + d3w 6 i 2 mul sub d3we i get put + } for + + /d4w 8 array def + 0 1 3 { + /i exch def + d4w i 2 mul d4wo i get put + d4w i 2 mul 1 add d4we i get put + } for + + /widths [ + d1w {} forall + d2w {} forall + d3w {} forall + d4w {} forall + ] def + + /checkweights [ + 1 3 9 27 2 6 18 54 + 58 72 24 8 29 36 12 4 + 74 51 17 32 37 65 48 16 + 64 34 23 69 49 68 46 59 + ] def + + /checkwidths [ + 3 8 2 1 1 3 5 5 1 1 3 3 7 1 1 + 3 1 9 1 1 2 7 4 1 1 2 5 6 1 1 + 2 3 8 1 1 1 5 7 1 1 1 3 9 1 1 + ] def + + /checksum 0 def + 0 1 31 { + /i exch def + /checksum checksum widths i get checkweights i get mul add def + } for + /checksum checksum 79 mod def + checksum 8 ge {/checksum checksum 1 add def} if + checksum 72 ge {/checksum checksum 1 add def} if + /checklt checkwidths checksum 9 idiv 5 mul 5 getinterval def + /checkrtrev checkwidths checksum 9 mod 5 mul 5 getinterval def + /checkrt 5 array def + 0 1 4 { + /i exch def + checkrt i checkrtrev 4 i sub get put + } for + + /sbs [ + 1 d1w {} forall checklt {} forall d2w {} + forall d4w {} forall checkrt {} forall d3w {} forall 1 1 + ] def + + % Return the arguments + /retval 1 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/rss14 load 0 1 dict put +% --END ENCODER rss14-- + +% --BEGIN ENCODER rsslimited-- +/rsslimited { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /getRSSwidths { + /el exch def + /mw exch def + /nm exch def + /val exch def + /j 0 def /i 0 def { + /v () def + mw 1 ne {/v i mw el string cvrs def} if + 0 v {48 sub add} forall el add nm eq { + j val eq {exit} if + /j j 1 add def + } if + /i i 1 add def + } loop + [el {1} repeat v {47 sub} forall] v length el getinterval + } bind def + + /binval [barcode {48 sub} forall] def + /binval [binval 0 13 getinterval {} forall] def + + 0 1 11 { + /i exch def + binval i 1 add 2 copy get binval i get 2013571 mod 10 mul add put + binval i binval i get 2013571 idiv put + } for + /d2 binval 12 get 2013571 mod def + binval 12 2 copy get 2013571 idiv put + + /d1 0 def + /i true def + 0 1 12 { + /j exch def + binval j get + dup 0 eq i and { + pop + } { + /i false def + /d1 d1 3 -1 roll 10 12 j sub exp cvi mul add def + } ifelse + } for + + /tab267 [ + 183063 0 17 9 6 3 6538 28 + 820063 183064 13 13 5 4 875 728 + 1000775 820064 9 17 3 6 28 6454 + 1491020 1000776 15 11 5 4 2415 203 + 1979844 1491021 11 15 4 5 203 2408 + 1996938 1979845 19 7 8 1 17094 1 + 2013570 1996939 7 19 1 8 1 16632 + ] def + + /i 0 def { + d1 tab267 i get le { + tab267 i 1 add 7 getinterval {} forall + /d1te exch def /d1to exch def + /d1mwe exch def /d1mwo exch def + /d1ele exch def /d1elo exch def + /d1gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d2 tab267 i get le { + tab267 i 1 add 7 getinterval {} forall + /d2te exch def /d2to exch def + /d2mwe exch def /d2mwo exch def + /d2ele exch def /d2elo exch def + /d2gs exch def + exit + } if + /i i 8 add def + } loop + + /d1wo d1 d1gs sub d1te idiv d1elo d1mwo 7 getRSSwidths def + /d1we d1 d1gs sub d1te mod d1ele d1mwe 7 getRSSwidths def + /d2wo d2 d2gs sub d2te idiv d2elo d2mwo 7 getRSSwidths def + /d2we d2 d2gs sub d2te mod d2ele d2mwe 7 getRSSwidths def + + /d1w 14 array def + 0 1 6 { + /i exch def + d1w i 2 mul d1wo i get put + d1w i 2 mul 1 add d1we i get put + } for + + /d2w 14 array def + 0 1 6 { + /i exch def + d2w i 2 mul d2wo i get put + d2w i 2 mul 1 add d2we i get put + } for + + /widths [ + d1w {} forall + d2w {} forall + ] def + + /checkweights [ + 1 3 9 27 81 65 17 51 64 14 42 37 22 66 + 20 60 2 6 18 54 73 41 34 13 39 28 84 74 + ] def + + /checkseq [ + 0 1 43 {} for + 45 52 57 + 63 1 66 {} for + 73 1 79 {} for + 82 + 126 1 130 {} for + 132 + 141 1 146 {} for + 210 1 217 {} for + 220 + 316 1 323 {} for + 326 337 + ] def + + /checksum 0 def + 0 1 27 { + /i exch def + /checksum checksum widths i get checkweights i get mul add def + } for + /checksum checksum 89 mod def + /seq checkseq checksum get def + /swidths seq 21 idiv 8 3 6 getRSSwidths def + /bwidths seq 21 mod 8 3 6 getRSSwidths def + + /checkwidths [0 0 0 0 0 0 0 0 0 0 0 0 1 1] def + 0 1 5 { + /i exch def + checkwidths i 2 mul swidths i get put + checkwidths i 2 mul 1 add bwidths i get put + } for + + /sbs [ + 1 d1w {} forall checkwidths {} forall d2w {} forall 1 1 + ] def + + % Return the arguments + /retval 1 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/rsslimited load 0 1 dict put +% --END ENCODER rsslimited-- + +% --BEGIN ENCODER rssexpanded-- +/rssexpanded { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /getRSSwidths { + /mw exch def + /nm exch def + /val exch def + /j 0 def /i 0 def { + /v () def + mw 1 ne {/v i mw 4 string cvrs def} if + 0 v {48 sub add} forall 4 add nm eq { + j val eq {exit} if + /j j 1 add def + } if + /i i 1 add def + } loop + [4 {1} repeat v {47 sub} forall] v length 4 getinterval + } bind def + + /binval [barcode {48 sub} forall] def + /datalen binval length 12 idiv def + + /tab174 [ + 347 0 12 5 7 2 87 4 + 1387 348 10 7 5 4 52 20 + 2947 1388 8 9 4 5 30 52 + 3987 2948 6 11 3 6 10 104 + 4191 3988 4 13 1 8 1 204 + ] def + + /dxw datalen array def + + 0 1 datalen 1 sub { + + /x exch def + + /d binval x 12 mul 12 getinterval def + /d 0 0 1 11 {/j exch def 2 11 j sub exp cvi d j get mul add} for def + + /j 0 def { + d tab174 j get le { + tab174 j 1 add 7 getinterval {} forall + /dte exch def /dto exch def + /dmwe exch def /dmwo exch def + /dele exch def /delo exch def + /dgs exch def + exit + } if + /j j 8 add def + } loop + + /dwo d dgs sub dte idiv delo dmwo getRSSwidths def + /dwe d dgs sub dte mod dele dmwe getRSSwidths def + + /dw 8 array def + x 2 mod 0 eq { + 0 1 3 { + /j exch def + dw 7 j 2 mul sub dwo j get put + dw 6 j 2 mul sub dwe j get put + } for + } { + 0 1 3 { + /j exch def + dw j 2 mul dwo j get put + dw j 2 mul 1 add dwe j get put + } for + } ifelse + + dxw x dw put + + } for + + /widths [ + dxw {{} forall} forall + ] def + + /checkweights [ + 77 96 32 81 27 9 3 1 + 20 60 180 118 143 7 21 63 + 205 209 140 117 39 13 145 189 + 193 157 49 147 19 57 171 91 + 132 44 85 169 197 136 186 62 + 185 133 188 142 4 12 36 108 + 50 87 29 80 97 173 128 113 + 150 28 84 41 123 158 52 156 + 166 196 206 139 187 203 138 46 + 76 17 51 153 37 111 122 155 + 146 119 110 107 106 176 129 43 + 16 48 144 10 30 90 59 177 + 164 125 112 178 200 137 116 109 + 70 210 208 202 184 130 179 115 + 190 204 68 93 31 151 191 134 + 148 22 66 198 172 94 71 2 + 40 154 192 64 162 54 18 6 + 120 149 25 75 14 42 126 167 + 175 199 207 69 23 78 26 79 + 103 98 83 38 114 131 182 124 + 159 53 88 170 127 183 61 161 + 55 165 73 8 24 72 5 15 + 89 100 174 58 160 194 135 45 + ] def + + /checksum 0 def + 0 1 widths length 1 sub { + /i exch def + /checksum checksum widths i get checkweights i get mul add def + } for + /checksum checksum 211 mod datalen 3 sub 211 mul add def + + /i 0 def { + checksum tab174 i get le { + tab174 i 1 add 7 getinterval {} forall + /cte exch def /cto exch def + /cmwe exch def /cmwo exch def + /cele exch def /celo exch def + /cgs exch def + exit + } if + /i i 8 add def + } loop + + /cwo checksum cgs sub cte idiv celo cmwo getRSSwidths def + /cwe checksum cgs sub cte mod cele cmwe getRSSwidths def + + /cw 8 array def + 0 1 3 { + /i exch def + cw i 2 mul cwo i get put + cw i 2 mul 1 add cwe i get put + } for + + /finderwidths [ + 1 8 4 1 1 1 1 4 8 1 + 3 6 4 1 1 1 1 4 6 3 + 3 4 6 1 1 1 1 6 4 3 + 3 2 8 1 1 1 1 8 2 3 + 2 6 5 1 1 1 1 5 6 2 + 2 2 9 1 1 1 1 9 2 2 + ] def + + /finderseq [ + [0 1] + [0 3 2] + [0 5 2 7] + [0 9 2 7 4] + [0 9 2 7 6 11] + [0 9 2 7 8 11 10] + [0 1 2 3 4 5 6 7] + [0 1 2 3 4 5 6 9 8] + [0 1 2 3 4 5 6 9 10 11] + [0 1 2 3 4 7 6 9 8 11 10] + ] def + + /seq finderseq datalen 2 add 2 idiv 2 sub get def + /fxw seq length array def + 0 1 seq length 1 sub { + /x exch def + fxw x finderwidths seq x get 5 mul 5 getinterval put + } for + + /sbs [ + 1 + cw {} forall + 0 1 datalen 1 sub { + /i exch def + i 2 mod 0 eq {fxw i 2 idiv get {} forall} if + dxw i get {} forall + } for + 1 1 + ] def + + % Return the arguments + /retval 1 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/rssexpanded load 0 1 dict put +% --END ENCODER rssexpanded-- + % --BEGIN ENCODER code2of5-- /code2of5 { @@ -1378,7 +1933,7 @@ 0 begin % Confine variable to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def @@ -1458,13 +2013,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1479,7 +2034,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def @@ -1557,23 +2112,23 @@ sbs barlen 6 mul 6 add encs checksum1 get putinterval sbs barlen 6 mul 12 add encs checksum2 get putinterval includecheckintext { - txt barlen [barchars checksum1 1 getinterval xpos textpos textfont 0] put + txt barlen [barchars checksum1 1 getinterval xpos textpos textfont textsize] put /enc encs checksum1 get def 0 1 5 { % xpos+=width of the character /xpos exch enc exch get 48 sub xpos add def } for - txt barlen 1 add [barchars checksum2 1 getinterval xpos textpos textfont 0] put + txt barlen 1 add [barchars checksum2 1 getinterval xpos textpos textfont textsize] put } { - txt barlen [() xpos textpos textfont 0] put - txt barlen 1 add [() xpos textpos textfont 0] put + txt barlen [() xpos textpos textfont textsize] put + txt barlen 1 add [() xpos textpos textfont textsize] put } ifelse sbs barlen 6 mul 18 add encs 11 get putinterval } { sbs barlen 6 mul 6 add encs checksum1 get putinterval includecheckintext { - txt barlen [barchars checksum1 1 getinterval xpos textpos textfont 0] put + txt barlen [barchars checksum1 1 getinterval xpos textpos textfont textsize] put } { - txt barlen [() xpos textpos textfont 0] put + txt barlen [() xpos textpos textfont textsize] put } ifelse sbs barlen 6 mul 12 add encs 11 get putinterval } ifelse @@ -1583,13 +2138,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1604,7 +2159,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def % Enable/disable checkdigit @@ -1697,13 +2252,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1712,6 +2267,270 @@ /rationalizedCodabar load 0 1 dict put % --END ENCODER rationalizedCodabar-- +% --BEGIN ENCODER onecode-- +/onecode { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 0.175 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /barlen barcode length def + + /normalize { + /base exch def + /num exch def + num length 1 sub -1 1 { + /i exch def + num i 1 sub 2 copy get num i get base idiv add put + num i num i get base mod put + } for + { %loop - extend input as necessary + num 0 get base lt {exit} if + /num [0 num {} forall] def + num 0 num 0 get num 1 get base idiv add put + num 1 num 1 get base mod put + } loop + % Trim leading zeros + /num [/i true def num {dup 0 eq i and {pop} {/i false def} ifelse} forall] def + num length 0 eq {/num [0] def} if + num + } bind def + + /bigadd { + 2 copy length exch length + 2 copy sub abs /offset exch def + lt {exch} if + /a exch def /b exch def + 0 1 b length 1 sub { + dup a exch offset add 2 copy get b 5 -1 roll get add put + } for + a + } bind def + + % Conversion of data fields into binary data + barlen 20 eq {[0]} if + barlen 25 eq {[1]} if + barlen 29 eq {[1 0 0 0 0 1]} if + barlen 31 eq {[1 0 0 0 1 0 0 0 0 1]} if + /binval exch [barcode 20 barlen 20 sub getinterval {48 sub} forall] bigadd def + /binval [binval {} forall barcode 0 get 48 sub] def + /binval [binval {5 mul} forall] [barcode 1 get 48 sub] bigadd 10 normalize def + /binval [binval {} forall barcode 2 18 getinterval {48 sub} forall] def + + % Conversion of binary data into byte array + /bytes 13 array def + /bintmp [binval {} forall] def + 12 -1 0 { + /i exch def + 0 1 bintmp length 2 sub { + /j exch def + bintmp j 1 add 2 copy get bintmp j get 256 mod 10 mul add put + bintmp j bintmp j get 256 idiv put + } for + bytes i bintmp bintmp length 1 sub get 256 mod put + bintmp bintmp length 1 sub 2 copy get 256 idiv put + } for + + % Generation of 11-bit CRC on byte array + /fcs 2047 def + /dat bytes 0 get 5 bitshift def + 6 { + fcs dat xor 1024 and 0 ne { + /fcs fcs 1 bitshift 3893 xor def + } { + /fcs fcs 1 bitshift def + } ifelse + /fcs fcs 2047 and def + /dat dat 1 bitshift def + } repeat + 1 1 12 { + bytes exch get 3 bitshift /dat exch def + 8 { + fcs dat xor 1024 and 0 ne { + /fcs fcs 1 bitshift 3893 xor def + } { + /fcs fcs 1 bitshift def + } ifelse + /fcs fcs 2047 and def + /dat dat 1 bitshift def + } repeat + } for + + % Conversion from binary data to codewords + /codewords 10 array def + 9 -1 0 { + /i exch def + i 9 eq { + /b 636 def + } { + /b 1365 def + } ifelse + 0 1 binval length 2 sub { + /j exch def + binval j 1 add 2 copy get binval j get b mod 10 mul add put + binval j binval j get b idiv put + } for + codewords i binval binval length 1 sub get b mod put + binval binval length 1 sub 2 copy get b idiv put + } for + + % Inserting additional information into codewords + codewords 9 codewords 9 get 2 mul put + fcs 1024 and 0 ne { + codewords 0 codewords 0 get 659 add put + } if + + % Conversion from codewords to characters + /tab513 1287 dict def + /lo 0 def + /hi 1286 def + 0 1 8191 { + { % no loop - provides common exit point + /i exch def + /onbits 0 def + 0 1 12 { + i exch 1 exch bitshift and 0 ne { + /onbits onbits 1 add def + } if + } for + onbits 5 ne {exit} if + /j i def + /rev 0 def + 16 { + /rev rev 1 bitshift j 1 and or def + /j j -1 bitshift def + } repeat + /rev rev -3 bitshift def + rev i lt {exit} if + rev i eq { + tab513 hi i put + /hi hi 1 sub def + } { + tab513 lo i put + tab513 lo 1 add rev put + /lo lo 2 add def + } ifelse + exit + } loop + } for + + /tab213 78 dict def + /lo 0 def + /hi 77 def + 0 1 8191 { + { % no loop - provides common exit point + /i exch def + /onbits 0 def + 0 1 12 { + i exch 1 exch bitshift and 0 ne { + /onbits onbits 1 add def + } if + } for + onbits 2 ne {exit} if + /j i def + /rev 0 def + 16 { + /rev rev 1 bitshift j 1 and or def + /j j -1 bitshift def + } repeat + /rev rev -3 bitshift def + rev i lt {exit} if + rev i eq { + tab213 hi i put + /hi hi 1 sub def + } { + tab213 lo i put + tab213 lo 1 add rev put + /lo lo 2 add def + } ifelse + exit + } loop + } for + + /chars 10 array def + 0 1 9 { + /i exch def + codewords i get dup 1286 le { + tab513 exch get + } { + tab213 exch 1287 sub get + } ifelse + chars i 3 -1 roll put + } for + + 9 -1 0 { + /i exch def + 2 i exp cvi fcs and 0 ne { + chars i chars i get 8191 xor put + } if + } for + + % Conversion from characters to the OneCode encoding + /barmap [ + 7 2 4 3 1 10 0 0 9 12 2 8 5 5 6 11 8 9 3 1 + 0 1 5 12 2 5 1 8 4 4 9 11 6 3 8 10 3 9 7 6 + 5 11 1 4 8 5 2 12 9 10 0 2 7 1 6 7 3 6 4 9 + 0 3 8 6 6 4 2 7 1 1 9 9 7 10 5 2 4 0 3 8 + 6 2 0 4 8 11 1 0 9 8 3 12 2 6 7 7 5 1 4 10 + 1 12 6 9 7 3 8 0 5 8 9 7 4 6 2 10 3 4 0 5 + 8 4 5 7 7 11 1 9 6 0 9 6 0 6 4 8 2 1 3 2 + 5 9 8 12 4 11 6 1 9 5 7 4 3 3 1 2 0 7 2 0 + 1 3 4 1 6 10 3 5 8 7 9 4 2 11 5 6 0 8 7 12 + 4 2 8 1 5 10 3 0 9 3 0 9 6 5 2 4 7 8 1 7 + 5 0 4 5 2 3 0 10 6 12 9 2 3 11 1 6 8 8 7 9 + 5 4 0 11 1 5 2 2 9 1 4 12 8 3 6 6 7 0 3 7 + 4 7 7 5 0 12 1 11 2 9 9 0 6 8 5 3 3 10 8 2 + ] def + + /bbs 65 array def + /bhs 65 array def + 0 1 64 { + /i exch def + /dec chars barmap i 4 mul get get 2 barmap i 4 mul 1 add get exp cvi and 0 ne def + /asc chars barmap i 4 mul 2 add get get 2 barmap i 4 mul 3 add get exp cvi and 0 ne def + dec not asc not and { + bbs i 3 height mul 8 div put + bhs i 2 height mul 8 div put + } if + dec not asc and { + bbs i 3 height mul 8 div put + bhs i 5 height mul 8 div put + } if + dec asc not and { + bbs i 0 height mul 8 div put + bhs i 5 height mul 8 div put + } if + dec asc and { + bbs i 0 height mul 8 div put + bhs i 8 height mul 8 div put + } if + } for + + /retval 4 dict def + retval (bbs) bbs put + retval (bhs) bhs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put + retval (opt) useropts put + retval + + end + +} bind def +/onecode load 0 1 dict put +% --END ENCODER onecode-- + % --BEGIN ENCODER postnet-- /postnet { @@ -1720,7 +2539,7 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text @@ -1728,7 +2547,7 @@ /textfont /Courier def /textsize 10 def /textpos -7 def - /height 0.2 def + /height 0.125 def % Parse the input options options { @@ -1780,7 +2599,7 @@ heights j enc j 1 getinterval cvi height mul 5 div put } for bhs i 5 mul 1 add heights putinterval % Put encoded digit into sbs - txt i [barcode i 1 getinterval i 20 mul 4 add textpos textfont textsize] put + txt i [barcode i 1 getinterval i 5 mul 1 add 3.312 mul textpos textfont textsize] put /checksum checksum indx add def % checksum+=indx } for @@ -1795,9 +2614,9 @@ bhs barlen 5 mul 1 add heights putinterval includecheckintext { - txt barlen [barchars checksum 1 getinterval barlen 20 mul 4 add textpos textfont textsize] put + txt barlen [barchars checksum 1 getinterval barlen 5 mul 1 add 3.312 mul textpos textfont textsize] put } { - txt barlen [( ) barlen 10 mul 4 add textpos textfont textsize] put + txt barlen [( ) barlen 5 mul 1 add 72 mul 25 div textpos textfont textsize] put } ifelse % Put end character @@ -1812,15 +2631,11 @@ /retval 1 dict def retval (bhs) bhs put retval (bbs) [bhs length {0} repeat] put - /sbs bhs length 2 mul 1 sub string def - 0 1 sbs length 1 sub { - sbs exch 50 put % Fill with 2s - } for - retval (sbs) sbs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1835,7 +2650,7 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text @@ -1843,7 +2658,7 @@ /textfont /Courier def /textsize 10 def /textpos -7 def - /height 0.3 def + /height 0.175 def % Parse the input options options { @@ -1888,7 +2703,7 @@ pop pop % Discard seek and post /enc encs indx get def % Get the indxth encoding encstr i 4 mul 1 add enc putinterval - txt i [barcode i 1 getinterval i 16 mul 4 add textpos textfont textsize] put + txt i [barcode i 1 getinterval i 4 mul 1 add 3.312 mul textpos textfont textsize] put /checksumrow checksumrow indx 6 idiv add def /checksumcol checksumcol indx 6 mod add def } for @@ -1898,9 +2713,9 @@ /enc encs checksum get def encstr barlen 4 mul 1 add enc putinterval includecheckintext { - txt barlen [barchars checksum 1 getinterval barlen 16 mul 4 add textpos textfont textsize] put + txt barlen [barchars checksum 1 getinterval barlen 4 mul 1 add 3.312 mul textpos textfont textsize] put } { - txt barlen [( ) barlen 16 mul 4 add textpos textfont textsize] put + txt barlen [( ) barlen 4 mul 1 add 3.312 mul textpos textfont textsize] put } ifelse % Put end character @@ -1932,15 +2747,11 @@ /retval 4 dict def retval (bbs) bbs put retval (bhs) bhs put - /sbs bhs length 2 mul 1 sub string def - 0 1 sbs length 1 sub { - sbs exch 50 put % Fill with 2s - } for - retval (sbs) sbs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -1955,14 +2766,15 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string - /includetext false def % Enable/disable text + /includetext false def % Enable/disable text /textfont /Courier def /textsize 10 def /textpos -7 def - /height 0.3 def + /height 0.175 def + /custinfoenc (character) def % Parse the input options options { @@ -1985,50 +2797,72 @@ (033) (103) (113) (123) (130) (131) (132) (133) (203) (213) (223) (230) (231) (232) (233) (303) (313) (323) (330) (331) (332) (333) (003) (013) + (00) (01) (02) (10) (11) (12) (20) (21) (22) (30) (13) (3) ] def % Create a string of the available characters /barchars (ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz #) def - % Create an array of numeric mappings - /nencs - [ (00) (01) (02) (10) (11) - (12) (20) (21) (22) (30) - ] def - /barlen barcode length def - /encstr 37 string def - /txt 8 array def + barcode 0 2 getinterval (11) eq {37} if + barcode 0 2 getinterval (59) eq {52} if + barcode 0 2 getinterval (62) eq {67} if + /encstr exch string def + /txt barlen 2 sub array def % Put start character - encstr 0 encs 64 get putinterval + encstr 0 encs 74 get putinterval - % Encode the type + % Encode the FCC 0 1 1 { /i exch def - nencs barcode i 1 getinterval cvi get + encs barcode i 1 getinterval cvi 64 add get encstr i 2 mul 2 add 3 2 roll putinterval } for % Encode the DPID 2 1 9 { /i exch def - nencs barcode i 1 getinterval cvi get + encs barcode i 1 getinterval cvi 64 add get encstr i 2 mul 2 add 3 2 roll putinterval - txt i 2 sub [barcode i 1 getinterval i 2 sub 8 mul 24 add textpos textfont textsize] put + txt i 2 sub [barcode i 1 getinterval i 2 sub 2 mul 6 add 3.312 mul textpos textfont textsize] put } for + + % Encode the customer information + custinfoenc (numeric) eq { + 0 1 barlen 11 sub { + /i exch def + encs barcode i 10 add 1 getinterval cvi 64 add get + encstr i 2 mul 22 add 3 2 roll putinterval + txt i 8 add [barcode i 10 add 1 getinterval i 2 mul 22 add 3.312 mul textpos textfont textsize] put + } for + /ciflen barlen 10 sub 2 mul def + } { + 0 1 barlen 11 sub { + /i exch def + barcode i 10 add 1 getinterval barchars exch search + pop + length /indx exch def + pop pop + /enc encs indx get def + encstr i 3 mul 22 add enc putinterval + txt i 8 add [barcode i 10 add 1 getinterval i 3 mul 22 add 3.312 mul textpos textfont textsize] put + } for + /ciflen barlen 10 sub 3 mul def + } ifelse - % Add a pad character - encstr 22 encs 65 get putinterval + % Add any filler characters + 22 ciflen add 1 encstr length 14 sub { + encstr exch encs 75 get putinterval + } for - % Create the 64x64 multiplication table + % Create the 64x64 Reed-Solomon table /rstable 64 64 mul array def rstable 0 [ 64 {0} repeat ] putinterval rstable 64 [ 0 1 63 {} for ] putinterval /prev 1 def - 1 1 63 { - /i exch def + 64 { /next prev 1 bitshift def next 64 and 0 ne { /next next 67 xor def @@ -2042,19 +2876,19 @@ } if } for /prev next def - } for + } repeat - % Calculate the reed-solomon codes for triples - /rscodes 11 array def + % Calculate the Reed-Solomon codes for triples + /rscodes encstr length 16 sub 3 idiv 4 add array def rscodes 0 [ 4 {0} repeat ] putinterval - 2 3 22 { + 2 3 encstr length 16 sub { /i exch def rscodes rscodes length i 2 sub 3 idiv sub 1 sub encstr i 1 getinterval cvi 16 mul encstr i 1 add 1 getinterval cvi 4 mul add encstr i 2 add 1 getinterval cvi add put - } for + } for rscodes length 5 sub -1 0 { /i exch def 0 1 4 { @@ -2064,7 +2898,6 @@ xor put } for } for - /checkcode (000000000000) def 0 1 3 { /i exch def @@ -2073,9 +2906,9 @@ } for % Put checkcode and end characters - encstr 23 checkcode putinterval - encstr 35 encs 64 get putinterval - + encstr encstr length 14 sub checkcode putinterval + encstr encstr length 2 sub encs 74 get putinterval + /bbs encstr length array def /bhs encstr length array def 0 1 encstr length 1 sub { @@ -2102,15 +2935,11 @@ /retval 4 dict def retval (bbs) bbs put retval (bhs) bhs put - /sbs bhs length 2 mul 1 sub string def - 0 1 sbs length 1 sub { - sbs exch 50 put % Fill with 2s - } for - retval (sbs) sbs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -2125,7 +2954,7 @@ 0 begin /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text @@ -2133,7 +2962,7 @@ /textfont /Courier def /textsize 10 def /textpos -7 def - /height 0.3 def + /height 0.175 def % Parse the input options options { @@ -2172,7 +3001,7 @@ pop pop % Discard seek and post /enc encs indx get def % Get the indxth encoding encstr i 4 mul enc putinterval - txt i [barcode i 1 getinterval i 16 mul textpos textfont textsize] put + txt i [barcode i 1 getinterval i 4 mul 3.312 mul textpos textfont textsize] put } for /bbs encstr length array def @@ -2201,15 +3030,11 @@ /retval 4 dict def retval (bbs) bbs put retval (bhs) bhs put - /sbs bhs length 2 mul 1 sub string def - 0 1 sbs length 1 sub { - sbs exch 50 put % Fill with 2s - } for - retval (sbs) sbs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -2224,7 +3049,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includecheck false def % Enable/disable checkdigit @@ -2304,13 +3129,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -2325,7 +3150,7 @@ 0 begin % Confine variables to local scope /options exch def % We are given an option string - /renderopts options def + /useropts options def /barcode exch def % We are given a barcode string /includetext false def % Enable/disable text @@ -2422,13 +3247,13 @@ % Return the arguments /retval 1 dict def - retval (sbs) sbs put + retval (sbs) [sbs {48 sub} forall] put retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put includetext { retval (txt) txt put } if - retval (opt) renderopts put + retval (opt) useropts put retval end @@ -2446,26 +3271,26 @@ /barcode exch def % We are given a barcode string barcode (fima) eq { - /sbs (111515111) def - /bhs [.25 .25 .25 .25 .25] def + /sbs [2.25 2.25 2.25 11.25 2.25 11.25 2.25 2.25 2.25] def + /bhs [.625 .625 .625 .625 .625] def /bbs [0 0 0 0 0] def } if barcode (fimb) eq { - /sbs (13111311131) def - /bhs [.25 .25 .25 .25 .25 .25] def + /sbs [2.25 6.75 2.25 2.25 2.25 6.25 2.25 2.25 2.25 6.75 2.25] def + /bhs [.625 .625 .625 .625 .625 .625] def /bbs [0 0 0 0 0 0] def } if barcode (fimc) eq { - /sbs (11131313111) def - /bhs [.25 .25 .25 .25 .25 .25] def + /sbs [2.25 2.25 2.25 6.75 2.25 6.75 2.25 6.75 2.25 2.25 2.25] def + /bhs [.625 .625 .625 .625 .625 .625] def /bbs [0 0 0 0 0 0] def } if barcode (fimd) eq { - /sbs (1111131311111) def - /bhs [.25 .25 .25 .25 .25 .25 .25] def + /sbs [2.25 2.25 2.25 2.25 2.25 6.75 2.25 6.75 2.25 2.25 2.25 2.25 2.25] def + /bhs [.625 .625 .625 .625 .625 .625 .625] def /bbs [0 0 0 0 0 0 0] def } if @@ -2489,19 +3314,16 @@ 0 begin % Confine variables to local scope /args exch def % We are given some arguments - /sbs args (sbs) get def - /bhs args (bhs) get def - /bbs args (bbs) get def - /renderopts args (opt) get def - - % Get the text if known, otherwise it is empty - args (txt) known { - /txt args (txt) get def - } { - /txt [] def - } ifelse % Default options + /sbs [] def + /bhs [] def + /bbs [] def + /txt [] def + /barcolor (unset) def + /textcolor (unset) def + /bordercolor (unset) def + /backgroundcolor (unset) def /inkspread 0.15 def /width 0 def /barratio 1 def @@ -2512,13 +3334,27 @@ /bordertop 1 def /borderbottom 1 def /borderwidth 0.5 def - - % Parse the render options - renderopts { + /guardwhitespace false def + /guardleftpos 0 def + /guardleftypos 0 def + /guardrightpos 0 def + /guardrightypos 0 def + /guardwidth 6 def + /guardheight 7 def + + % Apply the renderer options + args {exch cvlit exch def} forall + + % Parse the user options + opt { token false eq {exit} if dup length string cvs (=) search true eq {cvlit exch pop exch def} {cvlit true def} ifelse } loop - + + /barcolor barcolor cvlit def + /textcolor textcolor cvlit def + /bordercolor bordercolor cvlit def + /backgroundcolor backgroundcolor cvlit def /inkspread inkspread cvr def /width width cvr def /barratio barratio cvr def @@ -2528,56 +3364,110 @@ /bordertop bordertop cvr def /borderbottom borderbottom cvr def /borderwidth borderwidth cvr def + /guardleftpos guardleftpos cvr def + /guardleftypos guardleftypos cvr def + /guardrightpos guardrightpos cvr def + /guardrightypos guardrightypos cvr def + /guardwidth guardwidth cvr def + /guardheight guardheight cvr def % Create bar elements and put them into the bars array /bars sbs length 1 add 2 idiv array def - /x 0.00 def + /x 0.00 def /maxh 0 def 0 1 sbs length 1 add 2 idiv 2 mul 2 sub { /i exch def i 2 mod 0 eq { % i is even - /d sbs i get 48 sub barratio mul barratio sub 1 add def % d=digit*r-r+1 + /d sbs i get barratio mul barratio sub 1 add def % d=digit*r-r+1 /h bhs i 2 idiv get 72 mul def % Height from bhs /c d 2 div x add def % Centre of the bar = x + d/2 /y bbs i 2 idiv get 72 mul def % Baseline from bbs /w d inkspread sub def % bar width = digit - inkspread bars i 2 idiv [h c y w] put % Add the bar entry + h maxh gt {/maxh h def} if } { - /d sbs i get 48 sub spaceratio mul spaceratio sub 1 add def % d=digit*r-r+1 + /d sbs i get spaceratio mul spaceratio sub 1 add def % d=digit*r-r+1 } ifelse /x x d add def % x+=d } for gsave + currentpoint translate + % Force symbol to given width width 0 ne { width 72 mul x div 1 scale } if + % Display the border and background + newpath + borderleft neg borderbottom neg moveto + x borderleft add borderright add 0 rlineto + 0 maxh borderbottom add bordertop add rlineto + x borderleft add borderright add neg 0 rlineto + 0 maxh borderbottom add bordertop add neg rlineto + closepath + backgroundcolor (unset) ne { + gsave + (< >) dup 1 backgroundcolor putinterval cvx exec {255 div} forall setrgbcolor + fill + grestore + } if + showborder { + gsave + bordercolor (unset) ne { + (< >) dup 1 bordercolor putinterval cvx exec {255 div} forall setrgbcolor + } if + borderwidth setlinewidth stroke + grestore + } if + % Display the bars for elements in the bars array + gsave + barcolor (unset) ne { + (< >) dup 1 barcolor putinterval cvx exec {255 div} forall setrgbcolor + } if bars { {} forall - setlinewidth moveto 0 exch rlineto stroke + newpath setlinewidth moveto 0 exch rlineto stroke } forall - - % Display the border - showborder { - borderwidth setlinewidth - borderleft neg borderbottom neg moveto - x borderleft add borderright add 0 rlineto - 0 h borderbottom add bordertop add rlineto - x borderleft add borderright add neg 0 rlineto - 0 h borderbottom add bordertop add neg rlineto - closepath stroke - } if + grestore % Display the text for elements in the text array + textcolor (unset) ne { + (< >) dup 1 textcolor putinterval cvx exec {255 div} forall setrgbcolor + } if + /s 0 def /f () def txt { {} forall - dup 0 ne {exch findfont exch scalefont setfont} {pop pop} ifelse + 2 copy s ne exch f ne or { + 2 copy /s exch def /f exch def + exch findfont exch scalefont setfont + } { + pop pop + } ifelse moveto show } forall + % Display the guard elements + guardwhitespace { + 0.75 setlinewidth + guardleftpos 0 ne { + newpath + guardleftpos neg guardwidth add guardleftypos guardwidth 2 div add moveto + guardwidth neg guardheight -2 div rlineto + guardwidth guardheight -2 div rlineto + stroke + } if + guardrightpos 0 ne { + newpath + guardrightpos x add guardwidth sub guardrightypos guardheight 2 div add moveto + guardwidth guardheight -2 div rlineto + guardwidth neg guardheight -2 div rlineto + stroke + } if + } if + grestore end diff --git a/Master/texmf-dist/tex/latex/pst-barcode/pst-barcode.sty b/Master/texmf-dist/tex/latex/pst-barcode/pst-barcode.sty index 9379848ca16..73b57640a71 100644 --- a/Master/texmf-dist/tex/latex/pst-barcode/pst-barcode.sty +++ b/Master/texmf-dist/tex/latex/pst-barcode/pst-barcode.sty @@ -1,7 +1,8 @@ \RequirePackage{pstricks} -\ProvidesPackage{pst-barcode}[2005/07/24 package wrapper for +\ProvidesPackage{pst-barcode}[2006/07/23 package wrapper for pst-barcode.tex (hv)] \input{pst-barcode.tex} \ProvidesFile{pst-barcode.tex} [\filedate\space v\fileversion\space `PST-barcode' (hv)] +\IfFileExists{pst-barcode.pro}{\@addtofilelist{pst-barcode.pro}}{}% \endinput diff --git a/Master/texmf-dist/tpm/pst-barcode.tpm b/Master/texmf-dist/tpm/pst-barcode.tpm index 4400f0c86e1..c154721ec9a 100644 --- a/Master/texmf-dist/tpm/pst-barcode.tpm +++ b/Master/texmf-dist/tpm/pst-barcode.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/pst-barcode.zip"> <TPM:Name>pst-barcode</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/01/09 00:49:07</TPM:Date> + <TPM:Date>2006/07/23 21:21:43</TPM:Date> <TPM:Version></TPM:Version> <TPM:Creator>karl</TPM:Creator> <TPM:Title>Print barcodes using Postscript.</TPM:Title> @@ -21,12 +21,12 @@ distillation mechansism such as ps2pdf. <TPM:Author></TPM:Author> <TPM:Size>332326</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="83396"> + <TPM:RunFiles size="113673"> texmf-dist/dvips/pst-barcode/pst-barcode.pro texmf-dist/tex/latex/pst-barcode/pst-barcode.sty texmf-dist/tpm/pst-barcode.tpm </TPM:RunFiles> - <TPM:DocFiles size="248930"> + <TPM:DocFiles size="265800"> texmf-dist/doc/latex/pst-barcode/Changes texmf-dist/doc/latex/pst-barcode/README texmf-dist/doc/latex/pst-barcode/barcode.pdf |