示例#1
0
 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("_");
 }
示例#2
0
 /// <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;
 }
示例#3
0
 public TextSpanModel(TextSpan[][] lines)
 {
     this.lines = lines;
 }
示例#4
0
 /// <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;
 }
示例#5
0
 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;
 }