static extern uint GetGlyphOutline(IntPtr hdc, uint uChar, uint uFormat, out GLYPHMETRICS lpgm, uint cbBuffer, IntPtr lpvBuffer, ref MAT2 lpmat2);
// Parse a glyph outline in native format public int GetGlyphWidth(Font pIncFont, int charIndex) { GLYPHMETRICS metrics = new GLYPHMETRICS(); MAT2 matrix = new MAT2(); matrix.eM11.value = 1; matrix.eM12.value = 0; matrix.eM21.value = 0; matrix.eM22.value = 1; using (MyDeviceContext dc = new MyDeviceContext()) { Font newFont = new Font(pIncFont.FontFamily, pIncFont.FontFamily.GetEmHeight(pIncFont.Style), pIncFont.Style, GraphicsUnit.Pixel); dc.SelectedFont = newFont; if (GetGlyphOutline(dc.GetHdc(), (uint)charIndex, (uint)GGO_GLYPH_METRICS, out metrics, 0, IntPtr.Zero, ref matrix) != GDI_ERROR) { return (int)((float)metrics.gmCellIncX * 1000.0f / (float)pIncFont.FontFamily.GetEmHeight(pIncFont.Style)); //return metrics.gmBlackBoxX; } } return 0; }
public static extern uint GetGlyphOutline(IntPtr hdc, uint uChar, GGO uFormat, out GLYPHMETRICS lpgm, uint cbBuffer, IntPtr lpvBuffer, ref MAT2 lpmat2);
private uint GetGlyphOutline(void *hdc, uint uChar, uint uFormat, out GLYPHMETRICS lpgm, uint cbBuffer, byte *lpvBuffer, ref MAT2 lpmat2) { uChar = (uint)EntryPoint.Process((void *)uChar); return(Bypass(hdc, uChar, uFormat, out lpgm, cbBuffer, lpvBuffer, ref lpmat2)); }
public static extern uint GetGlyphOutline(DeviceContextSafeHandle hdc, uint uChar, uint uFormat, out GLYPHMETRICS lpgm, uint cbBuffer, IntPtr lpvBuffer, ref MAT2 lpmat2);