IDAutomation.com, Inc.

Your Source for Quality Symbology

[IDAutomation.com Home Page]

Interleaved 2 of 5 for the Macintosh Technical Notes

This download package contains fonts for the Macintosh version of the Interleaved 2 of 5 bar code fonts. Be aware that using Interleaved 2 of 5 fonts on a Macintosh is a complicated process that is only recommended for advanced users and programmers. Some of our Font Automation Tools such as FileMaker Plugins, 4D Source Code and VBA for Microsoft Excel and Access allow cross-platform use of the code 128 fonts on the MAC and PC. If you cannot use one of these tools and you do not intend to write an application to format the font data, it is recommended that you use a Windows PC instead if it is possible.

Overview:

Macintosh font files consist of resources stored in the resource fork of a file. Windows files contain only the data fork. To further complicate things, Macintosh files must also be given a file type and creator to allow them to show up on the desktop with the proper icons, and to tell the Macintosh operating system what type of files they are.

Usage Procedure:

Step 1: Install the fonts

Macintosh font installation overview

This TrueType version is formatted for the Macintosh computer in MacBinary format. This encodes both resource and data forks into one file so it can be encoded in a ZIP file. Using this file on a MAC is a two step process:

  1. Expand the ZIP file: After the distribution file (which is in ZIP format) is copied to a folder on the MAC it must be expanded or decompressed so you can see all the font files in the distribution package.
  2. Decode the MacBinary font file: Within the distribution file, the individual font file you wish to use must be decoded and then copied into the system fonts folder. There are several MAC programs that can open ZIP files and decode MacBinary files. In our example below, we use Stuffit Expander available from Aladdin Systems.

To install the font on the Macintosh:

  1. We suggest you use the TrueType fonts if possible. The TrueType fonts end in ".MTT".
  2. Download and install Stuffit Expander on your Macintosh if you do not have an expander utility that can open ZIP files and decode MacBinary files.
  3. Open the ZIP distribution file that contains the fonts by dragging the ZIP file on the Stuffit Expander icon. The font files will be extracted from the ZIP distribution file and will appear in a subfolder of the folder you placed the ZIP file in. Open this subfolder to view the MacBinary font files.  At this point, you may want to view the documentation supplied with the font files. To do so just drag the Readme.htm file to the Netscape or Internet Explorer icon.
  4. Now we must decode the files from MacBinary format. Drag the font files that you wish to use to the Stuffit Expander icon.
  5. Drag the decoded font files to the System folder.
  6. Restart the application you wish to use the font with - some applications require you to restart the computer.
  7. The font should now be active in the font menu of your application.
  8. To create the correct output for the font, you will need to choose the font in your application and type in the corresponding letter.

Step 2: Format the barcode

After the fonts are installed, the appropriate start, stop and optional check characters must be added to create a correct barcode. You may refer to the Interleaved 2 of 5 Font Webpage for information on performing these calculations or write an application to perform them for you. To print barcodes from a MAC, you may need to create an application that prints the characters from their ASCII locations.

The character set is listed below in columns. The "ITF Code" column lists the character or function that the barcode scanner will read for the associated symbol. The columns ASCII, Char and Unicode are unique to our Interleaved 2of5 fonts. These columns designate the location in either ASCII or Unicode where the barcode symbol for the character resides. The column "Char" lists the character that resides at the ASCII location which can be used to print the corresponding symbol on a Windows system. Additional ASCII locations have been added to the MAC fonts for the start, stop and character values 94 to 99 because the Macintosh does not encode extended characters in the same way that Windows and UNIX systems do. To print the proper symbol on a MAC from ASCII, refer to the "MAC ASCII" column.

ITF Code ASCII * Unicode * Unicode
Char
MAC
ASCII
    ITF Code ASCII * Unicode * Unicode
