Example #1
0
        /// <summary>
        /// paint it
        /// </summary>
        protected override void OnPaint(PaintEventArgs e)
        {
            CharacterDefinitions defs;
              Point pos;

              e.Graphics.TextRenderingHint=this.RenderingHint;

              try {

            // create bitmaps for this string

            defs=new CharacterDefinitions();
            defs.ParseCharacters(this,this.FontDef,this.Text,false);

            // blit them into the display

            pos=this.Position;

            foreach(CharDef cd in defs.Definitions) {

              if(cd.Character!=' ')
            e.Graphics.DrawImage(cd.CharacterBitmap,pos);

              pos.X+=cd.Size.Width+this.FontDef.Spacing;
            }
              }
              catch {
            using(SolidBrush brush=new SolidBrush(Color.PaleVioletRed))
              e.Graphics.FillRectangle(brush,ClientRectangle);
              }
        }
Example #2
0
        /// <summary>
        /// paint it
        /// </summary>

        protected override void OnPaint(PaintEventArgs e)
        {
            CharacterDefinitions defs;
            Point pos;

            e.Graphics.TextRenderingHint = this.RenderingHint;

            try {
                // create bitmaps for this string

                defs = new CharacterDefinitions();
                defs.ParseCharacters(this, this.FontDef, this.Text, false);

                // blit them into the display

                pos = this.Position;

                foreach (CharDef cd in defs.Definitions)
                {
                    if (cd.Character != ' ')
                    {
                        e.Graphics.DrawImage(cd.CharacterBitmap, pos);
                    }

                    pos.X += cd.Size.Width + this.FontDef.Spacing;
                }
            }
            catch {
                using (SolidBrush brush = new SolidBrush(Color.PaleVioletRed))
                    e.Graphics.FillRectangle(brush, ClientRectangle);
            }
        }
Example #3
0
        /// <summary>
        /// estimate the size
        /// </summary>
        public int Estimate(Control refCtrl)
        {
            char[] chars;
              CharacterDefinitions charDefs=new CharacterDefinitions();
              int byteTotal;

              Cursor.Current=Cursors.WaitCursor;

              try {

            // the selected characters need to be sorted

            chars=this.FontDef.Characters.ToCharArray();
            Array.Sort(chars);
            this.FontDef.Characters=new string(chars);

            // create the char definitions

            charDefs.ParseCharacters(refCtrl,this.FontDef,this.FontDef.Characters,true);

            // sum up the bytes

            byteTotal=0;
            foreach(CharDef cd in charDefs.Definitions)
              byteTotal+=cd.CompressedBytes.Length;

            // add on the fontchar requirements (4 byte struct on the arduino)

            byteTotal+=this.FontDef.Characters.Length*4;
            return byteTotal;
              }
              finally {
            Cursor.Current=Cursors.Default;
              }
        }
Example #4
0
        /// <summary>
        /// estimate the size
        /// </summary>

        public int Estimate(Control refCtrl)
        {
            char[] chars;
            CharacterDefinitions charDefs = new CharacterDefinitions();
            int byteTotal;

            Cursor.Current = Cursors.WaitCursor;

            try {
                // the selected characters need to be sorted

                chars = this.FontDef.Characters.ToCharArray();
                Array.Sort(chars);
                this.FontDef.Characters = new string(chars);

                // create the char definitions

                charDefs.ParseCharacters(refCtrl, this.FontDef, this.FontDef.Characters, true);

                // sum up the bytes

                byteTotal = 0;
                foreach (CharDef cd in charDefs.Definitions)
                {
                    byteTotal += cd.CompressedBytes.Length;
                }

                // add on the fontchar requirements (4 byte struct on the arduino)

                byteTotal += this.FontDef.Characters.Length * 4;
                return(byteTotal);
            }
            finally {
                Cursor.Current = Cursors.Default;
            }
        }