Inheritance: IFontFamily
 public void Set(TextBlock textBlock)
 {
     this.fontFamily = textBlock.FontFamily;
     this.fontWeight = textBlock.FontWeight;
     this.fontStyle = textBlock.FontStyle;
     this.fontStretch = textBlock.FontStretch;
 }
Ejemplo n.º 2
0
 public AccountView()
 {
     var usernameBlock = new RichTextBlock();
     var passwordBlock = new RichTextBlock();
     var fontFmy = new FontFamily("Segoe UI");
     usernameBlock.FontFamily = fontFmy;
     usernameBlock.FontSize = 14;
 }
 public HamburgerBarPageEntryViewModel(ApplicationFrame frame, Type pageType, string title, FontFamily iconFontFamily, double iconFontSize, string icon)
 {
     Frame = frame;
     PageType = pageType;
     Title = title;
     Icon = icon;
     IconFontFamily = iconFontFamily;
     IconFontSize = iconFontSize;
     Frame.Navigated += Frame_Navigated;
     NavigateCommand = new RelayCommand(TryNavigate);
 }
Ejemplo n.º 4
0
 internal static bool IsSymbolFont(FontFamily fontFamily)
 {
     foreach (Typeface typeface in fontFamily.GetTypefaces())
     {
         GlyphTypeface face;
         if (typeface.TryGetGlyphTypeface(out face))
         {
             return face.Symbol;
         }
     }
     return false;
 }
Ejemplo n.º 5
0
        public Dashboard()
        {
            bracket = new Bracket(App.Instance.Players);

            this.InitializeComponent();
            swapped = false;
            finals = false;
            font = new FontFamily("Courier New");
            GenerateMatchList();
            GenerateLeaderboard();
            
        }
Ejemplo n.º 6
0
        public SegmentSurveyComboBox()
        {
            this.DefaultStyleKey = typeof(ComboBox);
            SelectionChanged += ComboBox_OnSelectionChanged;
            DataContextChanged += ComboBox_OnDataContextChanged;

            FontFamily = new FontFamily("Segoe UI");
            FontSize = 15;
            Margin = new Thickness(0, 2, 10, 0);

            Loaded += ComboBox_OnLoaded;
        }
Ejemplo n.º 7
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value == null) return null;
            var fontsize = int.Parse((string)parameter);
            CultureInfo info = CultureInfo.CurrentUICulture;
            var flowDirection = FlowDirection.LeftToRight;
            var fontFamily = new FontFamily((string)Application.Current.Resources["DefaultFontFamily"]);
            var path = new GeometryGroup();
            double scale = fontsize/(double)32;
            var point = new Point();

            return path;
        }
Ejemplo n.º 8
0
        public SegmentSurveyTextBox()
        {
            DefaultStyleKey = typeof(TextBox);

            FontFamily = new FontFamily("Segoe UI");
            FontSize = 15;
            Margin = new Thickness(0, 5, 10, 0);

            LostFocus += TextBox_OnLostFocus;
            DataContextChanged += TextBox_OnDataContextChanged;
            Loaded += TextBox_OnLoaded;

            IsDataValid = true;
        }
Ejemplo n.º 9
0
        public FontFamilyListItem(FontFamily fontFamily)
        {
            _displayName = GetDisplayName(fontFamily);

            this.FontFamily = fontFamily;
            this.Text = _displayName;
            this.ToolTip = _displayName;

            // In the case of symbol font, apply the default message font to the text so it can be read.
            if (IsSymbolFont(fontFamily))
            {
                var range = new TextRange(ContentStart, ContentEnd);
                range.ApplyPropertyValue(TextBlock.FontFamilyProperty, SystemFonts.MessageFontFamily);
            }
        }
