Files
NetUnicodeInfo/UnicodeCharacterInspector/CodePointToFontFamilyConverter.cs
T
2017-06-25 17:14:03 +02:00

24 lines
714 B
C#

using System;
using System.Globalization;
using System.Unicode;
using System.Windows.Data;
using System.Windows.Media;
namespace UnicodeCharacterInspector
{
internal sealed class CodePointToFontFamilyConverter : IValueConverter
{
public FontFamily DefaultFontFamily { get; set; }
public FontFamily EmojiFontFamily { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is int codePoint && UnicodeInfo.GetCharInfo(codePoint).EmojiProperties != 0 ?
EmojiFontFamily :
DefaultFontFamily;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotSupportedException();
}
}