Under certain circumstances, it is desirable to substitute the font with the custom drawing routines. This section explains the mapping of each character in the font.
The basic element in a DataMatrix barcode is a square cell, in either black or white. If "1" represents a black cell and "0" represents a white cell, we can use an array of strings to represent a data matrix barcode. The result is further compressed by combining adjacent cells into a character. In data matrix font, four adjacent cells are combined into a character, as illustrated below:
The data matrix font uses 16 characters (0-9, A-F) to represent 16 possible scenarios. To draw the DataMatrix barcode from the encoding results, you have two options:
Convert the encoding results to an array of string consisting of
1and0only, and draw cells from the left to the right, and from the top to the bottom.Create a drawing routine to draw these 16 glyphs. Scan the encoding results and call the routine one by one.
When designing drawing routines, you may also consider joining adjacent dark cells into polygons to reduce the number of drawing commands.
