Fix toolbar font size on mono

This commit is contained in:
Ben Olden-Cooligan 2018-08-13 23:11:31 -04:00
parent 38a26f8059
commit 46854419ec
4 changed files with 12 additions and 1 deletions

View File

@ -8,5 +8,7 @@ namespace NAPS2.Compat
public class DefaultRuntimeCompat : IRuntimeCompat
{
public bool UseToolStripRenderHack => true;
public bool SetToolbarFont => false;
}
}

View File

@ -8,5 +8,7 @@ namespace NAPS2.Compat
public interface IRuntimeCompat
{
bool UseToolStripRenderHack { get; }
bool SetToolbarFont { get; }
}
}

View File

@ -8,5 +8,7 @@ namespace NAPS2.Compat
public class MonoRuntimeCompat : IRuntimeCompat
{
public bool UseToolStripRenderHack => false;
public bool SetToolbarFont => true;
}
}

View File

@ -14,6 +14,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using NAPS2.Compat;
using NAPS2.Config;
using NAPS2.ImportExport;
using NAPS2.Lang;
@ -175,11 +176,15 @@ namespace NAPS2.WinForms
private void RelayoutToolbar()
{
// Wrap text as necessary
// Resize and wrap text as necessary
using (var g = CreateGraphics())
{
foreach (var btn in tStrip.Items.OfType<ToolStripItem>())
{
if (PlatformCompat.Runtime.SetToolbarFont)
{
btn.Font = new Font("Segoe UI", 9);
}
btn.Text = stringWrapper.Wrap(btn.Text ?? "", 80, g, btn.Font);
}
}