[DllImport("gdi32.dll")]
static extern bool CreateScalableFontResource(uint fdwHidden, string
lpszFontRes, string lpszFontFile, string lpszCurrentPath);
None.
None.
Please add some!
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();
}
Do you know one? Please contribute it!