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); }
public BarnumberMetrics(Graphics graphics, TextInfo textInfo, FramePadding framePadding) : base(CSSObjectClass.barNumber) { _barNumberNumberMetrics = new TextMetrics(CSSObjectClass.barNumberNumber, graphics, textInfo); _number = textInfo.Text; _top = _barNumberNumberMetrics.Top - framePadding.Top; _right = _barNumberNumberMetrics.Right + framePadding.Right; _bottom = _barNumberNumberMetrics.Bottom + framePadding.Bottom; _left = _barNumberNumberMetrics.Left - framePadding.Left; }
public FramedBarNumberText(object container, string text, double gap, double stafflinethickness) : base(container, text, "Arial", (gap * 2), TextHorizAlign.center) { //double paddingX = 22; //if(text.Length > 1) // paddingX = 10; //double paddingY = 22; double paddingX = 60; if (text.Length > 1) { paddingX = 28; } double paddingY = 60; double strokeWidth = stafflinethickness * 1.2; _frameInfo = new FramePadding(TextFrameType.rectangle, paddingY, paddingX, paddingY, paddingX); }
public FramedRegionEndText(object container, List <string> textStrings, double gap, double stafflinethickness) : base(container, textStrings, gap, stafflinethickness, TextHorizAlign.right) { foreach (string text in textStrings) { if (text.Contains("➔")) { TextFrameType frameType = _frameInfo.FrameType; double paddingTop = _frameInfo.Top; double paddingRight = _frameInfo.Right + 15; // compensate for missing arrow width double paddingBottom = _frameInfo.Bottom; double paddingLeft = _frameInfo.Left + 15; // compensate for missing arrow width _frameInfo = new FramePadding(frameType, paddingTop, paddingRight, paddingBottom, paddingLeft); break; } else { M.Assert(text.Contains("end")); } } }
public FramedRegionInfoMetrics(Graphics graphics, List <Text> texts, FramePadding framePadding, double gap) : base(CSSObjectClass.framedRegionInfo) { Gap = gap; double maxWidth = 0; double nextTop = 0; foreach (Text text in texts) { TextMetrics tm = new TextMetrics(CSSObjectClass.regionInfoString, graphics, text.TextInfo); tm.Move(-tm.Left, -tm.Top); double width = tm.Right - tm.Left; maxWidth = (maxWidth > width) ? maxWidth : width; tm.Move(0, nextTop); nextTop = tm.Top + ((tm.Bottom - tm.Top) * 1.7); _textMetrics.Add(tm); _textStrings.Add(text.TextInfo.Text); } bool alignRight = (texts[0].TextInfo.TextHorizAlign != TextHorizAlign.left); if (alignRight) { foreach (TextMetrics tm in _textMetrics) { double deltaX = maxWidth - (tm.Right - tm.Left); tm.Move(deltaX, 0); // move tm.OriginX so that the text is right aligned (OriginX is used by WriteSVG()) deltaX = (tm.Right - tm.Left) / 2; tm.Move(-deltaX, 0); } } else // align left { foreach (TextMetrics tm in _textMetrics) { // move tm.OriginX so that the text is left aligned (OriginX is used by WriteSVG()) double deltaX = (tm.Right - tm.Left) / 2; tm.Move(deltaX, 0); } } _top = 0 - framePadding.Top; _right = maxWidth + framePadding.Right; _bottom = _textMetrics[_textMetrics.Count - 1].Bottom + framePadding.Bottom; _left = 0 - framePadding.Left; switch (texts[0].TextInfo.TextHorizAlign) { case TextHorizAlign.left: Move(-_left, -_bottom); // set the origin to the bottom left corner break; case TextHorizAlign.center: Move(-((_left + _right) / 2), -_bottom); // set the origin to the middle of the bottom edge break; case TextHorizAlign.right: Move(-_right, -_bottom); // set the origin to the bottom right corner break; } }