2010-05-05 58 views
0

使用ScriptGetProperties我如何在Delphi用Delphi

使用ScriptGetProperties API的Uniscribe从DLL(的usp10.dll),我发现在C++的例子,但我不知道怎么翻译呢,因为我不是对C有好处。

const SCRIPT_PROPERTIES **g_ppScriptProperties; 
int g_iMaxScript; 

WCHAR *pwcInChars = L"Unicode string to itemize"; 
int cInChars = wcslen(pwcInChars); 
const int cMaxItems = 20; 
SCRIPT_ITEM si[cMaxItems + 1]; 
SCRIPT_ITEM *pItems = si; 
int cItems; 

ScriptGetProperties(&g_ppScriptProperties, 
        &g_iMaxScript); 

HRESULT hResult = ScriptItemize(pwcInChars, 
           cInChars, 
           cMaxItems, 
           NULL, 
           NULL, 
           pItems, 
           &cItems); 
if (hResult == 0) { 
    for (int i=0; i<cItems; i++) { 
     if (g_ppScriptProperties[pItems[i].a.eScript]->fComplex) { 

      // Item [i] is complex script text 
      // requiring glyph shaping. 

     } else { 

      // The text may be rendered legibly without using Uniscribe. 
      // However, Uniscribe may still be used as a means of accessing 
      // font typographic features. 
     } 
    } 
} else { 
    // Handle the error. 
} 

Delphi代码应该符合Turbo Delphi 2006或更高版本。

+0

你可以帮忙翻译你已经知道的东西。询问关于你不知道的事情。 – 2010-05-05 11:48:54

+0

哪个部位有问题?请注意,你实际上没有*提出问题*。 – 2010-05-05 13:40:45

+0

Lars&Rob,我编辑了这个问题,我需要如何在Delphi中使用ScriptGetProperties API,很抱歉,如果我一开始并不清楚。 – 2010-05-05 14:31:24

回答

1

在开始使用库之前,您需要将其头文件翻译为.pas文件。请参阅Dr. Bob's header converter作为起点。被转换的头只应该有结构,函数,枚举,简单类型等等。如果有类声明,全局变量,宏等,你很可能需要有一个中间的.h,你可以转换成Delphi。

祝你好运。