Thanks for reply. I have written sample code but function 'AcGiTextEngine::tessellate' doesn't call 'PolylineCallback'. Should I initialize something before using it?
// fPCallBack - polyline callback, receives vertices
void fPCallBack(int x, int const *y, AcGePoint3d const *z, void *l)
{
printf("fPCallBack()\n");
}
// fUnicodeCallback - unicode function call back, does nothing in current implementation
void fUnicodeCallback(long x, unsigned short const *y, int z, void *l)
{
printf("fUnicodeCallback()\n");
}
int main(void)
{
acdbSetHostApplicationServices(&gCreatentHostApp);
long lcid = 0x00000409; // English
acdbValidateSetup(lcid);
AcDbDatabase *db = new AcDbDatabase(false, true);
db->readDwgFile(L"test.dwg");
AcTransaction *trans = db->transactionManager()->startTransaction();
AcDbBlockTable *blockTable;
db->getBlockTable(blockTable, AcDb::kForRead);
AcGiTextEngine *pTextEngine = AcGiTextEngine::create();
if (blockTable != NULL)
{
AcDbBlockTableIterator *blockTableIt;
blockTable->newIterator(blockTableIt);
while (!blockTableIt->done())
{
AcDbBlockTableRecord *block;
blockTableIt->getRecord(block, AcDb::kForRead);
AcDbBlockTableRecordIterator *blockIt;
Acad::ErrorStatus e = block->newIterator(blockIt);
while (!blockIt->done())
{
AcDbEntity *entity;
blockIt->getEntity(entity, AcDb::kForRead);
if (entity->isKindOf(AcDbText::desc()))
{
AcDbText *pText = static_cast<AcDbText *>(entity);
wprintf(L"Text: %s\n", pText->textString());
AcDbTextStyleTableRecord *pTextStyle;
acdbOpenObject(pTextStyle, pText->textStyle(), AcDb::kForRead, false);
bool bIsTTF = false;
const ACHAR* pFileName;
pTextStyle->fileName(pFileName);
if(NULL != wcsstr(pFileName, L".TTF") || NULL != wcsstr(pFileName, L".ttf"))
bIsTTF = true;
pTextStyle->close();
AcGiTextStyle mStyle;
fromAcDbTextStyle(mStyle, pText->textStyle());
if (bIsTTF)
pTextEngine->tessellate(mStyle,pText->textString(),-1,true,NULL,(UnicodeCallback)fUnicodeCallback,(PolylineCallback)fPCallBack);
else
pTextEngine->tessellate(mStyle,pText->textString(),-1,true,0.0,NULL,(PolylineCallback)fPCallBack);
}
blockIt->step();
}
blockTableIt->step();
}
}
db->transactionManager()->endTransaction();
delete db;
return 0;
}