Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11274 > unrolled thread

Code128 with font

Started byStefan Dietl <info@sdsoft.it>
First post2018-01-08 16:19 +0100
Last post2018-01-12 07:47 +0100
Articles 4 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Code128 with font Stefan Dietl <info@sdsoft.it> - 2018-01-08 16:19 +0100
    Re: Code128 with font [solved] Stefan Dietl <info@sdsoft.it> - 2018-01-09 08:51 +0100
      Re: Code128 with font [solved] jorge.dextrasistemas@gmail.com - 2018-01-11 04:05 -0800
        Re: Code128 with font [solved] Stefan Dietl <info@sdsoft.it> - 2018-01-12 07:47 +0100

#11274 — Code128 with font

FromStefan Dietl <info@sdsoft.it>
Date2018-01-08 16:19 +0100
SubjectCode128 with font
Message-ID<fbhgfcFif6U1@mid.individual.net>
Hi,
does someone have the VO-code to create from a string the Code128-string 
for a Code128-barcode-font?

thanks
Stefan

N.B. I wrote it for EAN13, if someone need it, I like to share it.

[toc] | [next] | [standalone]


#11275 — Re: Code128 with font [solved]

FromStefan Dietl <info@sdsoft.it>
Date2018-01-09 08:51 +0100
SubjectRe: Code128 with font [solved]
Message-ID<fbjajiFd92aU1@mid.individual.net>
In reply to#11274
Info from here: http://www.jtbarton.com/Barcodes/Code128.aspx#FreeCode128

FUNCTION Code128( ccode AS STRING ) AS STRING PASCAL
LOCAL i, nlen AS DWORD
LOCAL cret, cx AS STRING
LOCAL nCodeX, nSum AS DWORD

	nCodeX := 104 //B:104, A:103, C:105
	
	nSum := nCodeX

	cret := CHR(nCodeX+100)
	nlen := SLen(ccode)
	FOR i := 1 UPTO nlen
		cx := SubStr3(ccode,i,1)
		nSum += ((Asc(cx)-32)*i)
		cret += cx
	NEXT
	cret += CHR( (nSum % 103)+32 )
	cret += CHR( 206 )

RETURN cret

[toc] | [prev] | [next] | [standalone]


#11285 — Re: Code128 with font [solved]

Fromjorge.dextrasistemas@gmail.com
Date2018-01-11 04:05 -0800
SubjectRe: Code128 with font [solved]
Message-ID<0d323ceb-f2c6-47e5-83fe-b721e62c1935@googlegroups.com>
In reply to#11275
El martes, 9 de enero de 2018, 4:51:16 (UTC-3), Stefan Dietl escribió:
> Info from here: http://www.jtbarton.com/Barcodes/Code128.aspx#FreeCode128
> 
> FUNCTION Code128( ccode AS STRING ) AS STRING PASCAL
> LOCAL i, nlen AS DWORD
> LOCAL cret, cx AS STRING
> LOCAL nCodeX, nSum AS DWORD
> 
> 	nCodeX := 104 //B:104, A:103, C:105
> 	
> 	nSum := nCodeX
> 
> 	cret := CHR(nCodeX+100)
> 	nlen := SLen(ccode)
> 	FOR i := 1 UPTO nlen
> 		cx := SubStr3(ccode,i,1)
> 		nSum += ((Asc(cx)-32)*i)
> 		cret += cx
> 	NEXT
> 	cret += CHR( (nSum % 103)+32 )
> 	cret += CHR( 206 )
> 
> RETURN cret

Please Stefan 
Paste your code for EAN13

Thanks in advance ! 
Jorge Accinelli
buenos aires

[toc] | [prev] | [next] | [standalone]


#11287 — Re: Code128 with font [solved]

FromStefan Dietl <info@sdsoft.it>
Date2018-01-12 07:47 +0100
SubjectRe: Code128 with font [solved]
Message-ID<fbr3vkF1hiuU1@mid.individual.net>
In reply to#11285
Am 11.01.2018 um 13:05 schrieb jorge.dextrasistemas@gmail.com:

> 
> Please Stefan
> Paste your code for EAN13
> 
> Thanks in advance !
> Jorge Accinelli
> buenos aires
> 

Hi Jorge, here the code

(A) Build the String for printing with a Barcode Font:
FUNCTION Ean13String( ccode AS STRING ) AS STRING PASCAL
LOCAL aZSatz AS ARRAY
LOCAL cBarcode AS STRING
LOCAL cChar AS STRING
LOCAL i AS DWORD
LOCAL nErstesZeichen AS DWORD

	nErstesZeichen := Val(SubStr3( cCode, 1, 1 ))

	// Nutzzeichen...
	cChar := SubStr3( cCode, 1, 1 )
	cBarCode := CHR(Val(cChar)+35)

	//Randzeichen
	cBarCode += "!"

	//Zeichen + Prüfziffer
	aZSatz := 	{;
					{ 1,1,1,1,1,1,3,3,3,3,3,3 },;
					{ 1,1,2,1,2,2,3,3,3,3,3,3 },;
					{ 1,1,2,2,1,2,3,3,3,3,3,3 },;
					{ 1,1,2,2,2,1,3,3,3,3,3,3 },;
					{ 1,2,1,1,2,2,3,3,3,3,3,3 },;
					{ 1,2,2,1,1,2,3,3,3,3,3,3 },;
					{ 1,2,2,2,1,1,3,3,3,3,3,3 },;
					{ 1,2,1,2,1,2,3,3,3,3,3,3 },;
					{ 1,2,1,2,2,1,3,3,3,3,3,3 },;
					{ 1,2,2,1,2,1,3,3,3,3,3,3 };
				}
	FOR i := 1 UPTO 12

		// Trennzeichen...
		IF i == 7
			cBarCode += "-"
		END

		cChar := SubStr3( cCode, i+1, 1 )
		IF aZSatz[nErstesZeichen+1][i] == 1
			cBarcode += cChar
		ELSEIF aZSatz[nErstesZeichen+1][i] == 2
			cBarcode += CHR(65+Val(cChar))
		ELSE
			cBarcode += CHR(97+Val(cChar))
		END
	NEXT

	//Randzeichen
	cBarCode += "!"

RETURN cBarcode

(B) Build a EAN13-number with checksum:
FUNC BuildEan13( ccode AS STRING ) AS STRING PASCAL

	ccode := PadR( ccode, 12, "0" )

	ccode += NTrim(Ean13Pruefziffer( ccode ))

RETURN ccode

FUNC Ean13Pruefziffer( cCode AS STRING ) AS DWORD PASCAL
LOCAL i AS DWORD
LOCAL nSumme AS DWORD
LOCAL nRest AS DWORD
LOCAL nPruefziffer AS DWORD
LOCAL arr AS ARRAY

	arr := {1,3,1,3,1,3,1,3,1,3,1,3}
	FOR i := 1 UPTO 12
		nSumme += Val(SubStr3(cCode,i,1)) * arr[i]
	NEXT

	nRest := nSumme % 10

	nPruefZiffer := 10 - nRest

RETURN IIF( nPruefZiffer == 10, 0, nPruefZiffer )

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web