ARX 中设置CAD 字体

在ObjectARX对CAD进行二次开发时,如果你想改变输出的文字的字体格式,可以用下面语句进行设置

 AcDbTextStyleTable *pTextStyleTbl;
    acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextStyleTbl, AcDb::kForWrite);
    AcDbTextStyleTableRecord *pTextStyleTblRcd=new AcDbTextStyleTableRecord;
    pTextStyleTbl->getAt(ACDB_MODEL_SPACE,pTextStyleTblRcd,AcDb::kForWrite);

    //设置格式

    pTextStyleTblRcd->setName("STYLE_HZ");
    pTextStyleTblRcd->setFileName("romans");
    pTextStyleTblRcd->setBigFontFileName("hzdx");
    pTextStyleTblRcd->setXScale(0.8);
    pTextStyleTblRcd->setFont("楷体_GB2312",0,0,134,49);
    AcDbObjectId fontId; 
    pTextStyleTbl->add(fontId,pTextStyleTblRcd);
    pTextStyleTblRcd->close();
    pTextStyleTbl->close();
    acdbHostApplicationServices()->workingDatabase()->setTextstyle(fontId);

 

注意:这是改变了字体格式表的属性,那么你在以后输出的字都将变成楷体_GB2312!


你可能感兴趣的:(ARX 中设置CAD 字体)