This commit is contained in:
Ivan Bondarev 2023-10-03 21:43:30 +02:00
parent ba0d8dbe06
commit 67b3d3a312

View file

@ -80,11 +80,36 @@ namespace ICSharpCode.TextEditor.Document
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);
}
}