TA的每日心情![](source/plugin/dsu_paulsign/img/emot/kx.gif) | 开心 昨天 15:23 |
---|
签到天数: 69 天 [LV.6]常住居民II
管理员
- 积分
- 2704
|
//getCurrentTextStyle是子函数,用于获取当前活动的文字样式及宽度因子
double CBasic::getLength( CString str, double height )
{
ACHAR *txtStyle = NULL;
double width = NULL;
CBasic::getCurrentTextStyle( txtStyle, width );
struct resbuf *txtlist;
//下面的acutBuiltList内容,最好与下面的扩展内容结合来看,注意的是前面的数字,如1,40,41,7
txtlist = acutBuildList( RTDXF0, _T("TEXT"),
1, str,
40, height,
41, width,
7, txtStyle,
NULL);
ads_point bottomLeft, upRight;
acedTextBox( txtlist, bottomLeft, upRight );
acutRelRb( txtlist );
return fabs( bottomLeft[X] - upRight[X]);
}
acdbHostApplicationServices()->workingDatabase()->textstyle() 得到当前TEXTSTYLE变量定义的字体ID。
objectARX获取当前图层所有文字样式
复制代码
void GetAllTextStyle(std::vector<CString> &textStyle)
{
textStyle.clear();
AcDbTextStyleTable *pTextStyleTbl = NULL;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextStyleTbl, AcDb::kForRead);
AcDbTextStyleTableIterator *pIt = NULL;
pTextStyleTbl->newIterator(pIt);
for (;!pIt->done();pIt->step())
{
AcDbTextStyleTableRecord *pRcd = NULL;
if (pIt->getRecord(pRcd, AcDb::kForRead) == Acad::eOk)
{
TCHAR *szName = NULL;
pRcd->getName(szName);
if (_tcslen(szName)>0)
{
textStyle.push_back(szName);
}
acutDelString(szName);
pRcd->close();
}
}
delete pIt;
pTextStyleTbl->close();
} |
|