コード例 #1
0
 /// <summary>
 /// Applies a custom typeface span to the text.
 /// </summary>
 /// <returns>Either the passed in Object or new IEditable with the typeface span applied.</returns>
 /// <param name="s">text to apply it too.</param>
 /// <param name="typeface">Typeface to apply.</param>
 public static IEditable ApplyTypefaceSpan(IEditable s, Typeface typeface)
 {
     if (s?.Length() > 0)
     {
         s.SetSpan(TypefaceUtils.GetSpan(typeface), 0, s.Length(), SpanTypes.ExclusiveExclusive);
     }
     return(s);
 }
コード例 #2
0
 /// <summary>
 /// Applies a custom typeface span to the text.
 /// </summary>
 /// <returns>The passed in string.</returns>
 /// <param name="s">text to apply it too.</param>
 /// <param name="typeface">Typeface to apply.</param>
 public static string ApplyTypefaceSpan(string s, Typeface typeface)
 {
     if (!string.IsNullOrEmpty(s))
     {
         SpannableString span = new SpannableString(s);
         span.SetSpan(TypefaceUtils.GetSpan(typeface), 0, s.Length, SpanTypes.ExclusiveExclusive);
     }
     return(s);
 }