Exemple #1
0
        private int ExtraSpaceAllowance(esaType type, char ch, Font font)
        {
            if (textSpread >= 1)
            {
                return(0);                                                      // No action if textSpread 1 or more
            }
            int offset = 0;

            // Do we need to pad BEFORE the next char?
            if (type == esaType.Pre | type == esaType.Either)
            {
                // Does our character appear in the "pre" list? (ie taller than average)
                if (" bdfhijkltABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".IndexOf(ch) > 0)
                {
                    // TODO Allow for textSpread here.
                    //offset += (int)(font.Height * .2 * (1 - textSpread));
                    offset += (int)(font.Height * .2);
                }
            }

            // Do we need to pad AFTER the next char?
            if (type == esaType.Post | type == esaType.Either)
            {
                // Does our character appear in the "post" list? (is dangles over the bottom of the line)
                if (" gjpqyQ".IndexOf(ch) > 0)
                {
                    // TODO Allow for textSpread here.
                    //offset += (int)(font.Height * .2 * (1 - textSpread));
                    offset += (int)(font.Height * .2);
                }
            }

            return(offset);
        }
        private int ExtraSpaceAllowance(esaType type, char ch, Font font)
        {
            if (textSpread >= 1) return 0;				// No action if textSpread 1 or more

            int offset = 0;

            // Do we need to pad BEFORE the next char?
            if (type == esaType.Pre | type == esaType.Either)
            {
                // Does our character appear in the "pre" list? (ie taller than average)
                if (" bdfhijkltABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".IndexOf(ch) > 0)
                {
                    // TODO Allow for textSpread here.
                    //offset += (int)(font.Height * .2 * (1 - textSpread));
                    offset += (int)(font.Height * .2);
                }
            }

            // Do we need to pad AFTER the next char?
            if (type == esaType.Post | type == esaType.Either)
            {
                // Does our character appear in the "post" list? (is dangles over the bottom of the line)
                if (" gjpqyQ".IndexOf(ch) > 0)
                {
                    // TODO Allow for textSpread here.
                    //offset += (int)(font.Height * .2 * (1 - textSpread));
                    offset += (int)(font.Height * .2);
                }
            }

            return offset;
        }