/// <summary> /// Finds out which font styles are available for the given Gdi font family. /// </summary> /// <param name="fontFamily">The Gdi font family.</param> /// <returns>Value that indicate which styles are available for the fontFamily.</returns> protected static FontStylePresence GetFontStylePresence(FontFamily fontFamily) { FontStylePresence pres = FontStylePresence.NoStyleAvailable; if (fontFamily.IsStyleAvailable(FontStyle.Regular)) { pres |= FontStylePresence.RegularStyleAvailable; } if (fontFamily.IsStyleAvailable(FontStyle.Bold)) { pres |= FontStylePresence.BoldStyleAvailable; } if (fontFamily.IsStyleAvailable(FontStyle.Italic)) { pres |= FontStylePresence.ItalicStyleAvailable; } if (fontFamily.IsStyleAvailable(FontStyle.Bold | FontStyle.Italic)) { pres |= FontStylePresence.BoldAndItalicStyleAvailable; } return(pres); }
protected static FontStylePresence FontFamilyArrayToFontStylePresence(FontFamily[] fontFamilyArray) { FontStylePresence pres = FontStylePresence.NoStyleAvailable; if (null != fontFamilyArray[IdxRegular]) { pres |= FontStylePresence.RegularStyleAvailable; } if (null != fontFamilyArray[IdxBold]) { pres |= FontStylePresence.BoldStyleAvailable; } if (null != fontFamilyArray[IdxItalic]) { pres |= FontStylePresence.ItalicStyleAvailable; } if (null != fontFamilyArray[IdxBoldItalic]) { pres |= FontStylePresence.BoldAndItalicStyleAvailable; } return(pres); }