Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than gdi32, prefix the name with the module name and a period.
[MarshalAs(UnmanagedType.Struct)] public FIXED eM11;
[MarshalAs(UnmanagedType.Struct)] public FIXED eM12;
[MarshalAs(UnmanagedType.Struct)] public FIXED eM21;
[MarshalAs(UnmanagedType.Struct)] public FIXED eM22;
public int gmBlackBoxX;
public int gmBlackBoxY;
[MarshalAs(UnmanagedType.Struct)] public POINTFX gmptGlyphOrigin;
public short gmCellIncX;
public short gmCellIncY;
}
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
// Parse a glyph outline in native format
public static void GetGlyphShape(Font font, Char c)
{
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(Bitmap b = new Bitmap(1,1))
{
using(Graphics g = Graphics.FromImage(b))
{
IntPtr hdc = g.GetHdc();
IntPtr prev = SelectObject(hdc, font.ToHfont());
int bufferSize = (int)GetGlyphOutline(hdc, (uint)c, (uint)2, out metrics, 0, IntPtr.Zero, ref matrix);
IntPtr buffer = Marshal.AllocHGlobal(bufferSize);
try
{
int ret;
if((ret = GetGlyphOutline(hdc, (uint)c, 2, out metrics, (uint)bufferSize, buffer, ref matrix)) > 0)
{
int polygonHeaderSize = Marshal.SizeOf(typeof(TTPOLYGONHEADER));
int curveHeaderSize = Marshal.SizeOf(typeof(TTPOLYCURVEHEADER));
int pointFxSize = Marshal.SizeOf(typeof(POINTFX));
int index = 0;
while(index < bufferSize)
{
TTPOLYGONHEADER header = (TTPOLYGONHEADER)Marshal.PtrToStructure(new IntPtr(buffer.ToInt32()+index), typeof(TTPOLYGONHEADER));
int startX = header.pfxStart.x.value;
int startY = -header.pfxStart.y.value;
// ...do something with start coords...
int endCurvesIndex = index+header.cb;
index+=polygonHeaderSize;
POINTFX[] curvePoints = new POINTFX[curveHeader.cpfx];
for(int i = 0; i < curveHeader.cpfx; i++)
{
curvePoints[i] = (POINTFX)Marshal.PtrToStructure(new IntPtr(buffer.ToInt32()+index), typeof(POINTFX));
index+=pointFxSize;
}
if(curveHeader.wType == (int)1)
{
// POLYLINE
for(int i=0; i < curveHeader.cpfx; i++)
{
short x = curvePoints[i].x.value;
short y = (short)-curvePoints[i].y.value;
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).