Пример #1
0
        private void OptimizeFont( )
        {
            if (m_TotalChars <= 0)
            {
                return;                // TODO complain..
            }
            // use optimizer to get the height
            FO           = new FontOptimizer(m_font, MYFONTS);
            FO.FirstChar = txFirstChar.Text[0];
            FO.CharCount = m_TotalChars;
            int tSize;

            if (!int.TryParse(txTargetSize.Text, out tSize))
            {
                tSize = 12; txTargetSize.Text = tSize.ToString( ); // fix if not a number..
            }
            FO.TargetHeight = tSize;
            FO.RemoveTop    = cbxRemoveTop.Checked;
            FO.RemoveBottom = cbxRemoveBottom.Checked;

            FO.Optimize( ); // this should now reveal the font to use
            // carry into globals and GUI
            m_font = FO.FontToUse;
            ShowFontProps( );
            txFinalSize.Text = String.Format("{0} x {1}", FO.MinimumRect.Width, FO.MinimumRect.Height);
            Clean( );
        }
Пример #2
0
        /// <summary>
        /// Add one character to the List
        /// </summary>
        /// <param name="c">The character</param>
        /// <param name="fo">The FontOptimizer serving character bitmaps</param>
        /// <param name="target">Width target setting</param>
        /// <returns>The maxsize of all added characters</returns>
        public Size Add(Char c, FontOptimizer fo, FontOptimizer.WidthTarget target)
        {
            LetterBase l = m_letterFactory();
            Size       s = l.CreateChar(c, fo, target);

            MaxSize.Width  = Math.Max(MaxSize.Width, s.Width);
            MaxSize.Height = Math.Max(MaxSize.Height, s.Height);


            this.Add(l);
            m_sizeTable.Add(( Byte )s.Width);

            return(s);
        }
Пример #3
0
        protected Char m_c = '\0';  // the letter handled


        /// <summary>
        /// Character Digitizer
        ///   Creates the Byte stream for this character
        /// </summary>
        /// <param name="c">Character to digitize</param>
        /// <param name="fo">The FontOptimzer serving the bitmaps</param>
        /// <param name="target">Width target setting</param>
        /// <returns>The size of the created character</returns>
        abstract public Size CreateChar(Char c, FontOptimizer fo, FontOptimizer.WidthTarget target);