Beispiel #1
0
        private void txtSizeY_TextChanged(object sender, EventArgs e)
        {
            if (updateSize)
            {
                return;
            }

            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            try
            {
                size.Height = Convert.ToUInt16(txtSizeY.Text);
            }
            catch
            {
                size.Height = 0;
            }


            updateSize = true;
            RefillSizesComboBox();
            cboSizes.SelectedItem = size;
            updateSize            = false;
        }
Beispiel #2
0
        private void btnPreviewSelectFont_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }


            FontDialog fontDialog = new FontDialog();

            fontDialog.Font = size.PreviewFont;
            DialogResult result = fontDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                txtPreviewFontName.Text        = fontDialog.Font.FontFamily.Name;
                txtPreviewPreviewFontSize.Text = fontDialog.Font.Size.ToString();
                size.PreviewFont = fontDialog.Font;
            }
            if (cbxPreviewActive.Checked)
            {
                charViewHandler.RefreshPicture();
            }
        }
Beispiel #3
0
        private void btnPaletteDown_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }


            foreach (Character character in size.characters)
            {
                for (int y = 0; y < character.Width; y++)
                {
                    for (int x = 0; x < character.Height; x++)
                    {
                        if (character.Matrix[x, y] == 0)
                        {
                            continue;
                        }
                        character.Matrix[x, y] = (byte)(character.Matrix[x, y] - 1);
                    }
                }
            }
            charViewHandler.RefreshPicture();
        }
Beispiel #4
0
        private void UpdatePaletteColor()
        {
            if (updateSize)
            {
                return;
            }
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            size.PalletteBackgroundRed   = (byte)trbRedBackground.Value;
            size.PalletteBackgroundGreen = (byte)trbGreenBackground.Value;
            size.PalletteBackgroundBlue  = (byte)trbBlueBackground.Value;
            size.PalletteForegroundRed   = (byte)trbRedForeground.Value;
            size.PalletteForegroundGreen = (byte)trbGreenForeground.Value;
            size.PalletteForegroundBlue  = (byte)trbBlueForeground.Value;

            Constants.RecalcColors((byte)trbRedBackground.Value, (byte)trbGreenBackground.Value, (byte)trbBlueBackground.Value,
                                   (byte)trbRedForeground.Value, (byte)trbGreenForeground.Value, (byte)trbBlueForeground.Value);
            picColorSelector.Refresh();
            charViewHandler.RefreshPicture();
        }
Beispiel #5
0
        private void AddCharacters(string characters)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            Character character = null;;

            foreach (char c in characters)
            {
                character = new Character(c.ToString(), size.Width, size.Height);
                Utils.CreateMatrixWithSettings(size, character, c);
                size.characters.Add(character);
            }

            updateCharacter = true;
            RefillCharactersComboBox();
            cboCharacter.SelectedItem = character;
            updateCharacter           = false;

            ShowCharacter(character);
        }
Beispiel #6
0
        private void btnCopyCharacter_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            Character character    = (Character)cboCharacter.SelectedItem;
            Character newCharacter = new Character(character.Name + "Copy", size.Width, size.Height);

            for (int x = 0; x < newCharacter.Width; x++)
            {
                for (int y = 0; y < newCharacter.Height; y++)
                {
                    newCharacter.Matrix[x, y] = character.Matrix[x, y];
                }
            }


            size.characters.Add(newCharacter);
            cboCharacter.Items.Add(newCharacter);
            updateSize = true;
            cboCharacter.SelectedItems.Clear();
            cboCharacter.SelectedItem = newCharacter;
            updateSize = false;

            ShowCharacter(newCharacter);
        }
