Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ibond84 committed Oct 3, 2023
1 parent ba0d8db commit 67b3d3a
Showing 1 changed file with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,36 @@ public Font DefaultFont {
set {
// 1440 twips is one inch
int pixelSize = (int)(value.SizeInPoints * 20 / TwipsPerPixelY);
defaultFont = value;

/*defaultFont = value;
regularfont = new Font(value.FontFamily, pixelSize * TwipsPerPixelY / 20f, FontStyle.Regular);
boldfont = new Font(regularfont, FontStyle.Bold);
italicfont = new Font(regularfont, FontStyle.Italic);
bolditalicfont = new Font(regularfont, FontStyle.Bold | FontStyle.Italic);*/
defaultFont = value;

FontFamily validFontFamily = value.FontFamily;

foreach (FontFamily ff in FontFamily.Families)
{
if (ff.Name == value.FontFamily.Name)
{
validFontFamily = ff;
//находим первый подходящий fontFaFontFamily
break;
}
}

if (regularfont != null) regularfont.Dispose();
regularfont = new Font(validFontFamily, pixelSize * TwipsPerPixelY / 20f, FontStyle.Regular);

if (boldfont != null) boldfont.Dispose();
boldfont = new Font(regularfont, FontStyle.Bold);

if (italicfont != null) italicfont.Dispose();
italicfont = new Font(regularfont, FontStyle.Italic);

if (bolditalicfont != null) bolditalicfont.Dispose();
bolditalicfont = new Font(regularfont, FontStyle.Bold | FontStyle.Italic);
}
}
Expand Down

0 comments on commit 67b3d3a

Please sign in to comment.