Exemplo n.º 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( );
        }