/// <summary> Measure the text using the default font of indicated graphics context. </summary> /// <param name="display"> The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param> /// <param name="gc"> The crapchics context to use for measuring. <see cref="IntPtr"/> </param> /// <param name="text"> The text to measure. <see cref="X11.TChar[]"/> </param> /// <returns> The measured size of the indicated text. <see cref="TSize"/> </returns> public virtual TSize MeasureTextLine(IntPtr display, IntPtr gc, X11.TChar[] text) { TSize result = new TSize(5, 5); if (display == IntPtr.Zero) { Console.WriteLine(CLASS_NAME + "::MeasureTextLine () ERROR: Argument null: display"); return(result); } if (gc == IntPtr.Zero) { Console.WriteLine(CLASS_NAME + "::MeasureTextLine () ERROR: Argument null: gc"); return(result); } TInt gcID = X11lib.XGContextFromGC(gc); if (gcID != 0) { TInt direction = 0; TInt fontAscent = 0; TInt fontDescent = 0; X11lib.XCharStruct xCharStruct = new X11lib.XCharStruct(); X11lib.XQueryTextExtents(display, gcID, text, (X11.TInt)text.Length, ref direction, ref fontAscent, ref fontDescent, ref xCharStruct); result.Width = (int)xCharStruct.width; result.Height = (int)fontAscent + (int)fontDescent; } else { Console.WriteLine(CLASS_NAME + "::MeasureTextLine () ERROR: Cannot investigate default font ressource ID of underlaying graphics context."); } return(result); }