3 * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * gLabels is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
22 * This module implements the BUILTIN barcode specified in the USPS
23 * publication 25, Mar 2001.
28 #include "bc-builtin.h"
33 /*========================================================*/
34 /* Private macros and constants. */
35 /*========================================================*/
38 /*===========================================*/
40 /*===========================================*/
43 /*===========================================*/
44 /* Local function prototypes */
45 /*===========================================*/
48 /****************************************************************************/
49 /* Generate list of lines that form the barcode for the given digits. */
50 /****************************************************************************/
52 gl_barcode_builtin_new (const gchar *id,
54 gboolean checksum_flag,
59 if ( (g_ascii_strcasecmp (id, "POSTNET") == 0) )
61 return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET, text_flag, checksum_flag, w, h, digits);
63 if ( (g_ascii_strcasecmp (id, "POSTNET-5") == 0) )
65 return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET_5, text_flag, checksum_flag, w, h, digits);
67 if ( (g_ascii_strcasecmp (id, "POSTNET-9") == 0) )
69 return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET_9, text_flag, checksum_flag, w, h, digits);
71 if ( (g_ascii_strcasecmp (id, "POSTNET-11") == 0) )
73 return lgl_barcode_create (LGL_BARCODE_TYPE_POSTNET_11, text_flag, checksum_flag, w, h, digits);
75 if ( (g_ascii_strcasecmp (id, "CEPNET") == 0) )
77 return lgl_barcode_create (LGL_BARCODE_TYPE_CEPNET, text_flag, checksum_flag, w, h, digits);
79 if ( (g_ascii_strcasecmp (id, "ONECODE") == 0) )
81 return lgl_barcode_create (LGL_BARCODE_TYPE_ONECODE, text_flag, checksum_flag, w, h, digits);
83 if ( (g_ascii_strcasecmp (id, "Code39") == 0) )
85 return lgl_barcode_create (LGL_BARCODE_TYPE_CODE39, text_flag, checksum_flag, w, h, digits);
87 if ( (g_ascii_strcasecmp (id, "Code39Ext") == 0) )
89 return lgl_barcode_create (LGL_BARCODE_TYPE_CODE39_EXT, text_flag, checksum_flag, w, h, digits);
92 g_message ("Invalid builtin barcode ID: \"%s\"\n", id);
99 * Local Variables: -- emacs
101 * c-basic-offset: 8 -- emacs
102 * tab-width: 8 -- emacs
103 * indent-tabs-mode: nil -- emacs