2012-01-24 9 views
0

Cygwin과 FontForge를 Windows7 운영 체제에 성공적으로 설치했는데 잘 작동하는 것 같습니다. FontForge가 강력한 도구라는 것을 알았습니다 ~ ~ 그러나 아주 순진한 질문이 있습니다 ... FontForge의 일부 기능을 자신의 C# 프로젝트? 오픈 소스 프로젝트를 사용하는 것은 처음이며 오픈 소스 코드를 내 코드와 결합하는 방법을 모르겠습니다. ~내 자신의 C# 프로젝트에서 FontForge의 일부 기능을 호출 할 수 있습니까?

+0

사용 가능한 COM 또는 .net 라이브러리가있는 경우. 그래 넌 할수있어. 또는 그렇지 않은 경우 –

답변

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.