Example #1
0
 public Text(object container,
             string text, string fontName, double fontHeight,
             SVGFontWeight weight, SVGFontStyle style, TextHorizAlign align)
     : base(container)
 {
     _textInfo = new TextInfo(text, fontName, fontHeight, weight, style, new ColorString("000000"), align);
 }
Example #2
0
        public CLichtCharacterMetrics(string name, bool isDynamic, float fontHeight, TextHorizAlign textHorizAlign)
            : base()
        {
            if (isDynamic)
            {
                _objectType = name;
            }
            else             // clefs
            {
                _objectType = GetClichtCharacterString(name);
            }

            Debug.Assert(_objectType != null);
            Metrics m = CLichtFontMetrics.CLichtGlyphBoundingBoxesDictPX[_objectType];

            _originY = 0;
            _top     = m.Top * fontHeight;
            _bottom  = m.Bottom * fontHeight;

            // move so that Left = 0.
            _left    = 0;
            _right   = (m.Right - m.Left) * fontHeight;
            _originX = -m.Left * fontHeight;

            _fontHeight     = fontHeight;
            _textHorizAlign = textHorizAlign;
        }
Example #3
0
 public TextInfo(string text, string fontFamily, float fontHeight, ColorString colorString, 
     TextHorizAlign textHorizAlign)
 {
     Debug.Assert(!String.IsNullOrEmpty(text));
     _text = text;
     _fontFamily = fontFamily;
     _fontHeight = fontHeight;
     _textHorizAlign = textHorizAlign;
     _colorString = colorString;
 }
Example #4
0
 public TextInfo(string text, string fontFamily, float fontHeight, ColorString colorString,
                 TextHorizAlign textHorizAlign)
 {
     Debug.Assert(!String.IsNullOrEmpty(text));
     _text           = text;
     _fontFamily     = fontFamily;
     _fontHeight     = fontHeight;
     _textHorizAlign = textHorizAlign;
     _colorString    = colorString;
 }
Example #5
0
 public TextInfo(string text, string fontFamily, double fontHeight, SVGFontWeight svgFontWeight, SVGFontStyle svgFontStyle,
                 ColorString colorString, TextHorizAlign textHorizAlign)
 {
     M.Assert(!String.IsNullOrEmpty(text));
     _text           = text;
     _fontFamily     = fontFamily;
     _svgFontWeight  = svgFontWeight;
     _svgFontStyle   = svgFontStyle;
     _fontHeight     = fontHeight;
     _textHorizAlign = textHorizAlign;
     _colorString    = colorString;
 }
Example #6
0
        public TextStyle(CSSObjectClass cssTextClass, string fontFamily, double fontHeight, SVGFontWeight svgFontWeight, SVGFontStyle svgFontStyle,
                         TextHorizAlign textAnchor = TextHorizAlign.left, string fill = "black")
            : base(cssTextClass)
        {
            FontFamily = fontFamily;
            FontHeight = fontHeight;
            FontWeight = svgFontWeight;
            FontStyle  = svgFontStyle;

            switch (textAnchor)
            {
            case (TextHorizAlign.left):
                TextAnchor = "left";
                break;

            case (TextHorizAlign.center):
                TextAnchor = "middle";
                break;

            case (TextHorizAlign.right):
                TextAnchor = "right";
                break;
            }
            if (fill == "#FFFFFF" || fill == "FFFFFF")
            {
                Fill = "white";
            }
            else if (fill == "#000000" || fill == "000000")
            {
                Fill = "black";
            }
            else if (fill == "none" || fill == "white" || fill == "black" || fill == "red")
            {
                Fill = fill;
            }
            else
            {
                if (fill[0] != '#')
                {
                    fill.Insert(0, "#");
                }
                M.Assert(Regex.IsMatch(fill, @"^#[0-9a-fA-F]{6}$"));
                Fill = fill; // a string of the form "#AAAAAA"
            }
        }