Beispiel #7
0
        public static SizeInfo FromXML(XmlElement elem)
        {
            SizeInfo size = new SizeInfo(
                elem.Attributes["Name"].Value,
                Convert.ToUInt16(elem.Attributes["Width"].Value),
                Convert.ToUInt16(elem.Attributes["Height"].Value)
                );

            String previewFontFamilyName = elem.Attributes["PreviewFontFamilyName"].Value;
            String previewFontSize       = elem.Attributes["PreviewFontSize"].Value;

            Font      font      = new Font(previewFontFamilyName, (float)Convert.ToDouble(previewFontSize));
            FontStyle fontStyle = font.Style;

            if (elem.Attributes["PreviewFontBold"].Value == "True")
            {
                fontStyle &= FontStyle.Bold;
            }


            if (elem.Attributes["PreviewFontItalic"].Value == "True")
            {
                fontStyle &= FontStyle.Italic;
            }

            size.PreviewFont = new Font(font, fontStyle);

            size.PreviewOffsetX = elem.Attributes["PreviewOffsetX"].Value;
            size.PreviewOffsetY = elem.Attributes["PreviewOffsetY"].Value;
            size.PreviewChar    = elem.Attributes["PreviewChar"].Value;

            size.PalletteForegroundRed   = Convert.ToByte(elem.Attributes["PalletteForegroundRed"].Value);
            size.PalletteForegroundGreen = Convert.ToByte(elem.Attributes["PalletteForegroundGreen"].Value);
            size.PalletteForegroundBlue  = Convert.ToByte(elem.Attributes["PalletteForegroundBlue"].Value);

            size.PalletteBackgroundRed   = Convert.ToByte(elem.Attributes["PalletteBackgroundRed"].Value);
            size.PalletteBackgroundGreen = Convert.ToByte(elem.Attributes["PalletteBackgroundGreen"].Value);
            size.PalletteBackgroundBlue  = Convert.ToByte(elem.Attributes["PalletteBackgroundBlue"].Value);


            if (elem.Attributes["GenBasePaletteIndex"] != null)
            {
                size.GenBasePaletteIndex = Convert.ToByte(elem.Attributes["GenBasePaletteIndex"].Value);
            }

            foreach (XmlNode elemCharacters in elem.ChildNodes)
            {
                if (elemCharacters.Name != "Characters")
                {
                    continue;
                }

                foreach (XmlNode s in elemCharacters.ChildNodes)
                {
                    Character character = Character.FromXML((XmlElement)s);
                    size.characters.Add(character);
                }
            }
            return(size);
        }
Beispiel #8
0
        private void btnPreviewFontSizeUp_Down(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            double fontSize;

            try
            {
                fontSize = Convert.ToDouble(size.PreviewFont.Size);
                fontSize--;
                size.PreviewFont = new Font(size.PreviewFont.Name, (float)fontSize, size.PreviewFont.Style);
                txtPreviewPreviewFontSize.Text = size.PreviewFont.Size.ToString();
                if (cbxPreviewActive.Checked)
                {
                    charViewHandler.RefreshPicture();
                }
            }
            catch
            {
                return;
            }
        }
Beispiel #9
0
        /// <summary>
        /// Draws a character preview in the given picture box
        /// and uses the border space to draw overlapping part of the character if the character does not fit
        /// The parameters offsX and offsY are used to move the perview character into the correct position before rasterising it
        /// </summary>
        public void DrawPreview(Graphics graphics, SizeInfo size, Character character, char c, Font font, int offsX, int offsY)
        {
            int usedWidth  = size.Width;
            int usedHeight = size.Height;

            if (character != null)
            {
                usedWidth  = character.Width;
                usedHeight = character.Height;
            }

            int bX         = (int)Math.Ceiling(usedWidth * cBorderFactor); bX += bX % 2;
            int bY         = (int)Math.Ceiling(usedHeight * cBorderFactor); bY += bY % 2;
            int fullWidth  = usedWidth + bX;
            int fullHeight = usedHeight + bY;

            Bitmap b = Utils.CreateFontPicture(c, font, fullWidth, fullHeight, bX / 2 + offsX, bY / 2 + offsY);

            byte[,] matrix = new byte[fullWidth, fullHeight];
            for (int y = 0; y < fullHeight; y++)
            {
                for (int x = 0; x < fullWidth; x++)
                {
                    byte  colorID = Constants.BACKGROUND_COLOR_ID;
                    Color color   = b.GetPixel(x, y);
                    if (color.R < 128)
                    {
                        colorID = Constants.FOREGROUND_COLOR_ID;
                    }
                    matrix[x, y] = colorID;
                }
            }

            DrawMatrix(graphics, matrix, fullWidth, fullHeight, false, true, usedWidth, usedHeight);
        }
