// Get the line spacing for the font selected into this graphics object. public override int GetLineSpacing() { Xsharp.Font xfont = (font as DrawingFont).xfont; FontExtents extents = xfont.GetFontExtents(graphics); return(extents.Ascent + extents.Descent); }
// Draw a string using the current font and brush. public override void DrawString (String s, int x, int y, StringFormat format) { Xsharp.Font xfont = (font as DrawingFont).xfont; FontExtents extents = xfont.GetFontExtents(graphics); xfont.DrawString(graphics, RestrictXY(x), RestrictXY(y) + extents.Ascent, s, 0, s.Length); }
/// <summary> /// <para>Get extent information for a particular font, when drawing /// onto this graphics context.</para> /// </summary> /// /// <param name="font"> /// <para>The font to obtain extents for.</para> /// </param> /// /// <returns> /// <para>Returns the extent information.</para> /// </returns> /// /// <exception cref="T:System.ArgumentNullException"> /// <para>Raised if <paramref name="font"/> is <see langword="null"/>. /// </para> /// </exception> public FontExtents GetFontExtents(Font font) { if(font == null) { throw new ArgumentNullException("font"); } return font.GetFontExtents(this); }