Ejemplo n.º 1
0
        public static FontStyle ToEto(this ag.TypefaceStyle style)
        {
            var ret = FontStyle.None;

            if (style == ag.TypefaceStyle.Normal)
            {
                ret = FontStyle.None;
            }
            else if (style == ag.TypefaceStyle.Bold)
            {
                ret = FontStyle.Bold;
            }
            else if (style == ag.TypefaceStyle.Italic)
            {
                ret = FontStyle.Italic;
            }
            return(ret);
        }
Ejemplo n.º 2
0
 public static FontStyle ToXwt(this  AG.TypefaceStyle value)
 {
     if (AG.TypefaceStyle.Normal == value)
     {
         return(FontStyle.Normal);
     }
     if (AG.TypefaceStyle.Italic == value)
     {
         return(FontStyle.Italic);
     }
     if (AG.TypefaceStyle.Bold == value)
     {
         return(FontStyle.Oblique);
     }
     if (AG.TypefaceStyle.BoldItalic == value)
     {
         return(FontStyle.Oblique | FontStyle.Italic);
     }
     return(FontStyle.Normal);
 }
Ejemplo n.º 3
0
        public bool TryGetValueTypeless(object key, out object value)
        {
            bool found;

            if (key == DecorKeyConnector.Typeface)
            {
                Graphics.Typeface typefaceFamily;
                if (this.TryGetValue(DecorKeyConnector.TypefaceFamily, out typefaceFamily))
                {
                    Graphics.TypefaceStyle typefaceStyle = this.GetValueOrDefault(DecorKeyConnector.TypefaceStyle);
                    Graphics.Typeface      typeface      = Graphics.Typeface.Create(typefaceFamily, typefaceStyle);
                    value = typeface;
                    return(true);
                }
                else
                {
                    value = null;
                    return(false);
                }
            }
            else if (key == DecorKeyConnector.TypefaceFamily)
            {
                value = decoration.GetValueConnectedTry(DecorationKey.FontFamily, TransformFontFamilyToTypefaceFamily, out found);
            }

            else if (key == DecorKeyConnector.TypefaceStyle)
            {
                Graphics.TypefaceStyle fontStyle;
                bool foundStyle = decoration.TryGetValueConnected(DecorationKey.FontStyle, TransformFontStyle, out fontStyle);

                Graphics.TypefaceStyle fontWeight;
                bool foundWeight = decoration.TryGetValueConnected(DecorationKey.FontWeight, TransformFontWeight, out fontWeight);

                found = foundStyle | foundWeight;
                value = fontStyle | fontWeight;

                value = decoration.GetValueConnectedTry(DecorationKey.FontFamily, TransformFontFamilyToTypefaceFamily, out found);
            }

            else if (key == DecorKeyConnector.FontSize)
            {
                value = decoration.GetValueConnectedTry(DecorationKey.FontSize, DecorationExtensions.IdentityTransformation, out found);
            }

            else if (key == DecorKeyConnector.FontSizeRelativePercent)
            {
                value = decoration.GetValueConnectedTry(DecorationKey.FontSizeRelativePercent, DecorationExtensions.IdentityTransformation, out found);
            }

            else if (key == DecorKeyConnector.Foreground)
            {
                value = decoration.GetValueConnectedTry(DecorationKey.Foreground, TransformColor, out found);
            }

            else if (key == DecorKeyConnector.Background)
            {
                value = decoration.GetValueConnectedTry(DecorationKey.Background, TransformColor, out found);
            }

            else
            {
                found = false;
                value = null;
            }

            return(found);
        }