Beispiel #10
0
        private void genGreeble(bool onlySelected)
        {
            byte GreebleRange = 4;

            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }


            foreach (Character character in size.characters)
            {
                if (onlySelected)
                {
                    if (!cboCharacter.SelectedItems.Contains(character))
                    {
                        continue;
                    }
                }

                for (int y = 0; y < character.Width; y++)
                {
                    for (int x = 0; x < character.Height; x++)
                    {
                        if (character.Matrix[x, y] == 0)
                        {
                            continue;
                        }
                        // propability for greeble
                        if (Constants.Rnd.NextDouble() < 0.7f)
                        {
                            int add = Constants.Rnd.Next(GreebleRange + 1) - GreebleRange / 2;

                            int newVal = (int)(character.Matrix[x, y] + add);

                            // don't change background
                            {
                                if (0 <= newVal && newVal < Constants.colors.Count())
                                {
                                    character.Matrix[x, y] = (byte)newVal;
                                }
                            }



                            if (Constants.Rnd.NextDouble() < 0.2f)
                            {
                                character.Matrix[x, y] = (byte)(Constants.colors.Count() - 1);
                            }
                        }
                    }
                }
            }
            charViewHandler.RefreshPicture();
        }
Beispiel #11
0
        private void RefillCharactersComboBox()
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            cboCharacter.Items.Clear();
            cboCharacter.SelectedItems.Clear();
            foreach (Character c in size.characters)
            {
                cboCharacter.Items.Add(c);
            }
        }
Beispiel #12
0
        private void ShowSize(SizeInfo size)
        {
            if (size == null)
            {
                ForbitEditingSize();
                return;
            }

            AllowEditingSize();
            FillSizeControls(size);
        }
Beispiel #13
0
        private void btnDeleteChar_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            // find combo entry
            int index = 0;
            List <Character> delList = new List <Character>();

            foreach (Object element in cboCharacter.SelectedItems)
            {
                delList.Add((Character)element);
            }

            updateCharacter = true;

            foreach (Character character in delList)
            {
                // remove from list
                size.characters.Remove(character);

                // find combo entry
                index = cboCharacter.Items.IndexOf(character);

                // remove combo entry
                cboCharacter.Items.Remove(character);
            }


            // select next character
            if (index < cboCharacter.Items.Count)
            {
                cboCharacter.SelectedIndex = index;
            }
            else if (cboCharacter.Items.Count > 0)
            {
                cboCharacter.SelectedIndex = index - 1;
            }
            else
            {
                cboCharacter.SelectedItem = null;// last cbo entry removed
            }

            updateCharacter = false;

            ShowCharacter((Character)cboCharacter.SelectedItem);
        }
Beispiel #14
0
        private void btnDeleteSize_Click(object sender, EventArgs e)
        {
            RasterFont font = getCurrentFont();

            if (font == null)
            {
                return;
            }

            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            updateSize = true;

            // remove from list
            font.SizeInfos.Remove(size);

            // find combo entry
            int index = cboSizes.Items.IndexOf(size);

            // remove combo entry
            cboSizes.Items.Remove(size);

            // select next size
            if (index < cboSizes.Items.Count)
            {
                cboSizes.SelectedIndex = index;
            }
            else if (cboSizes.Items.Count > 0)
            {
                cboSizes.SelectedIndex = index - 1;
            }
            else
            {
                cboSizes.SelectedItem = null;// last cbo entry removed
            }

            updateSize = false;

            ShowSize((SizeInfo)cboSizes.SelectedItem);
        }
