			TEMPLATE BARCODE
			----------------

(c) 2001, C&G Software
email : cg.software@free.fr

BARCODE is a template that displays and prints barcodes in a Clarion application. This template is a set of four functions that converts, sets up et calculates the barcodes.
Two fonts are furnished with the template : EAN13b.TTF and EAN13bh.TTF. These fonts should be registered in the Windows\Fonts directory.
Actually, only EAN13 and UPC-A barcodes are available in the template.

Function BARCODE
----------------
Prototype : 	BARCODE(code STRING, type STRING), STRING
BARCODE is the function that converts the barcode contained in the field 'code' into a string that will be displayed or printed with the appropriate font (EAN13b.TTF or EAN13bh.TTF).
example :	code = '1234567890123'  	! 13 digits, it's a EAN13 code
		codetoprint = BARCODE(code,'EAN13')
	or	codetoprint = BARCODE(code)  	! default is EAN13

Function BARCODECHECKSUM
------------------------
Prototype : 	BARCODECHECKSUM(code ANY, type STRING), BYTE
BARCODECHECKSUM is the function that calculates the checksum digit of a barcode from the 11 (UPC-A) or 12 (EAN13) significant digits of the barcode.
Example : 	code = '12345678901'   		! 11 digits, it'a a UPC-A barcode
		key  = BarcodeChecksum(code,'UPC-A')
		code = clip(code) & key

Functions BARCODECASSEL and BARCODECASSEH
----------------------------------------
Prototypes :	BARCODECASSEL(largeur ANY, hauteur *ANY, size BYTE),USHORT 
		BARCODECASSEH(largeur *ANY, hauteur ANY, size BYTE),USHORT 
These functions calculate the size of the font to use in function of the desired height or width of the barcode.
The sizes are also calculated in function of the desired format : half height (barcode:smallsize) or normal height (barcode:fullsize). The format decides which one is the correct font to use : EAN13bTTF for the full size or EAN13bh.TTF for the small size.
The missing parameter is returned in the correct field.
Example : 	width = 50        		! 50 millimeters
		casse = BarcodeCasseL(width, height, Barcode:Fullsize)
		! 'casse' will contain the size of the font
		! 'height' will contain the height in millimeters of the barcode that will be displayed in normal height (barcode:fullsize)

Example :	height = 25 			! 25 millimeters
		casse = BarcodeCasseH(width, height, Barcode:Smallsize)
		! 'casse' will contain the size of the font
		! 'width' will contain the width in millimeters of the barcode that will be printed in half height (barcode:smallsize)


How to insert the template
--------------------------
The template C&GBarcode.tpl and the file CGBarcod.TRN must be copied in the template directory of Clarion.
In the application, you must insert the template in the Global Extension then choose the type of barcode you want to use in the application (EAN13, UPC-A or both)

Copyright
---------
This template is free and may not be sold. If you modify this template or think about some functions we could add, you can (must ?) contact us at the following address : 

			cg.software@free.fr

