예제 #1
0
        /// <summary>
        /// Overridden. Gets the glyphs needed to render a full barcode.
        /// </summary>
        /// <param name="text">Text to convert into bar-code.</param>
        /// <returns>A collection of <see cref="T:Glyph"/> objects.</returns>
        protected override Glyph[] GetFullBarcode(string text)
        {
            List <Glyph> result = new List <Glyph>();

            // If text is odd length
            if (Factory is Code25InterleavedGlyphFactory)
            {
                bool isOddLength = false;
                if ((text.Length % 2) == 1)
                {
                    isOddLength = true;
                }

                // Interleaved 2 of 5 can only encode even number of digits
                if (isOddLength)
                {
                    text = "0" + text;
                }
            }

            result.AddRange(Factory.GetGlyphs(text));
            if (Checksum != null)
            {
                result.AddRange(Checksum.GetChecksum(text));
            }

            // Add start/stop glyphs
            result.Insert(0, Factory.GetRawGlyph('-'));
            result.Add(Factory.GetRawGlyph('*'));
            return(result.ToArray());
        }
예제 #2
0
        /// <summary>
        /// Overridden. Gets the glyphs needed to render a full barcode.
        /// </summary>
        /// <param name="text">Text to convert into bar-code.</param>
        /// <returns>A collection of <see cref="T:Glyph"/> objects.</returns>
        protected override Glyph[] GetFullBarcode(string text)
        {
            List <Glyph> result = new List <Glyph> ();

            result.AddRange(Factory.GetGlyphs(text));
            if (Checksum != null)
            {
                result.AddRange(Checksum.GetChecksum(text));
            }
            result.Insert(0, Factory.GetRawGlyph('-'));
            result.Add(Factory.GetRawGlyph('*'));
            return(result.ToArray());
        }
예제 #3
0
        /// <summary>
        /// Overridden. Gets the glyphs needed to render a full barcode.
        /// </summary>
        /// <param name="text">Text to convert into bar-code.</param>
        /// <returns>A collection of <see cref="T:Glyph"/> objects.</returns>
        protected override Glyph[] GetFullBarcode(string text)
        {
            List <Glyph> result = new List <Glyph>();

            result.AddRange(Factory.GetGlyphs(text));
            if (Checksum != null)
            {
                result.AddRange(Checksum.GetChecksum(text));
            }
            result.Add(Factory.GetRawGlyph(106));               // Stop
            result.Add(Factory.GetRawGlyph(107));               // Terminator
            return(result.ToArray());
        }