Fix a crash on windows 7 due to it not supporting the font

This commit is contained in:
Morilli 2020-07-23 23:23:07 +02:00
parent 25a5ca7d90
commit 84f88367ee
2 changed files with 10 additions and 32 deletions

View file

@ -1,12 +1,7 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows;
using System.Windows.Media;
using Color = System.Drawing.Color;
using FontFamily = System.Drawing.FontFamily;
using FontStyle = System.Drawing.FontStyle;
using Pen = System.Drawing.Pen;
using System.Drawing.Text;
namespace UWUVCI_AIO_WPF.Classes
{
@ -42,7 +37,6 @@ namespace UWUVCI_AIO_WPF.Classes
public int Released;
public int Players;
public bool Longname;
private bool bf = false;
public BootImage()
{
@ -95,25 +89,21 @@ namespace UWUVCI_AIO_WPF.Classes
g.SmoothingMode = SmoothingMode.AntiAlias;
g.CompositingMode = CompositingMode.SourceOver;
g.CompositingQuality = CompositingQuality.HighQuality;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
g.Clear(Color.White);
System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
privateFonts.AddFontFile(@"bin\Tools\font.otf");
if (bf)
{
font = new Font("Trebuchet MS", 10.0F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point);
}
else
try
{
PrivateFontCollection privateFonts = new PrivateFontCollection();
privateFonts.AddFontFile(@"bin\Tools\font.otf");
font = new Font(privateFonts.Families[0], 10.0F, FontStyle.Regular, GraphicsUnit.Point);
}
catch (Exception)
{
font = new Font("Trebuchet MS", 10.0F, FontStyle.Bold, GraphicsUnit.Point);
}
SolidBrush brush = new SolidBrush(Color.FromArgb(32, 32, 32));
Pen outline = new Pen(System.Drawing.Color.FromArgb(222, 222, 222), 4.0F);
Pen outline = new Pen(Color.FromArgb(222, 222, 222), 4.0F);
Pen shadow = new Pen(Color.FromArgb(190, 190, 190), 6.0F);
StringFormat format = new StringFormat();
Rectangle rectangleGBA = new Rectangle(132, 260, 399, 266);
@ -228,16 +218,5 @@ namespace UWUVCI_AIO_WPF.Classes
return img;
}
public void changefont(bool t)
{
if (t)
{
bf = true;
}
else
{
bf = false;
}
}
}
}

View file

@ -57,7 +57,6 @@
<RadioButton Content="Alternative - Wii" GroupName="snes" Click="RadioButton_Click" Foreground="Black" Margin="0,6,0,-6" Name="altwii" Visibility="Hidden"/>
<ComboBox Margin="0,2" Width="169" Name="combo" SelectionChanged="combo_SelectionChanged" Foreground="Black" Visibility="Hidden" ></ComboBox>
</StackPanel>
<CheckBox Content="Use ALT font" HorizontalAlignment="Left" Height="18" Margin="407,333,0,0" VerticalAlignment="Top" Foreground="Black" Click="CheckBox_Click" Name="alt" Visibility="Hidden"/>
<Label Content=" TV IMAGE" x:Name="imageName_Copy" Margin="9,24,419,329"/>
</Grid>
</Window>