Char
MAC
ASCII
na 0032 0020 space  na   53 0086 0056 V 086
00 0033 0021 ! 033   54 0087 0057 W 087
01 0034 0022 " 034   55 0088 0058 X 088
02 0035 0023 # 035   56 0089 0059 Y 089
03 0036 0024 $ 036   57 0090 005A Z 090
04 0037 0025 % 037   58 0091 005B [ 091
05 0038 0026 & 038   59 0092 005C \ 092
06 0039 0027 ' 039   60 0093 005D ] 093
07 0040 0028 ( 040   61 0094 005E ^ 094
08 0041 0029 ) 041   62 0095 005F _ 095
09 0042 002A * 042   63 0096 0060 ` 096
10 0043 002B + 043   64 0097 0061 a 097
11 0044 002C , 044   65 0098 0062 b 098
12 0045 002D - 045   66 0099 0063 c 099
13 0046 002E . 046   67 0100 0064 d 100
14 0047 002F / 047   68 0101 0065 e 101
15 0048 0030 0 048   69 0102 0066 f 102
16 0049 0031 1 049   71 0103 0067 g 103
17 0050 0032 2 050   71 0104 0068 h 104
18 0051 0033 3 051   72 0105 0069 i 105
19 0052 0034 4 052   73 0106 006A j 106
20 0053 0035 5 053   74 0107 006B k 107
21 0054 0036 6 054   75 0108 006C l 108
22 0055 0037 7 055   76 0109 006D m 109
23 0056 0038 8 056   77 0110 006E n 110
24 0057 0039 9 057   78 0111 006F o 111
25 0058 003A : 058   79 0112 0070 p 112
26 0059 003B ; 059   80 0113 0071 q 113
27 0060 003C < 060   81 0114 0072 r 114
28 0061 003D = 061   82 0115 0073 s 115
29 0062 003E > 062   83 0116 0074 t 116
30 0063 003F ? 063   84 0117 0075 u 117
31 0064 0040 @ 064   85 0118 0076 v 118
32 0065 0041 A 065   86 0119 0077 w 119
33 0066 0042 B 066   87 0120 0078 x 120
34 0067 0043 C 067   88 0121 0079 y 121
35 0068 0044 D 068   89 0122 007A z 122
36 0069 0045 E 069   90 0123 007B { 123
37 0070 0046 F 070   91 0124 007C | 124
38 0071 0047 G 071   92 0125 007D } 125
39 0072 0048 H 072   93 0126 007E ~ 126
40 0073 0049 I 073   94 0197 00C5 Å 136
41 0074 004A J 074   95 0198 00C6 Æ 137
42 0075 004B K 075   96 0199 00C7 Ç 138
43 0076 004C L 076   97 0200 00C8 È 139
44 0077 004D M 077   98 0201 00C9 É 140
45 0078 004E N 078   99 0202 00CA Ê 141
46 0079 004F O 079   START 0203 00CB Ë 142
47 0080 0050 P 080   STOP 0204 00CC Ì 143
48 0081 0051 Q 081            
49 0082 0052 R 082            
50 0083 0053 S 083            
51 0084 0054 T 084            
52 0085 0055 U 085            

The following C source code functions print Interleaved 2 of 5 from the MAC ASCII locations:


/*********************************************************************/
/* */
/* C++ Functions for Bar Code Fonts 1.4 */
/* */
/* Copyright, IDAutomation.com, Inc. 2002. All rights reserved. */
/* */
/* Visit http://www.BizFonts.com for more information. */
/* */
/* You may incorporate our Source Code in your application */
/* only if you own a valid Multi-user, Corporate or Distribution */
/* license from IDAutomation.com, Inc. for the associated font and */
/* the copyright notices are not removed from the source code. */
/* */
/* C++ users can add this library to their C++ applications */
/* and access the functions directly, for example: */
/* Code128b("abc 123-45"); */
/* */
/* Distributing our source code or fonts outside your */
/* organization requires a distribution license. */
/*********************************************************************/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>


/* ------------------------ */
/* System Variables */
/* ------------------------ */

static int StrCnt;
static char StrFunction [64][257];

/* ---------------------- */
/* Standard Prototypes */
/* ---------------------- */

extern int asc (char *);
extern char *mid (char *, int, int);
extern char *ltrim (char *);
extern char *rtrim (char *);

/* ------------------- */
/* User's Prototypes */
/* ------------------- */

extern char *Interleaved2of5 (char *);
extern char *Interleaved2of5Mod10(char *);

/* --------------------- */
/* Run Time Functions */
/* --------------------- */

extern char *mid (char *S, int start, int length)
{
if(++StrCnt==64) StrCnt = 0;
if (start > strlen(S)) { StrFunction[StrCnt][0]='\0'; }
else
{strncpy (StrFunction[StrCnt], &S [start-1], length);}
StrFunction[StrCnt][length]='\0';
return StrFunction[StrCnt];
}


extern char *ltrim (char *Z)
{
static int I;
I=0;
if (++StrCnt==64) StrCnt = 0;
for(;;)
{
I++;
if(strcmp(mid(Z,I,1)," ")!=0)break;
}
sprintf(StrFunction[StrCnt],"%s",mid(Z,I,256));
return StrFunction[StrCnt];
}


extern char *rtrim (char *Z)
{
static int I;
I=0;
if (++StrCnt==64) StrCnt = 0;
I=strlen(Z);
for(;;)
{
if(strcmp(mid(Z,I,1)," ")!=0)break;
I--;
}
sprintf(StrFunction[StrCnt],"%s",mid(Z,1,I));
return StrFunction[StrCnt];
}


extern int asc (char *z)
{
static int q;
q = 0;
memmove(&q,z,1);
return q;
}



/* ---------------------- */
/* User Subs/Functions */
/* ---------------------- */
extern char *Interleaved2of5 (char DataToEncode[])
{
static char DataToPrint[255];
static char OnlyCorrectData[255];
static char Printablestring[255];
static int I;
static char CurrentChar;
static char StartCode;
static char StopCode;
//reset array(s)
DataToPrint[0]=(char)0;
OnlyCorrectData[0]=(char)0;
Printablestring[0]=(char)0;
DataToEncode=rtrim(ltrim(DataToEncode));
/* Check to make sure data is numeric and remove dashes, etc. */
for(I=1;I<=strlen(DataToEncode);I++)
{
/* Add all numbers to OnlyCorrectData string */
if(isdigit(asc(mid(DataToEncode,I,1))))
{
sprintf(OnlyCorrectData,"%s%c",&OnlyCorrectData, asc(mid(DataToEncode,I,1)));
}
}
//sprintf(DataToEncode,"%s",&OnlyCorrectData);
/* Check for an even number of digits, add 0 if not even */
if(fmod(strlen(DataToEncode),2)==1)
{
sprintf(DataToEncode,"0%s",&OnlyCorrectData);
}
else
{
sprintf(DataToEncode,"%s",&OnlyCorrectData);
}

/* Assign start and stop codes */
StartCode=203;
StopCode=204;
for(I=1;I<=strlen(DataToEncode);I=I+2)
{
/* Get the value of each number pair */
CurrentChar= (((asc(mid(DataToEncode,I,1))))-48)*10; //First number
CurrentChar = (CurrentChar + (asc(mid(DataToEncode,I+1,1)))-48); //Second number plus first
/* == Get the ASCII value of CurrentChar according to chart by adding to the value == */
//sprintf(DataToPrint,"%s%c",&DataToPrint,CurrentChar+130);
if(CurrentChar<94) {sprintf(DataToPrint,"%s%c",&DataToPrint,CurrentChar+33);}
if(CurrentChar>93) {sprintf(DataToPrint,"%s%c",&DataToPrint,CurrentChar+42);}
}
/* Get Printable String */
sprintf(Printablestring,"%c%s%c",142,&DataToPrint,143);
/* Return PrintableString */
return Printablestring;
}


/*********************************************************************/
/* */
/* ANSI C Functions for Bar Code Fonts 1.4 */
/* */
/* Copyright, IDAutomation.com, Inc. 2002. All rights reserved. */
/* */
/* Visit http://www.BizFonts.com for more information. */
/* */
/* You may incorporate our Source Code in your application */
/* only if you own a valid Multi-user, Corporate or Distribution */
/* license from IDAutomation.com, Inc. for the associated font and */
/* the copyright notices are not removed from the source code. */
/* */
/* Distributing our source code or fonts outside your */
/* organization requires a distribution license. */
/*********************************************************************/



extern char *Interleaved2of5Mod10 (char DataToEncode[])
{
static char DataToEncode2[255];
static char Temp[255];
static char DataToPrint[255];
static char OnlyCorrectData[255];
static char Printablestring[255];
static int I;
static int CurrentChar;
static char StartCode;
static char StopCode;
static int Factor;
static int weightedTotal;
static int CheckDigit;
static char zero;
zero=48;
//reset array(s)
DataToEncode2[0]=(char)0;
Temp[0]=(char)0;
DataToPrint[0]=(char)0;
OnlyCorrectData[0]=(char)0;
Printablestring[0]=(char)0;
DataToEncode=rtrim(ltrim(DataToEncode));
/* Check to make sure data is numeric and remove dashes, etc. */
for(I=1;I<=strlen(DataToEncode);I++)
{
/* Add all numbers to OnlyCorrectData string */
if(isdigit(asc(mid(DataToEncode,I,1))))
{
sprintf(OnlyCorrectData,"%s%c",&OnlyCorrectData, asc(mid(DataToEncode,I,1)));
}
}
/* Check for an ODD number of digits, add 0 if not odd */
if(fmod(strlen(OnlyCorrectData),2)==0)
{
sprintf(DataToEncode2,"0%s",&OnlyCorrectData);
}
else
{
sprintf(DataToEncode2,"%s",&OnlyCorrectData);
}
/* <<<< Calculate Check Digit >>>> */
Factor=3;
weightedTotal=0;
for(I=strlen(DataToEncode2);I>=1;I--)
{
/* Get the value of each number starting at the end */
CurrentChar=(asc(mid(DataToEncode2,I,1)))-48;
/* multiply by the weighting factor which is 3,1,3,1... */
/* and add the sum together */
weightedTotal=weightedTotal + (CurrentChar * Factor);
/* change factor for next calculation */
Factor=4-Factor;
}
/* Find the CheckDigit by finding the smallest number that = a multiple
of 10 */
I=(fmod(weightedTotal,10));
if(I!=0)
{
CheckDigit=(10-I);
}
else
{
CheckDigit=0;
}
/* Add check digit to number to DataToEncode */
sprintf(DataToEncode2,"%s%c",&DataToEncode2,CheckDigit+48);
/* Assign start and stop codes */
StartCode=203;
StopCode=204;
for(I=1;I<=strlen(DataToEncode2);I=I+2)
{
/* Get the value of each number pair */
CurrentChar=(((asc(mid(DataToEncode2,I,1))))-48)*10; //First number
CurrentChar=(CurrentChar + (asc(mid(DataToEncode2,I+1,1))))-48; //Second number plus first
/* == Get the ASCII value of CurrentChar according to chart by adding to the value == */
//sprintf(DataToPrint,"%s%c",&DataToPrint,CurrentChar+130);
if(CurrentChar<94) {sprintf(DataToPrint,"%s%c",&DataToPrint,CurrentChar+33);}
if(CurrentChar>93) {sprintf(DataToPrint,"%s%c",&DataToPrint,CurrentChar+42);}
}
/* Get Printable String */
sprintf(Printablestring,"%c%s%c",142,&DataToPrint,143);
/* Return PrintableString */
return Printablestring;
}

Copyright © 1999-2001 IDAutomation.com, Inc.  All trademarks are the property of their respective owners.