Beispiel #15
0
        private void btnAddSize_Click(object sender, EventArgs e)
        {
            RasterFont font = getCurrentFont();

            if (font == null)
            {
                return;
            }

            SizeInfo size = new SizeInfo("new_Size", 10, 10);

            updateSize = true;
            font.SizeInfos.Add(size);
            cboSizes.Items.Add(size);
            cboSizes.SelectedItem = size;
            updateSize            = false;

            ShowSize(size);
        }
Beispiel #16
0
        private void FillSizeControls(SizeInfo size)
        {
            if (size == null)
            {
                return;
            }

            updateSize = true;

            txtSizeName.Text = size.Name;
            txtSizeX.Text    = size.Width.ToString();
            txtSizeY.Text    = size.Height.ToString();

            txtPreviewFontName.Text        = size.PreviewFont.FontFamily.Name;
            txtPreviewPreviewFontSize.Text = size.PreviewFont.Size.ToString();
            txtPreviewOffsetX.Text         = size.PreviewOffsetX;
            txtPreviewOffsetY.Text         = size.PreviewOffsetY;
            txtPreviewChar.Text            = size.PreviewChar;
            txtBasePaletteIndex.Text       = size.GenBasePaletteIndex.ToString();

            trbRedBackground.Value   = size.PalletteBackgroundRed;
            trbGreenBackground.Value = size.PalletteBackgroundGreen;
            trbBlueBackground.Value  = size.PalletteBackgroundBlue;
            trbRedForeground.Value   = size.PalletteForegroundRed;
            trbGreenForeground.Value = size.PalletteForegroundGreen;
            trbBlueForeground.Value  = size.PalletteForegroundBlue;

            RefillCharactersComboBox();


            if (cboCharacter.Items.Count > 0)
            {
                updateCharacter            = true;
                cboCharacter.SelectedIndex = 0;
                updateCharacter            = false;
            }

            updateSize = false;

            UpdatePaletteColor();

            ShowCharacter((Character)cboCharacter.SelectedItem);
        }
Beispiel #17
0
        private void btnAddChar_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            Character character = new Character("new", size.Width, size.Height);

            size.characters.Add(character);
            cboCharacter.Items.Add(character);
            updateSize = true;
            cboCharacter.SelectedItems.Clear();
            cboCharacter.SelectedItem = character;
            updateSize = false;

            ShowCharacter(character);
        }
        private void picChar_Paint(object sender, PaintEventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }
            Character character = (Character)cboCharacter.SelectedItem;

            if (!cbxPreviewActive.Checked)
            {
                charViewHandler.Draw(e.Graphics, (Character)cboCharacter.SelectedItem, cbxShowBits.Checked);
            }
            else
            {
                char c = ' ';
                if (txtPreviewChar.Text.Length > 0)
                {
                    c = txtPreviewChar.Text[0];
                }
                else if (character != null && character.Name.Length > 0)
                {
                    c = character.Name[0];
                }

                int offsetX;
                int offsetY;
                try
                {
                    offsetX = Convert.ToInt32(txtPreviewOffsetX.Text);
                    offsetY = Convert.ToInt32(txtPreviewOffsetY.Text);
                }
                catch
                {
                    return;
                }

                charViewHandler.DrawPreview(e.Graphics, (SizeInfo)cboSizes.SelectedItem, (Character)cboCharacter.SelectedItem, c, size.PreviewFont, offsetX, offsetY);
            }
        }
