- 积分
- 6501
- 明经币
- 个
- 注册时间
- 2013-1-30
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 张和平 于 2014-11-30 20:17 编辑
函数如下:- void CTextStyleUtil::ChangeFont(const TCHAR* fontFileName, const TCHAR* bigFontFileName)
- {
- AcDbTextStyleTable *pTextStyleTbl = NULL;
- acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextStyleTbl, AcDb::kForWrite);
- AcDbTextStyleTableIterator *pIt = NULL;
- pTextStyleTbl->newIterator(pIt);
-
- for (pIt->start(); !pIt->done(); pIt->step())
- {
- AcDbTextStyleTableRecord *pRcd = NULL;
- if (pIt->getRecord(pRcd, AcDb::kForWrite) == Acad::eOk)
- {
- TCHAR *szName = NULL;
- pRcd->getName(szName);
- if (_tcslen(szName) > 0)
- {
- acutPrintf(TEXT("\n*** ÕyÔú′|àíÎÄ×ÖÑùê½ "));
- acutPrintf(szName);
- TCHAR *fileName = NULL;
- if (pRcd->fileName(fileName) == Acad::eOk)
- {
- //pRcd->setFileName(fontFileName);
- acutPrintf(TEXT("\n ó¢ÎÄ×Öìåóé "));
- acutPrintf(fileName);
- acutPrintf(TEXT(" ¸Ä3éáË "));
- acutPrintf(fontFileName);
- }
- acutDelString(fileName);
- TCHAR *bigFileName = NULL;
- if (pRcd->bigFontFileName(bigFileName) == Acad::eOk)
- {
- //pRcd->setBigFontFileName(bigFontFileName);
- acutPrintf(TEXT("\n ′ó×Öìå óé "));
- acutPrintf(bigFileName);
- acutPrintf(TEXT(" ¸Ä3éáË "));
- acutPrintf(bigFontFileName);
- }
- acutDelString(bigFileName);
- }
- acutDelString(szName);
- pRcd->close();
- }
- }
- delete pIt;
- pTextStyleTbl->close();
- }
复制代码 调用如下:- CTextStyleUtil::ChangeFont(TEXT("txt.shx"), TEXT("hztxt.shx"));
复制代码 出错如下:
请问何解?
后续1:从输出反馈来看,应该是当未成功取到bigFileName时出的错,于是加个判断_tcslen(bigFileName) > 0,然后就能正常了。然后,就又发现一个问题了:当文字样式用,设置有中文字体时,如下图所示,获取到的fileName是空,这是为何?计算式中文,也总得有个名字吧?如何正确获取?
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|