C# FontWeight类代码示例(c#fontweight类典型用法代码示例汇总)

本文整理汇总了C#中FontWeight的典型用法代码示例。如果您正苦于以下问题:C# FontWeight类的具体用法?C# FontWeight怎么用?C# FontWeight使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


C# FontWeight类代码示例(c#fontweight类典型用法代码示例汇总)

FontWeight类属于命名空间,在下文中一共展示了FontWeight类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FormattedTextImpl

 public FormattedTextImpl(string text, string fontFamilyName, double fontSize, FontStyle fontStyle,
                    TextAlignment textAlignment, FontWeight fontWeight, TextWrapping wrapping)
        {
            _text = text ?? string.Empty;

            // Replace 0 characters with zero-width spaces (200B)
            _text = _text.Replace((char)0, (char)0x200B);

            var typeface = TypefaceCache.GetTypeface(fontFamilyName, fontStyle, fontWeight);

            _paint = new SKPaint();

            //currently Skia does not measure properly with Utf8 !!!
            //Paint.TextEncoding = SKTextEncoding.Utf8;
            _paint.TextEncoding = SKTextEncoding.Utf16;
            _paint.IsStroke = false;
            _paint.IsAntialias = true;            
            _paint.LcdRenderText = true;            
            _paint.SubpixelText = true;
            _paint.Typeface = typeface;
            _paint.TextSize = (float)fontSize;
            _paint.TextAlign = textAlignment.ToSKTextAlign();

            _wrapping = wrapping;

            Rebuild();
        }
开发者ID:jkoritzinsky,项目名称:Avalonia,代码行数:27,代码来源:FormattedTextImpl.cs

示例2: DrawableFont

 ///<summary>
 /// Creates a new DrawableFont instance.
 ///</summary>
 ///<param name="family">The font family or the full path to the font file.</param>
 ///<param name="style">The style of the font.</param>
 ///<param name="weight">The weight of the font.</param>
 ///<param name="stretch">The font stretching type.</param>
 public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
   Family = family;
   Style = style;
   Weight = weight;
   Stretch = stretch;
 }
开发者ID:levesque,项目名称:Magick.NET,代码行数:14,代码来源:DrawableFont.cs

示例3: FormattedText

 /// <summary>
        /// Initializes a new instance of the <see cref="FormattedText"/> class.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="fontFamilyName">The font family.</param>
        /// <param name="fontSize">The font size.</param>
        /// <param name="fontStyle">The font style.</param>
        /// <param name="textAlignment">The text alignment.</param>
        /// <param name="fontWeight">The font weight.</param>
        public FormattedText(
            string text,
            string fontFamilyName,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            Contract.Requires<ArgumentNullException>(text != null);
            Contract.Requires<ArgumentNullException>(fontFamilyName != null);
            Contract.Requires<ArgumentException>(fontSize > 0);

            Text = text;
            FontFamilyName = fontFamilyName;
            FontSize = fontSize;
            FontStyle = fontStyle;
            FontWeight = fontWeight;
            TextAlignment = textAlignment;

            var platform = PerspexLocator.Current.GetService<IPlatformRenderInterface>();

            if (platform == null)
            {
                throw new Exception("Could not create FormattedText: IPlatformRenderInterface not registered.");
            }

            PlatformImpl = platform.CreateFormattedText(
                text,
                fontFamilyName,
                fontSize,
                fontStyle,
                textAlignment,
                fontWeight);
        }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:43,代码来源:FormattedText.cs

示例4: Typeface

 public Typeface(FontFamily fontFamily, FontStyle style, FontWeight weight, FontStretch stretch)
 {
     this.FontFamily = fontFamily;
     this.Style = style;
     this.Weight = weight;
     this.Stretch = stretch;
 }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:7,代码来源:Typeface.cs

示例5: FormattedText

 /// <summary>
        /// Initializes a new instance of the <see cref="FormattedText"/> class.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="fontFamilyName">The font family.</param>
        /// <param name="fontSize">The font size.</param>
        /// <param name="fontStyle">The font style.</param>
        /// <param name="textAlignment">The text alignment.</param>
        /// <param name="fontWeight">The font weight.</param>
        public FormattedText(
            string text,
            string fontFamilyName,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            //TODO: Find out why it was null in the first place. Demo project - AvalonStudio
            //https://github.com/VitalElement/AvalonStudio/commit/787fb9396feb74e6ca6bd4e08436269a349df9c6
            text = text ?? "";
            Text = text;
            FontFamilyName = fontFamilyName;
            FontSize = fontSize;
            FontStyle = fontStyle;
            FontWeight = fontWeight;
            TextAlignment = textAlignment;

            var platform = PerspexLocator.Current.GetService<IPlatformRenderInterface>();

            PlatformImpl = platform.CreateFormattedText(
                text,
                fontFamilyName,
                fontSize,
                fontStyle,
                textAlignment,
                fontWeight);
        }
开发者ID:g4idrijs,项目名称:Perspex,代码行数:37,代码来源:FormattedText.cs

