0

我已经在Windows7操作系统上成功安装了Cygwin和FontForge,看起来效果很好。我发现FontForge是一个强大的工具~~但是我有一个很幼稚的问题......我可以在我自己的C#中调用FontForge的一些功能吗项目?第一次用开源项目,不知道怎么把开源代码和自己的代码结合起来~

4

1 回答 1

1

我目前正在构建一个使用 fontforge 的项目,我从 C# 调用它作为启动 bash.exe 并将 fontforge 作为命令行参数运行的进程。

这是一个例子:

Process p = new Process();
string cygwinDir = @"c:\cygwin\bin";
p.StartInfo.FileName = Path.Combine(cygwinDir, "bash.exe");
p.StartInfo.Arguments = "--login -c \"fontforge.exe -script '" + this.cygwinWorkPath + "script.pe";
p.StartInfo.WorkingDirectory = this.windowsWorkPath;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
p.WaitForExit();

var standardError = p.StandardError.ReadToEnd();
var standardOutput = p.StandardOutput.ReadToEnd();
var exitCode = p.ExitCode;

cygwinWorkpath 类似于 /myworkfolder,windowsWorkPath 类似于 c:\cygwin\myworkfolder。

于 2012-11-13T12:59:33.397 回答