/// <summary>
 /// Construct a <see cref="FontDescriptor" /> for a font with a given family name, style and point size.
 /// </summary>
 /// <param name="name">The font family name</param>
 /// <param name="style">The font style</param>
 /// <param name="size">The font size in em-units</param>
 public FontDescriptor(string name, UniFontStyles style, double size)
 {
     Font = new XFont(name, size, style.ToXFontStyle());
     if (Font != null)
     {
         Ascent  = (Font.Metrics.Ascent / (Font.Metrics.Ascent + (double)Font.Metrics.Descent)) * Font.Height;
         Descent = (Font.Metrics.Descent / (Font.Metrics.Ascent + (double)Font.Metrics.Descent)) * Font.Height;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Convert a <see cref="UniFontStyles" /> value to an <see cref="XFontStyle" /> value.
 /// </summary>
 /// <param name="style">The value to be converted.</param>
 /// <returns>The result.</returns>
 public static XFontStyle ToXFontStyle(this UniFontStyles style)
 {
     return((XFontStyle)style);
 }