Пример #1
0
        /// <summary>
        /// Returns the font in use at a particular index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>The font that's currently being applied at that
        /// index or null if no font Is being applied or the
        /// index Is out of range.</returns>
        public short GetFontAtIndex(int index)
        {
            int size = _string.FormatRunCount;

            UnicodeString.FormatRun currentRun = null;
            for (int i = 0; i < size; i++)
            {
                UnicodeString.FormatRun r = _string.GetFormatRun(i);
                if (r.CharacterPos > index)
                {
                    break;
                }
                else
                {
                    currentRun = r;
                }
            }
            if (currentRun == null)
            {
                return(NO_FONT);
            }
            else
            {
                return(currentRun.FontIndex);
            }
        }