Ejemplo n.º 10
0
 protected override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     var consolas = new FontFamily("Consolas");
     var fontSize = 14.0;
     this.xEditBox = this.GetTemplateChild("xEditBox") as RichEditBox;
     this.xEditBox.IsSpellCheckEnabled = false;
     this.xEditBox.IsTextPredictionEnabled = false;
     this.xEditBox.UseLayoutRounding = false;
     this.xEditBox.FontFamily = consolas;
     this.xEditBox.FontSize = fontSize;
     this.xEditBox.Background = new SolidColorBrush(Colors.Transparent);
     this.xEditBox.Foreground = new SolidColorBrush(colorText);
     this.xEditBox.Loaded += (a, b) =>
     {
         this.xEditBox.KeyUp += XEditBox_KeyUp;
         this.xEditBox.TextChanging += XEditBox_TextChanging;
     };
 }
        /// <summary>
        /// convert from a Caption Settings font family to the equivalent 
        /// Windows installed font
        /// </summary>
        /// <param name="value">a Model.FontFamily</param>
        /// <param name="targetType">a Windows FontFamily</param>
        /// <param name="parameter">parameter not used</param>
        /// <param name="language">language not used</param>
        /// <returns>a <see cref="Windows.UI.Xaml.Media.FontFamily"/></returns>
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (this.fontMap == null)
            {
                this.fontMap = new Dictionary<Model.FontFamily, FF.FontFamily>();
            }

            var captionFontFamily = (Model.FontFamily)value;

            if (captionFontFamily == Model.FontFamily.Default)
            {
                return DependencyProperty.UnsetValue;
            }

            // Setting font disables small caps
            if (captionFontFamily == Model.FontFamily.Smallcaps)
            {
                return DependencyProperty.UnsetValue;
            }

            FF.FontFamily fontFamily;

            lock (this.fontMap)
            {
                if (this.fontMap.TryGetValue(captionFontFamily, out fontFamily))
                {
                    return fontFamily;
                }

                var familyName = CaptionSettingsPluginBase.GetFontFamilyName(captionFontFamily);

                if (string.IsNullOrWhiteSpace(familyName))
                {
                    return DependencyProperty.UnsetValue;
                }

                fontFamily = new FF.FontFamily(familyName);
                this.fontMap[captionFontFamily] = fontFamily;

                return fontFamily;
            }
        }
Ejemplo n.º 12
0
 void SetOverrideTextFont(double size, FontFamily fontFamily)
 {
     OverrideLayoutText.FontSize = PxFromPt(size);  // xaml fontsize is in pixels.
     OverrideLayoutText.FontFamily = fontFamily;
 }
Ejemplo n.º 13
0
 protected override void OnWindowCreated(WindowCreatedEventArgs e)
 {            
     // Load the custom app font and insert it into the Resources map
     FontFamily appFont = new FontFamily("/Assets/MoMoPhoneSym.ttf#MoMoPhone Symbol");
     Resources.Add("AppFont", appFont);
 }
Ejemplo n.º 14
0
        // Handle changes to the SelectedFontFamily property
        void OnSelectedFontFamilyChanged(FontFamily family)
        {
            // If the family list is not valid do nothing for now. 
            // We'll be called again after the list is initialized.
            if (_familyListValid)
            {
                // Select the family in the list; this will return null if the family is not in the list.
                FontFamilyListItem item = SelectFontFamilyListItem(family);

                // Set the text box to the family name, if it isn't already.
                string displayName = (item != null) ? item.ToString() : FontFamilyListItem.GetDisplayName(family);
                if (string.Compare(fontFamilyTextBox.Text, displayName, true, CultureInfo.CurrentCulture) != 0)
                {
                    fontFamilyTextBox.Text = displayName;
                }

                // The typeface list is no longer valid; update it in the background to improve responsiveness.
                InvalidateTypefaceList();
            }
        }
 public CustomMessageDialog()
 {
     this.InitializeComponent();
     (this.Content as FrameworkElement).DataContext = this;
     FontFamily = new FontFamily("Arial");
 }
 private void SetFont(TextBlock textBlock, Windows.Globalization.Fonts.LanguageFont languageFont)
 {
     FontFamily fontFamily = new FontFamily(languageFont.FontFamily);
     textBlock.FontFamily = fontFamily;
     textBlock.FontWeight = languageFont.FontWeight;
     textBlock.FontStyle = languageFont.FontStyle;
     textBlock.FontStretch = languageFont.FontStretch;
 }
Ejemplo n.º 17
0
        // font family
        private void FontFamilyComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (FontFamilyComboBox.SelectedIndex == 0) FontFamily = new FontFamily("Segoe UI");
            else if (FontFamilyComboBox.SelectedIndex == 1) FontFamily = new FontFamily("Times New Roman");
            else if (FontFamilyComboBox.SelectedIndex == 2) FontFamily = new FontFamily("Consolas");

            UpdateBubbleAppearance();
        }
