drawing a Barcode without a Barcode font
matthias_livecode_150811 at m-r-d.de
Fri Jul 20 00:06:50 CEST 2018
Currently i am using a special 2of5i barcode font. The font .has only four characters (bars) in its set.
The code displays a
narrow space (blank) bar when the character is n
narrow black bar when N
wide space when w
wide black bar when W
The code can only display a pair number of digits. You cannot display a number with 23 digits.
So to display the number 590848500010000294926452
i have to enter the followingNnNnWnNwWnNwNnNwNnWnWwNnNwNnWnNwWnWnNnWwNwNnNnNnWwWwNnWnNnNwNwWnNnNnWwWwNnNnNwWnWnNwNnWnNwWnNwNnWwNnWnNwNnWnWwNnNwWnNwWnNnNwWnN
into the field. There is a special algorithm how to calculate the correct combination of the different bars, but that is not my problem.
What i want is to draw the code myself without using the font. So that´s why i asked if someone already has done this.
Btw: the code for calculation the code looks like this, i case someone is interested
function createBarcode tBarcode
if the number of chars of tBarcode is not 24
answer error "Fehler beim Erzeugen des Barcodes"
exit to top
put "NNWWN" into t0
put "WNNNW" into t1
put "NWNNW" into t2
put "WWNNN" into t3
put "NNWNW" into t4
put "WNWNN" into t5
put "NWWNN" into t6
put "NNNWW" into t7
put "WNNWN" into t8
put "NWNWN" into t9
put "" into tNewBarcode
repeat with i = 1 to 23 step 2
put char i to (i+1) of tBarcode into tPair
replace 1 with t1 in tPair
replace 2 with t2 in tPair
replace 3 with t3 in tPAir
replace 4 with t4 in tPair
replace 5 with t5 in tPair
replace 6 with t6 in tPair
replace 7 with t7 in tPair
replace 8 with t8 in tPair
replace 9 with t9 in tPair
replace 0 with t0 in tPair
put char 1 to 5 of tPair & toLower(char 6 to 10 of tPAir) into tPair
put "" into tNewPAir
repeat with j = 1 to 5
put char j of tPair &char j+5 of tPair after tNewPair
put tnewPair after tNewBarcode
> Am 19.07.2018 um 22:30 schrieb dunbarxx via use-livecode <use-livecode at lists.runrev.com>:
> So you are creating your own barcode, er, code? That is, you are, say,
> making three thin lines with thin spaces, and then three thick lines with
> thick spaces, and storing that pattern somewhere?
> And then you read that pattern and look up what it refers to?
> Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode