public void MethodGetDisplayTextShouldNeverFail() { for (int i = 0; i <= 0x10FFFF; i++) { UnicodeInfo.GetDisplayText(i); } }
public static Models.CodePoint GetCodePoint(UnicodeCharInfo charInfo) { var category = UnicodeCategoryInfo.Get(charInfo.Category); return(new Models.CodePoint ( charInfo.CodePoint, UnicodeInfo.GetDisplayText(charInfo), charInfo.Name, charInfo.OldName, charInfo.NameAliases.Select(na => new Models.NameAlias((Models.UnicodeNameAliasKind)(int) na.Kind, na.Name)).ToArray(), new Models.UnicodeCategory(category.ShortName, category.LongName), charInfo.Block, (Models.UnicodeNumericType)(int) charInfo.NumericType, (Models.UnihanNumericType)(int) charInfo.UnihanNumericType, charInfo.NumericValue != null ? new Models.RationalNumber(charInfo.NumericValue.GetValueOrDefault().Numerator, charInfo.NumericValue.GetValueOrDefault().Denominator) : null, charInfo.Definition, charInfo.MandarinReading, charInfo.CantoneseReading, charInfo.JapaneseKunReading, charInfo.JapaneseOnReading, charInfo.KoreanReading, charInfo.HangulReading, charInfo.VietnameseReading, charInfo.SimplifiedVariant, charInfo.TraditionalVariant )); }
public void ControlCharactersShouldHaveSpecificDisplayText() { for (int i = 0; i <= 0x20; ++i) { Assert.Equal(char.ConvertFromUtf32(0x2400 + i), UnicodeInfo.GetDisplayText(i)); Assert.Equal(char.ConvertFromUtf32(0x2400 + i), UnicodeInfo.GetDisplayText(UnicodeInfo.GetCharInfo(i))); } }
private static void PrintCodePointInfo(int codePoint) { var charInfo = UnicodeInfo.GetCharInfo(codePoint); Console.WriteLine(UnicodeInfo.GetDisplayText(charInfo)); Console.WriteLine("U+" + codePoint.ToString("X4")); Console.WriteLine(charInfo.Name ?? charInfo.OldName); Console.WriteLine(charInfo.Category); }
public void MethodGetCharInfoShouldHaveCoherentResults() { for (int i = 0; i <= 0x10FFFF; i++) { var charInfo = UnicodeInfo.GetCharInfo(i); Assert.Equal(charInfo.Name, UnicodeInfo.GetName(i)); Assert.Equal(charInfo.Category, UnicodeInfo.GetCategory(i)); Assert.Equal(UnicodeInfo.GetDisplayText(charInfo), UnicodeInfo.GetDisplayText(i)); } }
private void UpdateDisplayText() { string oldValue = displayText; displayText = character != null?UnicodeInfo.GetDisplayText(characterInfo) : null; if (displayText != oldValue) { NotifyPropertyChanged(nameof(DisplayText)); } }
private void blockSelection_SelectedIndexChanged(object sender, EventArgs e) { charView.Items.Clear(); UnicodeBlock newB = UnicodeInfo.GetBlocks()[blockSelection.SelectedIndex]; int i = newB.CodePointRange.FirstCodePoint; int range_upper = newB.CodePointRange.LastCodePoint; UnicodeCharInfo uc = new UnicodeCharInfo(); int itemind = 0; string name = "RESERVED CODEPOINT"; while (i <= range_upper) { uc = UnicodeInfo.GetCharInfo(i); charView.Items.Add(UnicodeInfo.GetDisplayText(uc)); if (uc.Name != null) { name = uc.Name; } charView.Items[itemind].ToolTipText = name + "\r\nCode point: U+" + BitConverter.ToString(BitConverter.GetBytes(uc.CodePoint).Reverse().ToArray()).Replace("-", ""); i++; itemind++; } }
private void UnicodeInsert(object sender, EventArgs e) { if (GetOneArgument() == "") { using (CharacterBrowserDialog cbd = new CharacterBrowserDialog()) { if (cbd.ShowDialog() == DialogResult.OK) { if (cbd.SpecialCharacters.Length > 0) { mainTb.SelectedText = mainTb.SelectedText.Insert(mainTb.SelectionStart, cbd.SpecialCharacters); } } } } else { string[] args = GetMultipleArguments(); if (args[0] == " ") { args = new string[] { GetOneArgument() }; tsMsgReporterLbl.Text = "No messages to report."; } StringBuilder addChars = new StringBuilder(); foreach (string s in args) { try { addChars.Append(UnicodeInfo.GetDisplayText(Convert.ToInt32(s))); } catch { tsMsgReporterLbl.Text = "Error U1: Not a Unicode character"; } } mainTb.SelectedText = mainTb.SelectedText.Insert(mainTb.SelectionStart, addChars.ToString()); } }
public void DisplayTextShouldReturnExpectedResult(string expectedText, int codePoint) => Assert.Equal(expectedText, UnicodeInfo.GetDisplayText(codePoint));
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(value != null?UnicodeInfo.GetDisplayText((int)value) : null); }
public CharacterViewModel(int codePoint) { CodePoint = codePoint; Character = char.ConvertFromUtf32(codePoint); DisplayText = UnicodeInfo.GetDisplayText(codePoint); }