Ejemplo n.º 18
0
 public DispalyedChar(int code, FontFamily fontFamily)
 {
     RenderString = char.ConvertFromUtf32(code);
     DisplayName = $"&#x{code.ToString("x")};";
     FontFamily = fontFamily;
 }
Ejemplo n.º 19
0
 static System.Drawing.SizeF StringSize(string text, int fontSize, NativeFontFamily fontFamily, bool bold)
 {
     TextBlock txtMeasure = new TextBlock();
     txtMeasure.FontFamily = fontFamily;
     txtMeasure.FontSize = fontSize;
     txtMeasure.FontWeight = bold ? FontWeights.Bold : FontWeights.Normal;
     txtMeasure.Text = text;
     txtMeasure.Measure (new Size (1, 1));
     return new System.Drawing.SizeF((float)txtMeasure.ActualWidth, (float)txtMeasure.ActualHeight);
 }
        /// <summary>
        /// Displays a value in the control.
        /// </summary>
        public void ShowValue(object value, bool overwrite)
        {
            if (!overwrite)
            {
                Clear();
            }

            m_defaultFont = new FontFamily("Courier New");
            
            m_expanding = false;
            m_depth = 0;
                        
            // show the value.
            int index = 0;
            ShowValue(ref index, ref overwrite, value.ToString());
        }
 public int AddFont(FontFamily f)
 {
     return baseImpl.AddFont(f);
 }
 /// <summary>
 /// 在此页将要在 Frame 中显示时进行调用。
 /// </summary>
 /// <param name="e">描述如何访问此页的事件数据。Parameter
 /// 属性通常用于配置页。</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     FontFamily fontFamily = new FontFamily(@"Fonts/博洋规范字3500.TTF#HAKUYOGuiFanZi3500");
     fontTest.FontFamily = fontFamily; 
 }
Ejemplo n.º 23
0
 public virtual int AddFont(FontFamily f) { _Fonts.Add(f); return _Fonts.Count - 1; }
Ejemplo n.º 24
0
 public void ResetFontFamily()
 {
     this._fontFamily    = null;
     this._fontFamilySet = false;
     this.RaisePropertyChanged("FontFamily");
 }
Ejemplo n.º 25
0
 internal static string GetDisplayName(FontFamily family)
 {
     return NameDictionaryHelper.GetDisplayName(family.FamilyNames);
 }
        /// <summary>
        /// Gets the mapped font
        /// </summary>
        /// <returns>a native font family</returns>
        private static FontFamily GetFont()
        {
            if (fontMap == null)
            {
                fontMap = new Dictionary<ClosedCaptionStyle, FontFamily>();
            }

            FontFamily fontFamily;

            if (fontMap.TryGetValue(ClosedCaptionProperties.FontStyle, out fontFamily))
            {
                return fontFamily;
            }

            var name = GetFontFamilyName(ClosedCaptionProperties.FontStyle);

            if (name == null)
            {
                return null;
            }

            fontFamily = new FontFamily(name);

            fontMap[ClosedCaptionProperties.FontStyle] = fontFamily;

            return fontFamily;
        }
