you can find this method in Windows API
for calling this method :
- 1 : add
System.Runtime.InteropServices
namespace to your project 2 : add the
API
class to your project and let it useGetKerningPairs
method please remember that this function uses a struct calledKERNINGPAIR
we need to make sure it's defined in our class otherwise we'll get compile error !class API { [DllImport("gdi32.dll")] static extern uint GetKerningPairs(IntPtr hdc, uint nNumPairs, [Out] KERNINGPAIR[] lpkrnpair); [StructLayout(LayoutKind.Sequential)] struct KERNINGPAIR { public ushort wFirst; // might be better off defined as char public ushort wSecond; // might be better off defined as char public int iKernAmount; public KERNINGPAIR(ushort wFirst, ushort wSecond, int iKernAmount) { this.wFirst = wFirst; this.wSecond = wSecond; this.iKernAmount = iKernAmount; } public override string ToString() { return (String.Format("{{First={0}, Second={1}, Amount={2}}}", wFirst, wSecond, iKernAmount)); } } }
now you can call this method through API
class