| |
   
Support Home | Search | FAQ | Library | Order | Forum  
Home : Fontware Products : Font Tools/2D Font Encoders
Q10048 - HOWTO: Using Code128Ex and EAN128Ex in Conjunction with M...

Using Code128Ex and EAN128Ex in Conjunction with Morovia Code128 Fonts

Introduction

Beginning at version 3.0 (released in April 2005), we improved Code128 and UCC/EAN-128 encoding by adding two encoder functions: Code128Ex and EAN128Ex. These two functions are designed to replace the original functions Code128Auto and EAN128.

Issues

The current Code128 specification has been extended to support encoding extended ASCII characters (values range between 128 and 255). This feature allows encoding national characters such as È and æ. Unfortunately Code128Auto function was designed to encode ASCII characters (0~127) only.

Encoding EAN128 barcode causes more confusion. The EAN128 encoding must start with a FNC1 character. To make thing more complicated, the data part may contain multiple fields separated by FNC1 characters. An EAN128 data is usually represented by a text format, with AI and field ID enclosed by parentheses, such as:

(8101)0 54321 1200(21)12345678

Nevertheless, the EAN128 function requires you to format the input as 81010543211200\1992112345678 whereas \199 represents the FNC1 character.

Solution

The source code, DLL and Crystal Reports DLL are included in the most recent Font Tools package. The Font Tools is a component free of upgrade and can be obtained at http://www.morovia.com/font/support/download-fonttools.asp.

These two functions are designed to work with non-human readable fonts. EAN128 requires a special human readable format that can not be accommodated with a font.

Tilde codes input in Code128Ex function

Code128Ex is capable of encoding upper ASCII characters. To accommodate this change, we modify the input method by changing it to tilde codes method. Under tilde codes method, you can input a character by using a tilde character (~), followed by a lower case letter d and 3-digit ASCII code. For example, you may use ~d000 to input the NUL character, ~d013 for carriage return.

Code128 defines 4 function characters: FNC1, FNC2, FNC3 and FNC4. To input these 4 characters, use ~1, ~2, ~3 and ~4.

Note that the tilde codes input method only applies to Code128Ex function.

Backward compatibility

The Code128Auto and EAN128 functions are kept in the source code, Windows DLL functions for backward compatibility. The table below lists the usages of these two functions.

Function

Usage

Code128Auto

Deprecated. Not recommended for new applications. Code128Auto encodes ASCII characters as well as FNC1. It does not encode extended ASCII characters. Use Code128Ex function instead.

EAN128

Deprecated. Not recommended for new applications. This function adds FNC1 automatically. However, if multiple fields exist, you need to add FNC1 (\199) at the beginning of each field. Use EAN128Ex function instead. Note that EAN128 function only support encoding numeric data.

Note

The internal implement of Code128Ex and EAN128Ex are very complicated after taking the possible future extension of Code128 and UCC/EAN128 standards into count. As a result, these functions are implemented inside a COM interface. The following code snippets demonstrate the calling these functions in Visual Basic:

Public Function Code128Ex(inpara As String) As String

    Dim encoder As Object

    Set encoder = CreateObject("cruflMorovia.Barcode")

    Code128Ex = encoder.Code128Ex(inpara)

End Function

 

Public Function EAN128Ex(inpara As String) As String

    Dim encoder As Object

    Set encoder = CreateObject("cruflMorovia.Barcode")

    EAN128Ex = encoder.EAN128Ex(inpara)

End Function

 
Note on concatenated UCC/EAN-128

The function EAN128Ex turns the open parenthesis into FNC1, and ignores the close parenthesis. Some UCC/EAN-128 implement does not use FNC1 character to separate two adjacent fields. In this case, do not put parentheses in the second data field. For example,

(00)123456789012345678(01)12345678901234

 

produces two FNC1 characters: the first one is at the beginning of the data (required), and the second one before AI 01. If you do not want to have the second FNC1, use

(00)1234567890123456780112345678901234

instead.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
At last, an explaination of how the FNC1 char can be encoded in multi AI 128s Having said that it better work! Added: 9/29/2005
Created on 4/19/2005.
Last Modified on 3/16/2007.
Last Modified by glitch.
Suggested by Unknown.
Article has been viewed 2061 times.
Rated 9 out of 10 based on 1 vote.
Print Article
Email Article