예제 #1
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement(FontElementName);
     writer.WriteAttributeString(StyleAttributeName, FontStyle.ToString());
     writer.WriteAttributeString(VariantAttributeName, FontVariant.ToString());
     writer.WriteAttributeString(WidthAttributeName, FontWidth.ToString());
     writer.WriteAttributeString(StretchAttributeName, FontStretch.ToString());
     foreach (var fontSource in _sources)
     {
         fontSource.WriteXml(writer);
     }
     writer.WriteEndElement();
 }
예제 #2
0
        public Font CreateFont([NotNull] string familyName, FontWeight weight = FontWeight.Normal, FontWidth width = FontWidth.Normal, FontSlant slant = FontSlant.Normal)
        {
            Guard.NotNullOrEmpty(familyName, nameof(familyName));

            var typeface = SKTypeface.FromFamilyName(familyName, (SKFontStyleWeight)weight, (SKFontStyleWidth)width, (SKFontStyleSlant)slant);

            Guard.NotNull(typeface, nameof(typeface));

            var font = new Font(this, typeface);

            _loadedFonts.Add(font);

            return(font);
        }
        public static Font CreateFontVariance([NotNull] this Font baseFont, FontWeight weight = FontWeight.Normal, FontWidth width = FontWidth.Normal, FontSlant slant = FontSlant.Normal)
        {
            Guard.ArgumentNotNull(baseFont, nameof(baseFont));

            return(baseFont.FontManager.CreateFont(baseFont.FamilyName, weight, width, slant));
        }