示例6: FormattedTextImpl

 public FormattedTextImpl(
            Pango.Context context,
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            Contract.Requires<ArgumentNullException>(context != null);
            Contract.Requires<ArgumentNullException>(text != null);
            Layout = new Pango.Layout(context);
            _text = text;
            Layout.SetText(text);
            Layout.FontDescription = new Pango.FontDescription
            {
                Family = fontFamily,
                Size = Pango.Units.FromDouble(CorrectScale(fontSize)),
                Style = (Pango.Style)fontStyle,
                Weight = fontWeight.ToCairo()
            };

            Layout.Alignment = textAlignment.ToCairo();
            Layout.Attributes = new Pango.AttrList();
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:25,代码来源:FormattedTextImpl.cs

示例7: Font

public Font(string family, float size, FontWeight weight, FontSlant style)
		{
			this.Family = family;
			this.Size = size;
			this.Weight = weight;
			this.Style = style;
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:7,代码来源:Font.cs

示例8: Font

 public Font(string family, FontStyle style, FontWeight weight, float size)
 {
     Family = family;
     mStyle = style;
     Weight = weight;
     Size = size;
 }
开发者ID:Linrasis,项目名称:WoWEditor,代码行数:7,代码来源:FontCollection.cs

示例9: FormattedTextImpl

 public FormattedTextImpl(
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            var factory = Locator.Current.GetService<DWrite.Factory>();

            var format = new DWrite.TextFormat(
                factory,
                fontFamily,
                (DWrite.FontWeight)fontWeight,
                (DWrite.FontStyle)fontStyle,
                (float)fontSize);

            TextLayout = new DWrite.TextLayout(
                factory,
                text ?? string.Empty,
                format,
                float.MaxValue,
                float.MaxValue);

            TextLayout.TextAlignment = textAlignment.ToDirect2D();
        }
开发者ID:healtech,项目名称:Perspex,代码行数:26,代码来源:FormattedTextImpl.cs

示例10: Typeface

 public Typeface(FontFamily fontFamily, FontStyle style = FontStyle.Normal, FontWeight weight = FontWeight.Normal, FontStretch stretch = FontStretch.Normal)
 {
     this.FontFamily = fontFamily;
     this.Style = style;
     this.Weight = weight;
     this.Stretch = stretch;
 }
开发者ID:highzion,项目名称:Granular,代码行数:7,代码来源:Typeface.cs

示例11: FormattedText

 public FormattedText(
            string text,
            string fontFamilyName,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight)
        {
            this.Text = text;
            this.FontFamilyName = fontFamilyName;
            this.FontSize = fontSize;
            this.FontStyle = fontStyle;
            this.FontWeight = fontWeight;
            this.TextAlignment = textAlignment;

            var platform = Locator.Current.GetService<IPlatformRenderInterface>();

            this.PlatformImpl = platform.CreateFormattedText(
                text,
                fontFamilyName,
                fontSize,
                fontStyle,
                textAlignment,
                fontWeight);
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:25,代码来源:FormattedText.cs

示例12: FormattedTextImpl

 public FormattedTextImpl(
            string text,
            string fontFamily,
            double fontSize,
            FontStyle fontStyle,
            TextAlignment textAlignment,
            FontWeight fontWeight,
            TextWrapping wrapping)
        {
            var factory = AvaloniaLocator.Current.GetService<DWrite.Factory>();

            using (var format = new DWrite.TextFormat(
                factory,
                fontFamily,
                (DWrite.FontWeight)fontWeight,
                (DWrite.FontStyle)fontStyle,
                (float)fontSize))
            {
                format.WordWrapping = wrapping == TextWrapping.Wrap ? 
                    DWrite.WordWrapping.Wrap : DWrite.WordWrapping.NoWrap;

                TextLayout = new DWrite.TextLayout(
                    factory,
                    text ?? string.Empty,
                    format,
                    float.MaxValue,
                    float.MaxValue);
            }

            TextLayout.TextAlignment = textAlignment.ToDirect2D();
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:31,代码来源:FormattedTextImpl.cs

示例13: HtmlFont

 public HtmlFont(FontStyle style, FontVariant variant, FontWeight weight, Unit size, FontFamily family)
 {
     this.style = style;
     this.variant = variant;
     this.family = family;
     this.weight = weight;
     this.size = size;
 }
开发者ID:rexyanglucky,项目名称:uba,代码行数:8,代码来源:HtmlFont.cs

示例14: Create

 public override object Create(string fontName, double size, FontStyle style, FontWeight weight, FontStretch stretch)
 {
     object o = NSFont.FromFontName (fontName, (float)size);
     o = SetStyle (o, style);
     o = SetWeight (o, weight);
     o = SetStretch (o, stretch);
     return o;
 }
开发者ID:Gaushick,项目名称:xwt,代码行数:8,代码来源:FontBackendHandler.cs

示例15: DrawableFont

 /// <summary>
    /// Initializes a new instance of the <see cref="DrawableFont"/> class.
    /// </summary>
    /// <param name="family">The font family or the full path to the font file.</param>
    /// <param name="style">The style of the font.</param>
    /// <param name="weight">The weight of the font.</param>
    /// <param name="stretch">The font stretching type.</param>
    public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
    {
      Throw.IfNullOrEmpty(nameof(family), family);

      Family = family;
      Style = style;
      Weight = weight;
      Stretch = stretch;
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:16,代码来源:DrawableFont.cs

本文标签属性:

示例:示例英语

代码:代码编程

FontWeight:fontweightbold是什么意思

上一篇:世界上最严重的中毒事件发生在哪里?(山东一饭店多人出现中毒现象,到底是怎么一回事?)(世界上最严重的中毒事件)
下一篇:Java UIComponent.getCompositeComponentParent方法代码示例

为您推荐