在lisp中我没有找到如何获取系统已经安装的字体.那么我在C#中实现了它,代码如下.
//<<<<<using
using System.Drawing.Text;
using System.Drawing;
using System.Collections;
//<<<<ernd using
//获得系统安装的TTF字体
[LispFunction("GetSysFont")]
public static ResultBuffer GetSysFont(ResultBuffer resBufIn)
{
ResultBuffer rf = new ResultBuffer();
InstalledFontCollection MyFont = new InstalledFontCollection();
FontFamily[] MyFontFamilies = MyFont.Families;
//ArrayList list = new ArrayList();
int Count = MyFontFamilies.Length;
for (int i = 0; i < Count; i++)
{
string FontName = MyFontFamilies.Name;
//list.Add(FontName);
AddValueToResultBuffer(ref rf, FontName);
}
return rf;
}
关于AddValueToResultBuffer 方法 在我的明经日记中有记录.
http://bbs.mjtd.com/blog-7304311-16373642.html
|