Пример #1
0
        private void PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            SymbolView view = null;

            if (e.OriginalSource is SymbolView)
            {
                view = e.OriginalSource as SymbolView;
            }
            else
            {
                FrameworkElement element = e.OriginalSource as FrameworkElement;
                if (element != null)
                {
                    view = element.Parent as SymbolView;
                }
            }

            if (view != null)
            {
                ResetOldSymbol();
                FocusSymbol(view);
                if (e.ClickCount == 2)
                {
                    Select(sender, e);
                }
            }
        }
Пример #2
0
 private void FocusSymbol(SymbolView view)
 {
     currentIndex         = wrapanel1.Children.IndexOf(view);
     view.RenderTransform = Scale;
     view.BorderThickness = new Thickness(1, 1, 2, 2);
     Zindex = Canvas.GetZIndex(view);
     Canvas.SetZIndex(view, 150);
     previousview = view;
 }
Пример #3
0
        public void ExtractSymbols()
        {
            if (wrapanel1 != null)
            {
                //Wait cursur program using (new WaitCursor)
                wrapanel1.Children.Clear();

                FontFamily fontselected = cmbFont.SelectedItem as FontFamily;
                TextElement.SetFontFamily(wrapanel1, fontselected);

                foreach (Typeface typeface in fontselected.GetTypefaces())
                {
                    typeface.TryGetGlyphTypeface(out Glyph);

                    if (Glyph != null)
                    {
                        if (cmbFont.SelectedItem.ToString() == "UnicodeHindi")// Range \U0900 to 097F
                        {
                            int fromcode = 0x0900;
                            int tocode   = 0x0975;
                            GetUnicodeCharacter(fromcode, tocode);
                            break;
                        }

                        else
                        {
                            characterMap = Glyph.CharacterToGlyphMap;
                            int i = 0;

                            foreach (KeyValuePair <int, ushort> kvp in characterMap)
                            {
                                SymbolView view = new SymbolView();
                                view.Character.Text = Convert.ToChar(kvp.Key).ToString();
                                wrapanel1.Children.Add(view);
                                i++;
                            }
                            double d = Math.Ceiling(i * 25 / 24.0);
                            wrapanel1.Height = d + d * 0.2;
                            break;
                        }
                    }
                }
            }
        }
Пример #4
0
        private void GetUnicodeCharacter(int fromcode, int tocode)
        {
            int i = fromcode;

            for (i = fromcode; i <= tocode; i++)
            {
                SymbolView view = new SymbolView();

                String codePoint     = i.ToString("X");
                int    code          = int.Parse(codePoint, System.Globalization.NumberStyles.HexNumber);
                String unicodeString = char.ConvertFromUtf32(code).ToString();
                view.Character.Text = unicodeString;

                wrapanel1.Children.Add(view);
            }
            double d = Math.Ceiling((tocode - fromcode + 1) * 25 / 24.0);

            wrapanel1.Height = d + d * 0.2;
        }