g3RC4n
October 7th, 2008, 01:35 PM
i'm trying to use uniscribe but i've found litte help from anywhere
so far i've managed to get the first glyph of the only run (i think) to be drawn, what am i doing wrong?
void f(HDC hdc)
{
std::wstring wstr = L"hello world";
const int mem_size = 128;
int item_count = 0;
SCRIPT_ITEM* items = new SCRIPT_ITEM[128];
HRESULT r = ScriptItemize(wstr.c_str(),wstr.size(),128-1,0,0,items,&item_count);
if(!SUCCEEDED(r))
return;
int* vis_log = new int[128];
int* log_vis = new int[128];
BYTE* dirs = new BYTE[128];
for(int i=0;i<100;++i)
dirs[i] = 0;
r = ScriptLayout(item_count,dirs,vis_log,log_vis);
if(!SUCCEEDED(r))
return;
WORD* aaa = new WORD[128];
WORD* bbb = new WORD[128];
SCRIPT_VISATTR* ccc = new SCRIPT_VISATTR[128];
int num = 0;
SCRIPT_CACHE scache = 0;
r = ScriptShape(hdc,&scache,wstr.c_str(),item_count,128-1,&items[0].a,aaa,bbb,ccc,&num);
if(!SUCCEEDED(r))
return;
GOFFSET* go = new GOFFSET[128];
ABC* abc = new ABC[128];
int* adv = new int[128];
r = ScriptPlace(hdc,&scache,aaa,num,ccc,&items[0].a,adv,go,abc);
if(!SUCCEEDED(r))
return;
::ScriptTextOut(hdc,
&scache,
0,
0,
0,
0,
&items[0].a,
0,
0,
aaa,
num,
&adv[0],
0,
go);
delete[]items;
delete[]vis_log;
delete[]log_vis;
delete[]dirs;
delete[]aaa;
delete[]bbb;
delete[]ccc;
delete[]go;
delete[]abc;
delete[]adv;
}
so far i've managed to get the first glyph of the only run (i think) to be drawn, what am i doing wrong?
void f(HDC hdc)
{
std::wstring wstr = L"hello world";
const int mem_size = 128;
int item_count = 0;
SCRIPT_ITEM* items = new SCRIPT_ITEM[128];
HRESULT r = ScriptItemize(wstr.c_str(),wstr.size(),128-1,0,0,items,&item_count);
if(!SUCCEEDED(r))
return;
int* vis_log = new int[128];
int* log_vis = new int[128];
BYTE* dirs = new BYTE[128];
for(int i=0;i<100;++i)
dirs[i] = 0;
r = ScriptLayout(item_count,dirs,vis_log,log_vis);
if(!SUCCEEDED(r))
return;
WORD* aaa = new WORD[128];
WORD* bbb = new WORD[128];
SCRIPT_VISATTR* ccc = new SCRIPT_VISATTR[128];
int num = 0;
SCRIPT_CACHE scache = 0;
r = ScriptShape(hdc,&scache,wstr.c_str(),item_count,128-1,&items[0].a,aaa,bbb,ccc,&num);
if(!SUCCEEDED(r))
return;
GOFFSET* go = new GOFFSET[128];
ABC* abc = new ABC[128];
int* adv = new int[128];
r = ScriptPlace(hdc,&scache,aaa,num,ccc,&items[0].a,adv,go,abc);
if(!SUCCEEDED(r))
return;
::ScriptTextOut(hdc,
&scache,
0,
0,
0,
0,
&items[0].a,
0,
0,
aaa,
num,
&adv[0],
0,
go);
delete[]items;
delete[]vis_log;
delete[]log_vis;
delete[]dirs;
delete[]aaa;
delete[]bbb;
delete[]ccc;
delete[]go;
delete[]abc;
delete[]adv;
}