Example #7
0
        /// <summary>
        /// Used by DynamicMetrics and AugDotMetrics
        /// </summary>
        public CLichtCharacterMetrics(string characterString, double fontHeight, TextHorizAlign textHorizAlign, CSSObjectClass objectClass)
            : base(objectClass, "CLicht", fontHeight, textHorizAlign)
        {
            _characterString = characterString;

            M.Assert(_characterString != null);
            Metrics m = CLichtFontMetrics.CLichtGlyphBoundingBoxesDictPX[_characterString];

            _originY = 0;
            _top     = m.Top * fontHeight;
            _bottom  = m.Bottom * fontHeight;

            // move so that Left = 0.
            _left    = 0;
            _right   = (m.Right - m.Left) * fontHeight;
            _originX = -m.Left * fontHeight;             // overridden in AugDotMetrics constructor

            _fontHeight     = fontHeight;
            _textHorizAlign = textHorizAlign;
        }
Example #8
0
 public TextInfo(string text, string fontFamily, double fontHeight, TextHorizAlign textHorizAlign)
     : this(text, fontFamily, fontHeight, new ColorString("000000"), textHorizAlign)
 {
 }
Example #9
0
 public TextInfo(string text, string fontFamily, double fontHeight, ColorString colorString, TextHorizAlign textHorizAlign)
     : this(text, fontFamily, fontHeight, SVGFontWeight.normal, SVGFontStyle.normal, colorString, textHorizAlign)
 {
 }
Example #10
0
 public TextInfo(string text, string fontFamily, float fontHeight, TextHorizAlign textHorizAlign)
     : this(text, fontFamily, fontHeight, new ColorString("000000"), textHorizAlign)
 {
 }
Example #11
0
 public Text(object container, string text, string fontName, float fontHeight, TextHorizAlign align)
     : base(container)
 {
     _textInfo = new TextInfo(text, fontName, fontHeight, align);
 }
Example #12
0
        public CLichtCharacterMetrics(string name, bool isDynamic, float fontHeight, TextHorizAlign textHorizAlign)
            : base()
        {
            if(isDynamic)
                _objectType = name;
            else // clefs
                _objectType = GetClichtCharacterString(name);

            Debug.Assert(_objectType != null);
            Metrics m = CLichtFontMetrics.CLichtGlyphBoundingBoxesDictPX[_objectType];

            _originY = 0;
            _top = m.Top * fontHeight;
            _bottom = m.Bottom * fontHeight;

            // move so that Left = 0.
            _left = 0;
            _right = (m.Right - m.Left) * fontHeight;
            _originX = -m.Left * fontHeight;

            _fontHeight = fontHeight;
            _textHorizAlign = textHorizAlign;
        }
Example #13
0
 public TextStyle(CSSObjectClass cssTextClass, string fontFamily, double fontHeight, TextHorizAlign textAnchor = TextHorizAlign.left, string fill = "black")
     : this(cssTextClass, fontFamily, fontHeight, SVGFontWeight.normal, SVGFontStyle.normal, textAnchor = TextHorizAlign.left, fill = "black")
 {
 }
Example #14
0
 public Text(object container, string text, string fontName, double fontHeight, TextHorizAlign align)
     : base(container)
 {
     _textInfo = new TextInfo(text, fontName, fontHeight, align);
 }
Example #15
0
        public FramedMultilineText(object container, List <string> textStrings, double gap, double stafflinethickness, TextHorizAlign hAlign)
            : base(container, textStrings, gap, stafflinethickness, hAlign)
        {
            double paddingTop    = 40;
            double paddingRight  = 26;
            double paddingBottom = 30;
            double paddingLeft   = 26;

            _frameInfo = new FramePadding(TextFrameType.rectangle, paddingTop, paddingRight, paddingBottom, paddingLeft);
        }
Example #16
0
 public TextList(object container, List <string> textStrings, double gap, double stafflinethickness, TextHorizAlign hAlign)
 {
     foreach (string textString in textStrings)
     {
         this.Texts.Add(new Text(container, textString, "Arial", (gap * 2.5), hAlign));
     }
 }