summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips/pst-barcode
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-06-01 17:02:09 +0000
committerKarl Berry <karl@freefriends.org>2007-06-01 17:02:09 +0000
commit1bc72c65eb75d033585161c0ec24fe5248c5d2cd (patch)
tree6024333a2787aadeb3add41a6009c0ead539b5ca /Master/texmf-dist/dvips/pst-barcode
parent9be1534fe41a6da18ab8eda4f92a7ca40f0be8d0 (diff)
pst-barcode update (22may07)
git-svn-id: svn://tug.org/texlive/trunk@4401 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips/pst-barcode')
-rw-r--r--Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro243
1 files changed, 215 insertions, 28 deletions
diff --git a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro
index 0054cdac340..54cdffe33e8 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 2006-05-26
+% Barcode Writer in Pure PostScript - Version 2007-05-19
% http://www.terryburton.co.uk/barcodewriter/
%
-% Copyright (c) 2006 Terry Burton - tez@terryburton.co.uk
+% Copyright (c) 2007 Terry Burton - tez@terryburton.co.uk
%
% Permission is hereby granted, free of charge, to any
% person obtaining a copy of this software and associated
@@ -42,6 +42,9 @@
% --BEGIN TEMPLATE--
% --BEGIN ENCODER ean13--
+% --DESC: EAN-13
+% --EXAM: 977147396801
+% --EXOP: includetext guardwhitespace
/ean13 {
0 begin
@@ -180,6 +183,9 @@
% --END ENCODER ean13--
% --BEGIN ENCODER ean8--
+% --DESC: EAN-8
+% --EXAM: 01335583
+% --EXOP: includetext guardwhitespace height=0.5
/ean8 {
0 begin
@@ -278,6 +284,9 @@
% --END ENCODER ean8--
% --BEGIN ENCODER upca--
+% --DESC: UPC-A
+% --EXAM: 78858101497
+% --EXOP: includetext
/upca {
0 begin
@@ -403,6 +412,9 @@
% --END ENCODER upca--
% --BEGIN ENCODER upce--
+% --DESC: UPC-E
+% --EXAM: 0123456
+% --EXOP: includetext height=0.4
/upce {
0 begin
@@ -447,18 +459,37 @@
% Add checksum digit to barcode if length is odd
barlen 2 mod 0 ne {
- /pad barlen 1 add string def % Create pad one bigger than barcode
+ % Derive the equivalent UPC-A for its checksum
+ /upcacode (00000000000) def
+ barcode 6 get 48 sub 2 le {
+ upcacode 1 barcode 1 2 getinterval putinterval
+ upcacode 3 barcode 6 1 getinterval putinterval
+ upcacode 8 barcode 3 3 getinterval putinterval
+ } if
+ barcode 6 get 48 sub 3 eq {
+ upcacode 1 barcode 1 3 getinterval putinterval
+ upcacode 9 barcode 4 2 getinterval putinterval
+ } if
+ barcode 6 get 48 sub 4 eq {
+ upcacode 1 barcode 1 4 getinterval putinterval
+ upcacode 10 barcode 5 1 getinterval putinterval
+ } if
+ barcode 6 get 48 sub 5 ge {
+ upcacode 1 barcode 1 5 getinterval putinterval
+ upcacode 10 barcode 6 1 getinterval putinterval
+ } if
/checksum 0 def
- 0 1 barlen 1 sub {
- /i exch def
- /barchar barcode i get 48 sub def
- i 2 mod 0 ne {
- /checksum barchar checksum add def
- } {
- /checksum barchar 3 mul checksum add def
- } ifelse
+ 0 1 10 {
+ /i exch def
+ /barchar upcacode i get 48 sub def
+ i 2 mod 0 ne {
+ /checksum checksum barchar add def
+ } {
+ /checksum checksum barchar 3 mul add def
+ } ifelse
} for
/checksum 10 checksum 10 mod sub 10 mod def
+ /pad barlen 1 add string def % Create pad one bigger than barcode
pad 0 barcode putinterval % Add barcode to the start of the pad
pad barlen checksum 48 add put % Put ascii for checksum at end of pad
/barcode pad def % barcode=pad
@@ -538,6 +569,9 @@
% --END ENCODER upce--
% --BEGIN ENCODER ean5--
+% --DESC: EAN-5 (5 digit addon)
+% --EXAM: 90200
+% --EXOP: includetext guardwhitespace
/ean5 {
0 begin
@@ -651,6 +685,9 @@
% --END ENCODER ean5--
% --BEGIN ENCODER ean2--
+% --DESC: EAN-2 (2 digit addon)
+% --EXAM: 05
+% --EXOP: includetext guardwhitespace
/ean2 {
0 begin
@@ -750,6 +787,9 @@
% --BEGIN ENCODER isbn--
% --REQUIRES ean13--
+% --DESC: ISBN
+% --EXAM: 978-1-56592-479
+% --EXOP: includetext guardwhitespace
/isbn {
0 begin
@@ -864,6 +904,9 @@
% --END ENCODER isbn--
% --BEGIN ENCODER code128--
+% --DESC: Code 128
+% --EXAM: ^104^102Count^0990123456789^101!
+% --EXOP: includetext
/code128 {
0 begin % Confine variables to local scope
@@ -982,6 +1025,9 @@
% --END ENCODER code128--
% --BEGIN ENCODER code39--
+% --DESC: Code 39
+% --EXAM: THIS IS CODE 39
+% --EXOP: includetext includecheck includecheckintext
/code39 {
0 begin % Confine variables to local scope
@@ -1088,6 +1134,9 @@
% --END ENCODER code39--
% --BEGIN ENCODER code93--
+% --DESC: Code 93
+% --EXAM: THIS IS CODE 93
+% --EXOP: includetext includecheck
/code93 {
0 begin % Confine variables to local scope
@@ -1202,6 +1251,9 @@
% --END ENCODER code93--
% --BEGIN ENCODER interleaved2of5--
+% --DESC: Interleaved 2 of 5 (ITF)
+% --EXAM: 24012345678905
+% --EXOP: showborder borderwidth=4 borderleft=15 borderright=15 height=0.5 includecheck includetext includecheckintext textpos=-10
/interleaved2of5 {
0 begin % Confine variables to local scope
@@ -1331,6 +1383,9 @@
% --END ENCODER interleaved2of5--
% --BEGIN ENCODER rss14--
+% --DESC: Reduced Space Symbology 14 (RSS-14)
+% --EXAM: 24012345678905
+% --EXOP: height=0.3
/rss14 {
0 begin % Confine variables to local scope
@@ -1551,6 +1606,9 @@
% --END ENCODER rss14--
% --BEGIN ENCODER rsslimited--
+% --DESC: Reduced Space Symbology Limited (RSS-Limited)
+% --EXAM: 00978186074271
+% --EXOP: height=0.3
/rsslimited {
0 begin % Confine variables to local scope
@@ -1724,6 +1782,9 @@
% --END ENCODER rsslimited--
% --BEGIN ENCODER rssexpanded--
+% --DESC: Reduced Space Symbology Expanded (RSS-Expanded)
+% --EXAM: 000000010011001010100001000000010000
+% --EXOP: height=0.3
/rssexpanded {
0 begin % Confine variables to local scope
@@ -1925,7 +1986,70 @@
/rssexpanded load 0 1 dict put
% --END ENCODER rssexpanded--
+% --BEGIN ENCODER pharmacode--
+% --DESC: Pharmaceutical Binary Code
+% --EXAM: 117480
+% --EXOP: showborder
+/pharmacode {
+
+ 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 8 2.835 mul 72 div def
+ /nwidth 0.5 2.835 mul def
+ /wwidth 1.5 2.835 mul def
+ /swidth 1.0 2.835 mul 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
+ /nwidth nwidth cvr def
+ /wwidth wwidth cvr def
+ /swidth swidth cvr def
+
+ % Convert the integer into the paramacode string
+ /barcode barcode cvi 1 add 2 17 string cvrs def
+ /barcode barcode 1 barcode length 1 sub getinterval def
+
+ /barlen barcode length def % Length of the code
+ /sbs barlen 2 mul array def
+
+ 0 1 barlen 1 sub {
+ /i exch def
+ /enc barcode i 1 getinterval def
+ enc (0) eq {
+ sbs i 2 mul nwidth put
+ } {
+ sbs i 2 mul wwidth put
+ } ifelse
+ sbs i 2 mul 1 add swidth put
+ } for
+
+ % Return the arguments
+ /retval 2 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
+/pharmacode load 0 1 dict put
+% --END ENCODER pharmacode--
+
% --BEGIN ENCODER code2of5--
+% --DESC: Code 25
+% --EXAM: 01234567
+% --EXOP: includetext includecheck includecheckintext
/code2of5 {
% Thanks to Michael Landers
@@ -2029,6 +2153,9 @@
% --END ENCODER code2of5--
% --BEGIN ENCODER code11--
+% --DESC: Code 11
+% --EXAM: 0123456789
+% --EXOP: includetext includecheck includecheckintext
/code11 {
0 begin % Confine variables to local scope
@@ -2154,6 +2281,9 @@
% --END ENCODER code11--
% --BEGIN ENCODER rationalizedCodabar--
+% --DESC: Rationalized Codabar
+% --EXAM: A0123456789B
+% --EXOP: includetext includecheck includecheckintext
/rationalizedCodabar {
0 begin % Confine variables to local scope
@@ -2268,6 +2398,9 @@
% --END ENCODER rationalizedCodabar--
% --BEGIN ENCODER onecode--
+% --DESC: United States Postal Service OneCode
+% --EXAM: 0123456709498765432101234567891
+% --EXOP: barcolor=FF0000
/onecode {
0 begin
@@ -2532,10 +2665,11 @@
% --END ENCODER onecode--
% --BEGIN ENCODER postnet--
+% --DESC: United States Postal Service Postnet
+% --EXAM: 012345
+% --EXOP: includetext includecheckintext
/postnet {
- % Thanks to Ross McFarland
-
0 begin
/options exch def % We are given an option string
@@ -2645,6 +2779,9 @@
% --END ENCODER postnet--
% --BEGIN ENCODER royalmail--
+% --DESC: Royal Mail 4 State Customer Code (RM4SCC)
+% --EXAM: LE28HS9Z
+% --EXOP: includetext includecheckintext barcolor=FF0000
/royalmail {
0 begin
@@ -2761,6 +2898,9 @@
% --END ENCODER royalmail--
% --BEGIN ENCODER auspost--
+% --DESC: AusPost 4 State Customer Code
+% --EXAM: 5956439111ABA 9
+% --EXOP: includetext custinfoenc=character
/auspost {
0 begin
@@ -2949,6 +3089,9 @@
% --END ENCODER auspost--
% --BEGIN ENCODER kix--
+% --DESC: Royal Dutch TPG Post KIX 4-State Barcode
+% --EXAM: 1231FZ13XHS
+% --EXOP: includetext includecheckintext
/kix {
0 begin
@@ -3044,6 +3187,9 @@
% --END ENCODER kix--
% --BEGIN ENCODER msi--
+% --DESC: MSI Modified Plessey
+% --EXAM: 0123456789
+% --EXOP: includetext includecheck includecheckintext
/msi {
0 begin % Confine variables to local scope
@@ -3145,6 +3291,9 @@
% --END ENCODER msi--
% --BEGIN ENCODER plessey--
+% --DESC: Plessey
+% --EXAM: 01234ABCD
+% --EXOP: includetext includecheckintext
/plessey {
0 begin % Confine variables to local scope
@@ -3262,7 +3411,45 @@
/plessey load 0 1 dict put
% --END ENCODER plessey--
+% --BEGIN ENCODER raw--
+% --DESC: Raw bar space succession for custom symbologies
+% --EXAM: 331132131313411122131311333213114131131221323
+% --EXOP: height=0.5
+/raw {
+
+ 0 begin % Confine variables to local scope
+
+ /options exch def % We are given an option string
+ /useropts options def
+ /sbs 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
+
+ % Return the arguments
+ /retval 1 dict def
+ 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
+ retval (opt) useropts put
+ retval
+
+ end
+
+} bind def
+/raw load 0 1 dict put
+% --END ENCODER raw--
+
% --BEGIN ENCODER symbol--
+% --DESC: Miscellaneous symbols
+% --EXAM: fima
+% --EXOP: backgroundcolor=DD000011
/symbol {
0 begin % Confine variables to local scope
@@ -3399,6 +3586,17 @@
width 72 mul x div 1 scale
} if
+ % Set RGB or CMYK color depending on length of given hex string
+ /setanycolor {
+ /anycolor exch def
+ anycolor length 6 eq {
+ (< >) dup 1 anycolor putinterval cvx exec {255 div} forall setrgbcolor
+ } if
+ anycolor length 8 eq {
+ (< >) dup 1 anycolor putinterval cvx exec {255 div} forall setcmykcolor
+ } if
+ } bind def
+
% Display the border and background
newpath
borderleft neg borderbottom neg moveto
@@ -3407,26 +3605,17 @@
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
+ backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
showborder {
gsave
- bordercolor (unset) ne {
- (< >) dup 1 bordercolor putinterval cvx exec {255 div} forall setrgbcolor
- } if
+ bordercolor (unset) ne { bordercolor setanycolor } 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
+ barcolor (unset) ne { barcolor setanycolor } if
bars {
{} forall
newpath setlinewidth moveto 0 exch rlineto stroke
@@ -3434,9 +3623,7 @@
grestore
% Display the text for elements in the text array
- textcolor (unset) ne {
- (< >) dup 1 textcolor putinterval cvx exec {255 div} forall setrgbcolor
- } if
+ textcolor (unset) ne { textcolor setanycolor } if
/s 0 def /f () def
txt {
{} forall