public Font GetFont(FONT_FAMILY family, float size)
 {
     return(GetFont(family, size, FontStyle.Regular));
 }
Exemple #2
0
        private void ExtractValues(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader)
        {
            FontFamily fontFamily = FontFamily.Default;
            FontStyle  fontStyle  = FontStyle.Normal;

            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);

                string name  = reader.Name;
                string value = reader.Value;

                if (K.Equals(name))
                {
                    this.textKey = TextKey.getInstance(value);
                }
                else if (POSITION.Equals(name))
                {
                    this.position = value.ToPosition();
                }
                else if (CAT.Equals(name))
                {
                    this.category = value;
                }
                else if (DISPLAY.Equals(name))
                {
                    this.display = value.ToDisplay();
                }
                else if (DY.Equals(name))
                {
                    this.dy = float.Parse(value) * displayModel.ScaleFactor;
                }
                else if (FONT_FAMILY.Equals(name))
                {
                    fontFamily = value.ToFontFamily();
                }
                else if (FONT_STYLE.Equals(name))
                {
                    fontStyle = value.ToFontStyle();
                }
                else if (FONT_SIZE.Equals(name))
                {
                    this.fontSize = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else if (FILL.Equals(name))
                {
                    this.fill.Color = XmlUtils.GetColor(value);
                }
                else if (PRIORITY.Equals(name))
                {
                    this.priority = int.Parse(value);
                }
                else if (STROKE.Equals(name))
                {
                    this.stroke.Color = XmlUtils.GetColor(value);
                }
                else if (STROKE_WIDTH.Equals(name))
                {
                    this.stroke.StrokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else if (SYMBOL_ID.Equals(name))
                {
                    this.symbolId = value;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }

            this.fill.SetTypeface(fontFamily, fontStyle);
            this.stroke.SetTypeface(fontFamily, fontStyle);

            XmlUtils.CheckMandatoryAttribute(elementName, K, this.textKey);
        }
 public Font GetFont(FONT_FAMILY family, float size, FontStyle style)
 {
     return(new Font(Fonts.Families[(int)family], size, style, GraphicsUnit.Point));
 }