From 0caefe439362437941c69b6b04d1c2fb0b53e45c Mon Sep 17 00:00:00 2001 From: mjones Date: Tue, 23 Jun 2020 21:33:01 -0400 Subject: [PATCH] add unicode info via nuget --- FontConverter/FontConverter.csproj | 8 ++++++++ FontConverter/MainWindow.xaml.cs | 10 ++++++++-- FontConverter/packages.config | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 FontConverter/packages.config diff --git a/FontConverter/FontConverter.csproj b/FontConverter/FontConverter.csproj index a41edc1..7bcec7f 100644 --- a/FontConverter/FontConverter.csproj +++ b/FontConverter/FontConverter.csproj @@ -36,6 +36,10 @@ + + ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll + + @@ -47,6 +51,9 @@ 4.0 + + ..\packages\UnicodeInformation.2.5.0\lib\net45\UnicodeInformation.dll + @@ -96,6 +103,7 @@ ResXFileCodeGenerator Resource1.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/FontConverter/MainWindow.xaml.cs b/FontConverter/MainWindow.xaml.cs index 9474c6c..3ad4426 100644 --- a/FontConverter/MainWindow.xaml.cs +++ b/FontConverter/MainWindow.xaml.cs @@ -1,9 +1,11 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using System.Drawing; using System.Globalization; using System.Linq; using System.Text; +using System.Unicode; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -74,6 +76,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e) i.Margin = new Thickness(0); i.Source = WriteChar2BM(((char)c).ToString()); i.ToolTip = c; + i.Name = UnicodeInfo.GetName(c).Replace(" ", "_").Replace("-", "_").ToLowerInvariant(); GridOChars.Children.Add(i); Grid.SetRow(i, y); @@ -162,6 +165,9 @@ private void UpdateFontView(object sender, System.Windows.Input.MouseEventArgs e preview += " "; } + string c = ((System.Windows.Controls.Image)sender).ToolTip.ToString(); + preview += Environment.NewLine + Environment.NewLine + UnicodeInfo.GetName((char)int.Parse(c)); + Preview.Text = preview; } } @@ -237,7 +243,7 @@ private string GetCharEncoded(int[] bits, char c) } result.Remove(result.Length - 2, 2); - result.Append($"}}, //{(int)c:X4}({c})"); + result.Append($"}}, //{(int)c:X4}({c}) {UnicodeInfo.GetName(c).ToLowerInvariant()}"); return result.ToString(); } diff --git a/FontConverter/packages.config b/FontConverter/packages.config new file mode 100644 index 0000000..b415684 --- /dev/null +++ b/FontConverter/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file