diff --git a/AssemblyInfo.Common.cs b/AssemblyInfo.Common.cs index 8272ad7..5fc33e2 100644 --- a/AssemblyInfo.Common.cs +++ b/AssemblyInfo.Common.cs @@ -15,5 +15,5 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] +[assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyFileVersion("2.2.0.0")] diff --git a/Common.props b/Common.props index de91010..cfd4933 100644 --- a/Common.props +++ b/Common.props @@ -4,6 +4,6 @@ Fabien Barbier Copyright © Fabien Barbier 2014-2017 en - 2.1.0 + 2.2.0 \ No newline at end of file diff --git a/README.md b/README.md index 5bb2895..8aceba0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ The other, is a small WPF application allowing to inspect the Unicode code point Version of Unicode supported ---------------------------- -Unicode 9.0.0 +Unicode 10.0.0 +Emoji 5.0 Using the Unicode Character Inspector application ------------------------------------------------- diff --git a/UnicodeCharacterInspector/CharacterInfoViewModel.cs b/UnicodeCharacterInspector/CharacterInfoViewModel.cs index 4b371b1..6fdaefc 100644 --- a/UnicodeCharacterInspector/CharacterInfoViewModel.cs +++ b/UnicodeCharacterInspector/CharacterInfoViewModel.cs @@ -88,7 +88,7 @@ namespace UnicodeCharacterInspector if (displayText != oldValue) NotifyPropertyChanged(nameof(DisplayText)); } - public string DisplayText { get { return displayText; } } + public string DisplayText => displayText; public int? CodePoint => character != null ? codePoint : null as int?; diff --git a/UnicodeInformation.Builder/UnicodeInformation.Builder.csproj b/UnicodeInformation.Builder/UnicodeInformation.Builder.csproj index edfb906..0149dde 100644 --- a/UnicodeInformation.Builder/UnicodeInformation.Builder.csproj +++ b/UnicodeInformation.Builder/UnicodeInformation.Builder.csproj @@ -14,16 +14,23 @@ System.Unicode.snk - - - TextTemplatingFileGenerator - UnihanProperty.cs - - + + + True + True + UnihanProperty.tt + + + + + TextTemplatingFileGenerator + UnihanProperty.cs + + \ No newline at end of file diff --git a/UnicodeInformation/UnicodeCharInfo.cs b/UnicodeInformation/UnicodeCharInfo.cs index 3e03607..a1601c9 100644 --- a/UnicodeInformation/UnicodeCharInfo.cs +++ b/UnicodeInformation/UnicodeCharInfo.cs @@ -14,7 +14,7 @@ namespace System.Unicode private readonly int codePoint; /// The name of the code point. private readonly string name; - private readonly int unicodeCharacterDataIndex; + internal readonly int unicodeCharacterDataIndex; private readonly int unihanCharacterDataIndex; private readonly string block; diff --git a/UnicodeInformation/UnicodeInfo.cs b/UnicodeInformation/UnicodeInfo.cs index 20e04ce..b768abf 100644 --- a/UnicodeInformation/UnicodeInfo.cs +++ b/UnicodeInformation/UnicodeInfo.cs @@ -2,6 +2,7 @@ using System.IO; using System.IO.Compression; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; namespace System.Unicode @@ -420,25 +421,31 @@ namespace System.Unicode /// Gets a display text for the specified code point. /// The information for the code point. /// A display text for the code point, which may be the representation of the code point itself. - public static string GetDisplayText(UnicodeCharInfo charInfo) - { - if (charInfo.CodePoint <= 0x0020) return ((char)(0x2400 + charInfo.CodePoint)).ToString(); - else if (charInfo.Category == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(charInfo.CodePoint); - else if (charInfo.CodePoint >= 0xD800 && charInfo.CodePoint <= 0xDFFF) return "\xFFFD"; - else return char.ConvertFromUtf32(charInfo.CodePoint); - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string GetDisplayText(this UnicodeCharInfo charInfo) + => GetDisplayText(charInfo.CodePoint, charInfo.unicodeCharacterDataIndex); /// Gets a display text for the specified code point. /// The Unicode code point, for which a display text should be returned. /// A display text for the code point, which may be the representation of the code point itself. public static string GetDisplayText(int codePoint) { - if (codePoint <= 0x0020) return ((char)(0x2400 + codePoint)).ToString(); - else if (GetCategory(codePoint) == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(codePoint); + if (codePoint <= 0x0020) return ((char)(0x2400 + codePoint)).ToString(); // Provide a display text for control characters, including space. + else if (GetCategory(codePoint) == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(codePoint); else if (codePoint >= 0xD800 && codePoint <= 0xDFFF) return "\xFFFD"; + else if (codePoint >= 0xE0020 && codePoint < 0xE007F) return char.ConvertFromUtf32(codePoint - 0xE0000); // Handle "TAG" ASCII subset by remapping it to regular ASCII else return char.ConvertFromUtf32(codePoint); } + private static string GetDisplayText(int codePoint, int unicodeCharacterDataIndex) + { + if (codePoint <= 0x0020) return ((char)(0x2400 + codePoint)).ToString(); // Provide a display text for control characters, including space. + else if (GetUnicodeCharacterData(unicodeCharacterDataIndex).Category == UnicodeCategory.NonSpacingMark) return "\u25CC" + char.ConvertFromUtf32(codePoint); + else if (codePoint >= 0xD800 && codePoint <= 0xDFFF) return "\xFFFD"; + else if (codePoint >= 0xE0020 && codePoint < 0xE007F) return char.ConvertFromUtf32(codePoint - 0xE0000); // Handle "TAG" ASCII subset by remapping it to regular ASCII + else return char.ConvertFromUtf32(codePoint); + } + /// Gets the name of the specified code point. /// /// The name referred to is the unicode Name property.