【问题标题】:Can I call some function of FontForge in my own C# project?我可以在我自己的 C# 项目中调用 FontForge 的某些功能吗?
【发布时间】:2012-11-13 20:59:33
【问题描述】:

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

【问题讨论】:

  • 如果它有任何可用的 COM 或 .net 库。是的你可以。否则你不能

标签: c# windows-7 fonts cygwin fontforge


【解决方案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。

【讨论】:

    猜你喜欢
    • 2021-08-20
    • 1970-01-01
    • 2018-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多