/// <summary> /// Initializes a new instance of the <see cref="XFont"/> class from a System.Drawing.FontFamily. /// </summary> /// <param name="fontFamily">The System.Drawing.FontFamily.</param> /// <param name="emSize">The em size.</param> /// <param name="style">The font style.</param> /// <param name="pdfOptions">Additional PDF options.</param> public XFont(UwpFontFamily fontFamily, double emSize, XFontStyle style, XPdfFontOptions pdfOptions) { _familyName = fontFamily.Source; _gdiFontFamily = fontFamily; _emSize = emSize; _style = style; _pdfOptions = pdfOptions; InitializeFromGdi(); }
protected override void OnAttached() { if (Element is Label == false) { return; } TextBlock tb = Control as TextBlock; oldFontFamily = tb.FontFamily; tb.FontFamily = new Windows.UI.Xaml.Media.FontFamily(@"/Assets/Pacifico.ttf#Pacifico"); }
protected override void OnElementChanged(ElementChangedEventArgs <Forms9Patch.Label> e) { DebugMessage("OnElementChanged"); base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.RendererSizeForWidthAndFontSize -= LabelXamarinSize; e.OldElement.SizeChanged -= OnElementSizeChanged; if (Control != null) { Control.SizeChanged -= OnControlSizeChanged; } } if (e.NewElement != null) { newElement = true; if (Control == null) { var nativeControl = new TextBlock(); _defaultNativeFontFamily = nativeControl.FontFamily; _defaultNativeFontSize = nativeControl.FontSize; _defaultNativeFontIsBold = nativeControl.FontWeight.Weight >= Windows.UI.Text.FontWeights.Bold.Weight; _defaultNativeFontIsItalics = nativeControl.FontStyle != Windows.UI.Text.FontStyle.Normal; SetNativeControl(nativeControl); } e.NewElement.RendererSizeForWidthAndFontSize += LabelXamarinSize; e.NewElement.SizeChanged += OnElementSizeChanged; if (Control != null) { Control.SizeChanged += OnControlSizeChanged; } Control.LayoutUpdated += (s, ex) => DebugMessage("Control.LayoutUpdated"); Control.Loading += (s, ex) => DebugMessage("Control.Loading"); Control.Loaded += (s, ex) => DebugMessage("Contorl.Loaded"); Control.Unloaded += (s, ex) => DebugMessage("Control.Unloaded"); UpdateColor(Control); UpdateHorizontalAlign(Control); //UpdateTextAndFont(Control); UpdateLineBreakMode(Control); } }
public MainWindow() { InitializeComponent(); segoeFont = new Windows.UI.Xaml.Media.FontFamily("Segoe MDL2 Assets"); fontIconStyle = new Windows.UI.Xaml.Style(typeof(FontIcon)); fontIconStyle.Setters.Add(new Windows.UI.Xaml.Setter(FontIcon.FontSizeProperty, 16)); fontIconStyle.Setters.Add(new Windows.UI.Xaml.Setter(FontIcon.FontFamilyProperty, segoeFont)); headerTextBlockStyle = new Windows.UI.Xaml.Style(typeof(Windows.UI.Xaml.Controls.TextBlock)); headerTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.Controls.TextBlock.FontSizeProperty, 16)); headerTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.FrameworkElement.MarginProperty, new Windows.UI.Xaml.Thickness(5, 0, 0, 0))); contentTextBlockStyle = new Windows.UI.Xaml.Style(typeof(Windows.UI.Xaml.Controls.TextBlock)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.Controls.TextBlock.FontSizeProperty, 100)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.Controls.TextBlock.ForegroundProperty, Windows.UI.Colors.White)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.FrameworkElement.HorizontalAlignmentProperty, Windows.UI.Xaml.HorizontalAlignment.Center)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.FrameworkElement.VerticalAlignmentProperty, Windows.UI.Xaml.VerticalAlignment.Center)); }
public DiceEvent(String name, int dieValue) { PrimaryText = $"{name} rolled a {dieValue}"; //Glyph = new SymbolIcon(Symbol.Placeholder); var SegoeUISymbol = new Windows.UI.Xaml.Media.FontFamily("Segoe UI Symbol"); String face = ""; if (dieValue == 1) { face = "\u2680"; } else if (dieValue == 2) { face = "\u2681"; } else if (dieValue == 3) { face = "\u2682"; } else if (dieValue == 4) { face = "\u2683"; } else if (dieValue == 5) { face = "\u2684"; } else if (dieValue == 6) { face = "\u2685"; } Glyph = new FontIcon() { Glyph = face, FontFamily = SegoeUISymbol, FontSize = 34 }; }
protected override void OnElementChanged(ElementChangedEventArgs <Forms9Patch.Label> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.RendererSizeForWidthAndFontSize -= LabelXamarinSize; e.OldElement.SizeChanged -= Label_SizeChanged; if (Control != null) { Control.SizeChanged -= Control_SizeChanged; } } if (e.NewElement != null) { if (Control == null) { var nativeControl = new TextBlock(); _defaultNativeFontFamily = nativeControl.FontFamily; _defaultNativeFontSize = nativeControl.FontSize; _defaultNativeFontIsBold = nativeControl.FontWeight.Weight >= Windows.UI.Text.FontWeights.Bold.Weight; _defaultNativeFontIsItalics = nativeControl.FontStyle != Windows.UI.Text.FontStyle.Normal; SetNativeControl(nativeControl); } e.NewElement.RendererSizeForWidthAndFontSize += LabelXamarinSize; e.NewElement.SizeChanged += Label_SizeChanged; if (Control != null) { Control.SizeChanged += Control_SizeChanged; } UpdateColor(Control); UpdateHorizontalAlign(Control); //UpdateTextAndFont(Control); UpdateLineBreakMode(Control); } }
/// <summary> /// Initializes a new instance of the <see cref="XFont"/> class from a System.Drawing.FontFamily. /// </summary> /// <param name="fontFamily">The System.Drawing.FontFamily.</param> /// <param name="emSize">The em size.</param> /// <param name="style">The font style.</param> public XFont(UwpFontFamily fontFamily, double emSize, XFontStyle style) : this(fontFamily, emSize, style, new XPdfFontOptions(GlobalFontSettings.DefaultFontEncoding)) { }
/// <summary> /// Initializes a new instance of the <see cref="FontFamily"/> class, a /// Wpf-enabled wrapper for <see cref="windows.UI.Xaml.Media.FontFamily"/> /// </summary> public FontFamily(windows.UI.Xaml.Media.FontFamily instance) { this.UwpInstance = instance; }
public MaterialIcon() { FontFamily = new Windows.UI.Xaml.Media.FontFamily("/Richasy-Font-UWP/Assets/Material.ttf#Material"); }
/// <summary> /// Initializes a new instance of the <see cref="XFont"/> class from a System.Drawing.FontFamily. /// </summary> /// <param name="fontFamily">The System.Drawing.FontFamily.</param> /// <param name="emSize">The em size.</param> /// <param name="style">The font style.</param> /// <param name="pdfOptions">Additional PDF options.</param> public XFont(UwpFontFamily fontFamily, double emSize, XFontStyle style, XPdfFontOptions pdfOptions) { _familyName = fontFamily.Source; _gdiFontFamily = fontFamily; _emSize = emSize; _style = style; _pdfOptions = pdfOptions; InitializeFromGdi(); }
/// <summary> /// Initializes a new instance of the <see cref="XFont"/> class from a System.Drawing.FontFamily. /// </summary> /// <param name="fontFamily">The System.Drawing.FontFamily.</param> /// <param name="emSize">The em size.</param> /// <param name="style">The font style.</param> public XFont(UwpFontFamily fontFamily, double emSize, XFontStyle style) : this(fontFamily, emSize, style, new XPdfFontOptions(GlobalFontSettings.DefaultFontEncoding)) { }
public BrandIcon() { FontFamily = new Windows.UI.Xaml.Media.FontFamily("/Richasy-Font-UWP/Assets/Brands.ttf#Brands"); }