Пример #1
0
        /// <summary>
        /// Adds the font.
        /// </summary>
        /// <param name="family">The family.</param>
        /// <param name="size">The size.</param>
        /// <param name="style">The style.</param>
        /// <param name="weight">The weight.</param>
        /// <param name="method">The method.</param>
        public void AddFont(FontFamily family, double size, FontStyle style, FontWeight weight, CodeMemberMethod method)
        {
            FontInfo info = new FontInfo(family, size, style, weight);

            fonts[info.GetHashCode()]         = info;
            generateFonts[info.GetHashCode()] = info;
        }
Пример #2
0
        /// <summary>
        /// Adds the font.
        /// </summary>
        /// <param name="family">The family.</param>
        /// <param name="size">The size.</param>
        /// <param name="style">The style.</param>
        /// <param name="weight">The weight.</param>
        /// <param name="method">The method.</param>
        public void AddFont(FontFamily family, double size, FontStyle style, FontWeight weight, CodeMemberMethod method)
        {
            FontInfo info = new FontInfo(family, size, style, weight);

            fonts[info.GetHashCode()] = info;

            string fontName  = GetFontName(info);
            float  fontSize  = GetFontSize(info);
            string fontStyle = GetFontStyle(info);
            string assetName = GetFontAssetName(fontName, fontSize, fontStyle);

            CodeExpression styleExpr  = CodeComHelper.GenerateFontStyleExpression(style, weight);
            CodeExpression familyExpr = CodeComHelper.GenerateFontFamilyExpression(family);

            method.Statements.Add(new CodeMethodInvokeExpression(
                                      new CodeTypeReferenceExpression("FontManager"), "Instance.AddFont",
                                      new CodePrimitiveExpression(fontName), new CodePrimitiveExpression((float)size), styleExpr, new CodePrimitiveExpression(assetName)));
        }
Пример #3
0
 /// <summary>
 /// Adds the font.
 /// </summary>
 /// <param name="family">The family.</param>
 /// <param name="size">The size.</param>
 /// <param name="style">The style.</param>
 /// <param name="weight">The weight.</param>
 /// <param name="method">The method.</param>
 public void AddFont(FontFamily family, double size, FontStyle style, FontWeight weight, CodeMemberMethod method)
 {
     FontInfo info = new FontInfo(family, size, style, weight);
     fonts[info.GetHashCode()] = info;            
 }