diff --git a/ControlElements/MHTextEditWidget.cs b/ControlElements/MHTextEditWidget.cs index 8ad73aed4..5940d93bf 100644 --- a/ControlElements/MHTextEditWidget.cs +++ b/ControlElements/MHTextEditWidget.cs @@ -1,4 +1,5 @@ using MatterHackers.Agg; +using MatterHackers.Agg.Font; using MatterHackers.Agg.UI; using MatterHackers.VectorMath; using System; @@ -16,10 +17,10 @@ namespace MatterHackers.MatterControl get { return actuallTextEditWidget; } } - public MHTextEditWidget(string text = "", double x = 0, double y = 0, double pointSize = 12, double pixelWidth = 0, double pixelHeight = 0, bool multiLine = false, int tabIndex = 0, string messageWhenEmptyAndNotSelected = "") + public MHTextEditWidget(string text = "", double x = 0, double y = 0, double pointSize = 12, double pixelWidth = 0, double pixelHeight = 0, bool multiLine = false, int tabIndex = 0, string messageWhenEmptyAndNotSelected = "", TypeFace typeFace = null) { Padding = new BorderDouble(3); - actuallTextEditWidget = new TextEditWidget(text, x, y, pointSize, pixelWidth, pixelHeight, multiLine, tabIndex: tabIndex); + actuallTextEditWidget = new TextEditWidget(text, x, y, pointSize, pixelWidth, pixelHeight, multiLine, tabIndex: tabIndex, typeFace: typeFace); actuallTextEditWidget.HAnchor = Agg.UI.HAnchor.ParentLeftRight; actuallTextEditWidget.MinimumSize = new Vector2(Math.Max(actuallTextEditWidget.MinimumSize.x, pixelWidth), Math.Max(actuallTextEditWidget.MinimumSize.y, pixelHeight)); actuallTextEditWidget.VAnchor = Agg.UI.VAnchor.ParentBottom; diff --git a/PrinterControls/TerminalWindow/TerminalWidget.cs b/PrinterControls/TerminalWindow/TerminalWidget.cs index 9bce5fdf0..ea05cec6c 100644 --- a/PrinterControls/TerminalWindow/TerminalWidget.cs +++ b/PrinterControls/TerminalWindow/TerminalWidget.cs @@ -29,6 +29,8 @@ either expressed or implied, of the FreeBSD Project. using MatterHackers.Agg; using MatterHackers.Agg.UI; +using MatterHackers.Agg.Font; +using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.PrinterCommunication; @@ -138,7 +140,8 @@ namespace MatterHackers.MatterControl manualEntryLayout.BackgroundColor = this.backgroundColor; manualEntryLayout.HAnchor = HAnchor.ParentLeftRight; { - manualCommandTextEdit = new MHTextEditWidget(""); + string pathToFont = StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationMono.svg")); + manualCommandTextEdit = new MHTextEditWidget("", typeFace: TypeFace.LoadFrom(pathToFont)); //manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White; manualCommandTextEdit.Margin = new BorderDouble(right: 3); manualCommandTextEdit.HAnchor = HAnchor.ParentLeftRight; @@ -304,4 +307,4 @@ namespace MatterHackers.MatterControl manualCommandTextEdit.Text = ""; } } -} \ No newline at end of file +} diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index c4c152079..2d9f65771 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -26,7 +26,9 @@ The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ + using MatterHackers.Agg; +using MatterHackers.Agg.Font; using MatterHackers.Agg.Image; using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; @@ -37,6 +39,7 @@ using MatterHackers.SerialPortCommunication.FrostedSerial; using MatterHackers.VectorMath; using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace MatterHackers.MatterControl.SlicerConfiguration @@ -1210,11 +1213,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration case SliceSettingData.DataEditTypes.MULTI_LINE_TEXT: { string convertedNewLines = sliceSettingValue.Replace("\\n", "\n"); - var stringEdit = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++) + string pathToFont = StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationMono.svg")); + var stringEdit = new MHTextEditWidget(convertedNewLines, pixelWidth: 320, pixelHeight: multiLineEditHeight, multiLine: true, tabIndex: tabIndexForItem++, typeFace: TypeFace.LoadFrom(pathToFont)) { HAnchor = HAnchor.ParentLeftRight, }; - + stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { ActiveSliceSettings.Instance.SetValue(settingData.SlicerConfigName, ((TextEditWidget)sender).Text.Replace("\n", "\\n"), persistenceLayer); @@ -1763,4 +1767,4 @@ namespace MatterHackers.MatterControl.SlicerConfiguration topToBottomItemList.AddChild(itemHolder, indexInChildrenList); } } -} \ No newline at end of file +}