Beispiel #19
0
        /// <summary>
        /// Save a font in a given size into a c header for use in Arduino projects
        /// </summary>
        /// <param name="document"></param>
        public static void ExportFontInSizeToFile(SizeInfo sizeInfo, bool rotate90cc, bool addGreeble)
        {
            if (sizeInfo == null)
            {
                return;
            }

            Dictionary <string, string> tmplates = new Dictionary <string, string>();
            string name = sizeInfo.Name.Replace(" ", "");

            tmplates.Add("NAME_PALETTE_ARRAY", name + "_Palette");
            tmplates.Add("COLOR_ENTRIES", getCOLOR_ENTRIES());

            tmplates.Add("NAME_BITMAP_ARRAY", name + "_BitmapData");
            tmplates.Add("BITMAP_ARRAY", getBITMAP_ARRAY(sizeInfo, rotate90cc, addGreeble));

            tmplates.Add("NAME_GLYPH_ENTRIES_LENGTH", name + "_GlyphDataLength");
            tmplates.Add("GLYPH_ENTRIES_LENGTH", sizeInfo.characters.Count().ToString());

            tmplates.Add("NAME_GLYPH_ARRAY", name + "_GlyphData");
            tmplates.Add("GLYPH_ENTRIES", getGLYPH_ENTRIES(sizeInfo));

            tmplates.Add("FONT_NAME", sizeInfo.Name);

            tmplates.Add("NAME_PALETTE_ARRAY_REF", name + "_Palette,");
            tmplates.Add("PALETTE_SIZE", Constants.colors.Count().ToString() + ",");

            tmplates.Add("NAME_BITMAP_ARRAY_REF", name + "_BitmapData,".PadRight(45, ' '));
            tmplates.Add("YADVANCE", sizeInfo.Width.ToString() + ",");

            tmplates.Add("NAME_GLYPH_ARRAY_REF", name + "_GlyphData,".PadRight(45, ' '));

            string document = LoadTemplate();

            foreach (KeyValuePair <string, string> kv in tmplates)
            {
                document = document.Replace("{{{" + kv.Key + "}}}", kv.Value);
            }

            SaveHeader(document);
        }
Beispiel #20
0
        private void txtSizeName_TextChanged(object sender, EventArgs e)
        {
            if (updateSize)
            {
                return;
            }

            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            size.Name = txtSizeName.Text;

            updateSize = true;
            RefillSizesComboBox();
            cboSizes.SelectedItem = size;
            updateSize            = false;
        }
Beispiel #21
0
        public static RasterFont FromXML(XmlElement elem)
        {
            RasterFont font = new RasterFont();

            font.Name = elem.Attributes["Name"].Value;

            foreach (XmlNode elemSizes in elem.ChildNodes)
            {
                if (elemSizes.Name != "Sizes")
                {
                    continue;
                }

                foreach (XmlNode s in elemSizes.ChildNodes)
                {
                    SizeInfo size = SizeInfo.FromXML((XmlElement)s);
                    font.SizeInfos.Add(size);
                }
            }
            return(font);
        }
Beispiel #22
0
        private void txtPreviewChar_TextChanged(object sender, EventArgs e)
        {
            if (updateSize)
            {
                return;
            }

            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            size.PreviewChar = txtPreviewChar.Text;

            if (cbxPreviewActive.Checked)
            {
                charViewHandler.RefreshPicture();
            }
        }
Beispiel #23
0
        private static string getGLYPH_ENTRIES(SizeInfo sizeInfo)
        {
            string        tmp    = "";
            int           offset = 0;
            List <string> lines  = new List <string>();

            foreach (Character character in sizeInfo.characters)
            {
                tmp  = "    {";
                tmp += offset.ToString() + ", ";
                tmp += character.Width.ToString() + ", ";
                tmp += character.Height.ToString() + ", ";
                tmp += (character.Width + 2).ToString() + ", "; // Advance
                tmp += (0).ToString() + ", ";
                tmp += (-1 * character.Height).ToString();
                tmp += "}";
                lines.Add(tmp);
                offset += (character.Width + character.Width % 2) / 2 * character.Height;
            }
            return(String.Join(", " + CRLF, lines.ToArray()));
        }
Beispiel #24
0
        private void btnFillCharacterMatrix_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            Character character = (Character)cboCharacter.SelectedItem;

            if (character == null)
            {
                return;
            }

            char c = FindCharacter(character);

            Utils.CreateMatrixWithSettings(size, character, c);
            ShowCharacter(character);
            cbxPreviewActive.Checked = false;
        }
