internal Line(Document document, int LineNo, string Text, HorizontalAlignment align, Font font, Color color, Color back_color, TextPositioning text_position, float char_offset, float left_indent, float hanging_indent, float right_indent, float spacing_before, float spacing_after, float line_spacing, bool line_spacing_multiple, TabStopCollection tab_stops, bool visible, LineEnding ending) : this(document, ending) { space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length + 1 : DEFAULT_TEXT_LEN; text = new StringBuilder(Text, space); line_no = LineNo; this.ending = ending; alignment = align; indent = left_indent; HangingIndent = hanging_indent; this.right_indent = right_indent; this.spacing_before = spacing_before; this.spacing_after = spacing_after; this.tab_stops = tab_stops; this.line_spacing = line_spacing; this.line_spacing_multiple = line_spacing_multiple; widths = new float[space + 1]; tags = new LineTag(this, 1); tags.Font = font; tags.Color = color; tags.BackColor = back_color; tags.TextPosition = text_position; tags.CharOffset = char_offset; tags.Visible = visible; }
public TabStopCollection Clone() { var n = new TabStopCollection(); foreach (var tab in tabs.Keys) { n.tabs.Add(tab, null); } return(n); }
public virtual SizeF SizeOfPosition(Graphics dc, int pos) { if ((pos >= line.TextLengthWithoutEnding() && line.document.multiline) || !visible) { return(SizeF.Empty); } string text = line.text.ToString(pos, 1); switch ((int)text [0]) { case '\t': if (!line.document.multiline) { goto case 10; } SizeF res = TextBoxTextRenderer.MeasureText(dc, " ", FontToDisplay); // This way we get the height, not that it is ever used... float left = line.widths [pos]; float right = -1; TabStopCollection stops = line.tab_stops; float tabPos; for (int i = 0; i < stops.Count; i++) { tabPos = stops [i].Position; if (tabPos >= left) { if (tabPos <= line.document.viewport_width - line.RightIndent) { break; // Can't use tabs that are past the end of the line. } right = stops [i].CalculateRight(line, pos); break; } } if (right < 0) { float maxWidth = dc.DpiX / 2; // tab stops are 1/2" right = (float)(Math.Floor(left / maxWidth) + 1) * maxWidth; } res.Width = right - left; return(res); case 10: case 13: return(TextBoxTextRenderer.MeasureText(dc, "\u000D", FontToDisplay)); } return(TextBoxTextRenderer.MeasureText(dc, text, FontToDisplay)); }
internal Line(Document document, int LineNo, string Text, Font font, Color color, LineEnding ending) : this(document, ending) { space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length + 1 : DEFAULT_TEXT_LEN; text = new StringBuilder(Text, space); line_no = LineNo; this.ending = ending; tab_stops = new TabStopCollection(); widths = new float[space + 1]; tags = new LineTag(this, 1); tags.Font = font; tags.Color = color; }