private void EmitSpanWrapper(TextSpan span, StringBuilder sb) { if (span.Style == "kw") sb.Append("'"); if (span.Style == "cmt") sb.Append("rem "); if (span.Style == "link") sb.Append("_"); }
/// <summary> /// Computes the size of a text span. /// </summary> /// <remarks> /// The span is first asked to measure itself, then the current style is /// allowed to override the size. /// </remarks> /// <param name="span"></param> /// <param name="text"></param> /// <param name="font"></param> /// <param name="g"></param> /// <returns></returns> private SizeF GetSize(TextSpan span, string text, Font font, Graphics g) { var size = span.GetSize(text, font, g); int? width = styleStack.GetWidth(this); if (width.HasValue) { size.Width = width.Value; } return size; }
public TextSpanModel(TextSpan[][] lines) { this.lines = lines; }
/// <summary> /// Computes the size of a text span. /// </summary> /// <remarks> /// The span is first asked to measure itself, then the current style is /// allowed to override the size. /// </remarks> /// <param name="span"></param> /// <param name="text"></param> /// <param name="font"></param> /// <param name="g"></param> /// <returns></returns> private SizeF GetSize(TextSpan span, string text, Font font, Graphics g) { var size = span.GetSize(text, font, g); UiStyle style = GetStyle(span.Style); if (style != null && style.Width.HasValue) { size.Width = style.Width.Value; } return size; }
public TextSpan[][] GetLineSpans(int count) { int p = (int)position; int c = Math.Min(count, lines.Length - p); if (c <= 0) return new TextSpan[0][]; var spans = new TextSpan[c][]; Array.Copy(lines, p, spans, 0, c); return spans; }