Skip to content

Commit

Permalink
add unicode info via nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkAlanJones committed Jun 24, 2020
1 parent 8d926e7 commit 0caefe4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
8 changes: 8 additions & 0 deletions FontConverter/FontConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
Expand All @@ -47,6 +51,9 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UnicodeInformation, Version=2.5.0.0, Culture=neutral, PublicKeyToken=e54dbbddfea2ed0e, processorArchitecture=MSIL">
<HintPath>..\packages\UnicodeInformation.2.5.0\lib\net45\UnicodeInformation.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down Expand Up @@ -96,6 +103,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
10 changes: 8 additions & 2 deletions FontConverter/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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();
}
Expand Down
5 changes: 5 additions & 0 deletions FontConverter/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net472" />
<package id="UnicodeInformation" version="2.5.0" targetFramework="net472" />
</packages>

0 comments on commit 0caefe4

Please sign in to comment.