public TagOpenToken(int id, XElement element, TextVisualProperties properties, int parentID, string pointer)
     : base(id)
 {
     Name = element.Name.LocalName;
     TextProperties = properties;
     ParentID = parentID;
     Pointer = pointer;
 }
 private TagOpenToken(int id, string name, TextVisualProperties properties, int parentId, string pointer)
     : base(id)
 {
     Name = name;
     TextProperties = properties;
     ParentID = parentId;
     Pointer = pointer;
 }
 public void AddText(string text, TextVisualProperties properties, double fontSize, Size size, string part = null, int tokenID = -1)
 {
     part = part ?? string.Empty;
     Inlines.Add(new TextElement
                 {
                     Text = text,
                     Width = size.Width,
                     Height = size.Height,
                     Bold = properties.Bold,
                     Italic = properties.Italic,
                     Size = fontSize,
                     SupOption = properties.SupOption,
                     SubOption = properties.SubOption,
                     Part = part,
                     LinkID = properties.LinkID,
                     TokenID = tokenID
                 });
 }
 private void LeaveMargin(TextVisualProperties properties)
 {
     _marginLeft -= properties.MarginLeft;
     _marginRight -= properties.MarginRight;
 }
 private void EnterMargin(TextVisualProperties properties)
 {
     _marginLeft += properties.MarginLeft;
     _marginRight += properties.MarginRight;
 }
 private double GetTextWidth(string text, TextVisualProperties properties, double size)
 {
     if (text == " ")
         return 2;
     return text.Aggregate(0.0, (current, c) => current + _helper.GetSize(c, size, properties.Bold, properties.Italic).Width);
 }
 private double GetTextWidth(string text, bool separator, TextVisualProperties properties)
 {
     if (separator)
         text = " " + text;
     double size = _fontSize*(properties.SubOption || properties.SupOption ? 0.5 : 1.0);
     var width = separator ?  GetTextWidth(text+"_", properties, size) : GetTextWidth(text, properties, size);
     return width;
 }
 private Size GetTextSize(string text, TextVisualProperties properties)
 {
     return new Size(
         GetTextWidth(text, false, properties), 
         GetTextHeight(text, properties.Bold, properties.Italic));
 }