Example #1
0
 public TagOpenToken(int id, XElement element, TextVisualProperties properties, int parentID, string pointer)
     : base(id)
 {
     Name = element.Name.LocalName;
     TextProperties = properties;
     ParentID = parentID;
     Pointer = pointer;
 }
Example #2
0
 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
                 });
 }
Example #4
0
 private void LeaveMargin(TextVisualProperties properties)
 {
     _marginLeft -= properties.MarginLeft;
     _marginRight -= properties.MarginRight;
 }
Example #5
0
 private void EnterMargin(TextVisualProperties properties)
 {
     _marginLeft += properties.MarginLeft;
     _marginRight += properties.MarginRight;
 }
Example #6
0
 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);
 }
Example #7
0
 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;
 }
Example #8
0
 private Size GetTextSize(string text, TextVisualProperties properties)
 {
     return new Size(
         GetTextWidth(text, false, properties), 
         GetTextHeight(text, properties.Bold, properties.Italic));
 }