CreateScalableFontResource (gdi32)
Last changed: -80.94.224.85

.
Summary

C# Signature:

[DllImport("gdi32.dll")]
static extern bool CreateScalableFontResource(uint fdwHidden, string
   lpszFontRes, string lpszFontFile, string lpszCurrentPath);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

The part of code to get font name from ttf files. C#.net

                    string FileNameTTF = "Cinderel.ttf";
                    string TempName = Application.StartupPath +  "\\TEMP.FOT";
                    string FontName = "";
                    if (CreateScalableFontResourceA(1,
                        TempName, FileNameTTF,
                        String.Empty) > 0)
                    {

                        string Buffer = "";
                        using (StreamReader sr = new StreamReader(TempName))
                        {
                            String line;
                            while ((line = sr.ReadLine()) != null)
                            {
                                Buffer = Buffer + line;
                            }
                        }

                        int iPos = Buffer.IndexOf("FONTRES:") + 8;
                        int iEndPos = Buffer.IndexOf(Char.MinValue, iPos);
                        FontName = Buffer.Substring(iPos, iEndPos - iPos);
                        FontName = FontName.Trim();

}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation