/// <summary>
        /// Sets the kerning offset for the specified pair of characters.
        /// </summary>
        /// <param name="pair">The character pair.</param>
        /// <param name="value">The kerning offset to set for the specified pair of characters.</param>
        public void Set(SpriteFontKerningPair pair, Int32 value)
        {
            kerning[pair] = value;

            var c1 = pair.FirstCharacter;
            if (c1 < asciiLookup.Length)
                asciiLookup[c1] = true;
        }
        /// <summary>
        /// Sets the kerning offset for the specified pair of characters.
        /// </summary>
        /// <param name="c1">The first character in the pair.</param>
        /// <param name="c2">The second character in the pair.</param>
        /// <param name="value">The kerning offset to set for the specified pair of characters.</param>
        public void Set(Char c1, Char c2, Int32 value)
        {
            var pair = new SpriteFontKerningPair(c1, c2);
            kerning[pair] = value;

            if (c1 < asciiLookup.Length)
                asciiLookup[c1] = true;
        }
Esempio n. 3
0
        /// <summary>
        /// Gets a value indicating whether the kerning data contains the specified character pair.
        /// </summary>
        /// <param name="pair">The character pair.</param>
        /// <returns><see langword="true"/> if the kerning data contains the specified character pair; otherwise, <see langword="false"/>.</returns>
        public Boolean Contains(SpriteFontKerningPair pair)
        {
            var c1 = pair.FirstCharacter;
            if (c1 < asciiLookup.Length && !asciiLookup[c1])
                return false;

            return kerning.ContainsKey(pair);
        }
        /// <summary>
        /// Gets the kerning offset for the specified pair of characters.
        /// </summary>
        /// <param name="pair">The character pair.</param>
        /// <returns>The kerning offset for the specified pair of characters.</returns>
        public Int32 Get(SpriteFontKerningPair pair)
        {
            var c1 = pair.FirstCharacter;
            if (c1 < asciiLookup.Length && !asciiLookup[c1])
                return DefaultAdjustment;

            int offset;
            if (!kerning.TryGetValue(pair, out offset))
            {
                return DefaultAdjustment;
            }
            return offset;
        }
 /// <summary>
 /// Removes the specified character pair from the kerning data.
 /// </summary>
 /// <param name="pair">The character pair.</param>
 /// <returns><c>true</c> if the character pair was removed; otherwise, <c>false</c>.</returns>
 public Boolean Remove(SpriteFontKerningPair pair)
 {
     return kerning.Remove(pair);
 }