Ejemplo n.º 27
0
 public FontHelper(string family)
 {
     FontFamily = new FontFamily(family);
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Applies the DataTemplate to display on base of DisplayStyle and Alignment property values.
        /// </summary>
        private void ApplyContentTemplate()
        {
            if (_attachedElement == null || _applyingTemplate)
            {
                return;
            }

            _applyingTemplate = true;
            var root = TreeHelpers.GetRootPanel().Parent;
            var style = GetDisplayStyle(root);
            var sketchTemplateUri = new Uri("ms-appx:///Neumann.HelpFrame/SketchStyle.xaml", UriKind.Absolute);
            var popupTemplateUri = new Uri("ms-appx:///Neumann.HelpFrame/PopupStyle.xaml", UriKind.Absolute);

            var direction = (HelpFrameAlignment)_attachedElement.GetValue(AlignmentProperty);
            if (direction == HelpFrameAlignment.TopLeft ||
                direction == HelpFrameAlignment.TopRight ||
                direction == HelpFrameAlignment.TopCenter ||
                direction == HelpFrameAlignment.CenterCenter)
            {
                if (style == HelpFrameDisplayStyle.Sketch)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(sketchTemplateUri, "TopSketchTemplate");
                }
                else if (style == HelpFrameDisplayStyle.Popup)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(popupTemplateUri, "TopPopupTemplate");
                }
                else
                {
                    this.ContentTemplate = this.TopTemplate;
                }
            }
            else if (direction == HelpFrameAlignment.BottomLeft ||
                direction == HelpFrameAlignment.BottomRight ||
                direction == HelpFrameAlignment.BottomCenter)
            {
                if (style == HelpFrameDisplayStyle.Sketch)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(sketchTemplateUri, "BottomSketchTemplate");
                }
                else if (style == HelpFrameDisplayStyle.Popup)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(popupTemplateUri, "BottomPopupTemplate");
                }
                else
                {
                    this.ContentTemplate = this.BottomTemplate;
                }
            }
            else if (direction == HelpFrameAlignment.CenterLeft)
            {
                if (style == HelpFrameDisplayStyle.Sketch)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(sketchTemplateUri, "LeftSketchTemplate");
                }
                else if (style == HelpFrameDisplayStyle.Popup)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(popupTemplateUri, "LeftPopupTemplate");
                }
                else
                {
                    this.ContentTemplate = this.LeftTemplate;
                }
            }
            else if (direction == HelpFrameAlignment.CenterRight)
            {
                if (style == HelpFrameDisplayStyle.Sketch)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(sketchTemplateUri, "RightSketchTemplate");
                }
                else if (style == HelpFrameDisplayStyle.Popup)
                {
                    this.ContentTemplate = ResourceHelpers.GetResourceFromDictionary<DataTemplate>(popupTemplateUri, "RightPopupTemplate");
                }
                else
                {
                    this.ContentTemplate = this.RightTemplate;
                }
            }

            if (style == HelpFrameDisplayStyle.Popup)
            {
                this.ContentHorizontalAlignment = HorizontalAlignment.Center;
                this.ContentVerticalAlignment = VerticalAlignment.Center;
            }
            else
            {
                this.ContentHorizontalAlignment = HorizontalAlignment.Left;
                this.ContentVerticalAlignment = VerticalAlignment.Bottom;
                if (style == HelpFrameDisplayStyle.Sketch)
                {
                    _originalFontFamily = this.FontFamily;
                    _originalFontSize = this.FontSize;
                    _originalFontWeight = this.FontWeight;
                    this.FontFamily = new FontFamily("Buxton Sketch");
                    this.FontSize = 24;
                    this.FontWeight = FontWeights.Normal;
                }
                else if (_originalFontFamily != null)
                {
                    this.FontFamily = _originalFontFamily;
                    this.FontSize = _originalFontSize;
                    this.FontWeight = _originalFontWeight;
                }
            }

            _applyingTemplate = false;
        }
Ejemplo n.º 29
0
        // Update font family list based on selection.
        // Return list item if there's an exact match, or null if not.
        FontFamilyListItem SelectFontFamilyListItem(FontFamily family)
		{
			var listItem = fontFamilyList.SelectedItem as FontFamilyListItem;
			if (listItem != null && listItem.FontFamily.Equals(family))
			{
				// Already selected
				return listItem;
			}
			if (SelectListItem(fontFamilyList, FontFamilyListItem.GetDisplayName(family)))
			{
				// Exact match found
				return fontFamilyList.SelectedItem as FontFamilyListItem;
			}
			// Not in the list
			return null;
		}
 public MainWindow()
 {
     InitializeComponent();
     segoeFontFamily = new Media.FontFamily("Segoe MDL2 Assets");
 }
Ejemplo n.º 31
0
 System.Drawing.SizeF StringSize(string text, int fontSize, NativeFontFamily fontFamily, bool bold)
 {
     _txtMeasure.Visibility = Visibility.Hidden;
     _txtMeasure.FontFamily = fontFamily;
     _txtMeasure.FontSize = fontSize;
     _txtMeasure.FontWeight = bold ? FontWeights.Bold : FontWeights.Normal;
     _txtMeasure.Text = text;
     _txtMeasure.UpdateLayout();
     //txtMeasure.Measure (new Size (1, 1));
     return new System.Drawing.SizeF((float)_txtMeasure.ActualWidth, (float)_txtMeasure.ActualHeight);
 }