Beispiel #25
0
        private void txtBasePaletteIndex_TextChanged(object sender, EventArgs e)
        {
            if (updateSize)
            {
                return;
            }

            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            size.GenBasePaletteIndex = Convert.ToByte(txtBasePaletteIndex.Text);


            if (cbxPreviewActive.Checked)
            {
                charViewHandler.RefreshPicture();
            }
        }
Beispiel #26
0
        public static void CreateMatrixWithSettings(SizeInfo size, Character character, char c)
        {
            if (size == null)
            {
                return;
            }

            int offsetX;
            int offsetY;

            try
            {
                offsetX = Convert.ToInt32(size.PreviewOffsetX);
                offsetY = Convert.ToInt32(size.PreviewOffsetY);
            }
            catch
            {
                return;
            }

            character.FillMatrixFromCharacter(c, size.PreviewFont, offsetX, offsetY, size.GenBasePaletteIndex);
        }
Beispiel #27
0
        private void btnNewCharacter_Click(object sender, EventArgs e)
        {
            SizeInfo size = (SizeInfo)cboSizes.SelectedItem;

            if (size == null)
            {
                return;
            }

            Character character = new Character("new" + txtPreviewChar.Text, size.Width, size.Height);

            size.characters.Add(character);
            cboCharacter.Items.Add(character);
            updateCharacter = true;
            cboCharacter.SelectedItems.Clear();
            cboCharacter.SelectedItem = character;

            updateCharacter = false;
            char c = FindCharacter(character);

            Utils.CreateMatrixWithSettings(size, character, c);
            ShowCharacter(character);
            cbxPreviewActive.Checked = false;
        }
Beispiel #28
0
        private static string getBITMAP_ARRAY(SizeInfo sizeInfo, bool rotate90cc, bool addGreeble)
        {
            List <string> blocks = new List <string>();

            foreach (Character character in sizeInfo.characters)
            {
                string tmp = "    // " + character.Name + CRLF;

                byte left  = 0;
                byte right = 0;

                // rotate counter clock wise
                if (rotate90cc)
                {
                    if (character.Width != character.Height)
                    {
                        MessageBox.Show("For rotating character must be square");
                    }
                }
                byte[,] Matrix = new byte[character.Width, character.Width];

                ushort n = character.Width;
                for (int i = 0; i < n / 2; i++)
                {
                    for (int j = 0; j < (n + 1) / 2; j++)
                    {
                        Matrix[i, j]                 = character.Matrix[n - 1 - j, i];
                        Matrix[n - 1 - j, i]         = character.Matrix[n - 1 - i, n - 1 - j];
                        Matrix[n - 1 - i, n - 1 - j] = character.Matrix[j, n - 1 - i];
                        Matrix[j, n - 1 - i]         = character.Matrix[i, j];
                    }
                }

                if (addGreeble)
                {
                    for (int y = 0; y < character.Width; y++)
                    {
                        for (int x = 0; x < character.Height; x++)
                        {
                            if (Constants.Rnd.NextDouble() < .2f)
                            {
                                int add = Constants.Rnd.Next(5) - 2;

                                int newVal = (int)(Matrix[x, y] + add);

                                if (Matrix[x, y] > 0) // don't change background
                                {
                                    if (0 <= newVal && newVal < 16)
                                    {
                                        Matrix[x, y] = (byte)newVal;
                                    }
                                }
                            }
                        }
                    }
                }

                List <string> block = new List <string>();
                for (int y = 0; y < character.Width; y++)
                {
                    int           w2         = (character.Width + character.Width % 2) / 2;
                    List <string> rowEntries = new List <string>();
                    for (int x = 0; x < w2; x++)
                    {
                        left = Matrix[x * 2, y];
                        if (x * 2 - 1 < character.Width)
                        {
                            right = Matrix[x * 2 + 1, y];
                        }
                        else
                        {
                            right = 0;
                        }

                        rowEntries.Add(Utils.ByteToStringHex(left << 4 | right));
                    }
                    block.Add("    " + String.Join(",", rowEntries.ToArray()));
                }
                blocks.Add(tmp + String.Join("," + CRLF, block));
            }

            return(String.Join("," + CRLF, blocks));
        }