Enum FontSynthesis
Styling a face lacks, which a matched Font asks the renderer to synthesize (drawn from 2.7.2 on).
[Flags]
public enum FontSynthesis
Fields
Bold = 1The face is lighter than asked: embolden it.
Italic = 2The face is upright but italic or oblique was asked: slant it.
None = 0Nothing to synthesize.
Examples
// Installed fonts, found without native calls and indexed on first use; a style is matched by the CSS rules.
FontMatch? match = FontCollection.System.Match(GenericFamily.SansSerif, FontStyle.Bold);
// Your own fonts work the same way; System is read-only, so add the installed fonts to your collection to have both.
var fonts = new FontCollection();
fonts.AddFile(FontFile);
fonts.AddSystemFonts();
FontMatch noto = fonts.Match("Noto Sans", FontStyle.BoldItalic)!.Value;
Font font = noto.ToFont(16);