Use GuiWidget instead of TextWidget for inline space

- Issue MatterHackers/MCCentral#5583
Agg Markdown parse creates unique texture per space
This commit is contained in:
jlewin 2019-05-24 13:52:37 -07:00
parent 822657d200
commit eeebdb6077

View file

@ -11,6 +11,7 @@ using Markdig.Renderers.Agg;
using Markdig.Renderers.Agg.Inlines;
using Markdig.Syntax;
using MatterHackers.Agg;
using MatterHackers.Agg.Font;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl;
@ -25,12 +26,22 @@ namespace Markdig.Renderers
}
}
public class TextSpaceX : TextWidget, ISkipIfFirst
public class TextSpaceX : GuiWidget, ISkipIfFirst
{
private static double spaceWidth = -1;
public TextSpaceX(ThemeConfig theme)
: base("", pointSize: 10, textColor: theme.TextColor)
{
this.AutoExpandBoundsToText = true;
this.HAnchor = HAnchor.Absolute;
this.VAnchor = VAnchor.Absolute;
if (spaceWidth == -1)
{
spaceWidth = new TypeFacePrinter(" ", pointSize: 10).LocalBounds.Width;
}
this.Width = spaceWidth;
this.Height = spaceWidth;
}
}
@ -54,6 +65,7 @@ namespace Markdig.Renderers
public GuiWidget RootWidget { get; }
public Uri BaseUri { get; set; } = new Uri("https://www.matterhackers.com/");
public List<MarkdownDocumentLink> ChildLinks { get; internal set; }
public AggRenderer(ThemeConfig theme)