AutoCAD supports the Unicode character-encoding standard. A Unicode font can contain 65,535 characters, with shapes for many languages. All of the AutoCAD SHX shape fonts that are shipped with the product support Unicode fonts.
AutoCAD 支持 Unicode 字符编码标准。Unicode 字体可以包含 65,535 个字符,拥有多种语言的文字。现在,AutoCAD 的所有 SHX 形字体都是 Unicode 字体。
The text files for some alphabets contain thousands of non-ASCII characters. To accommodate such text, AutoCAD supports a special type of shape definition known as a Big Font file. You can set a style to use both regular and Big Font files. Specify normal fonts using the FileName property. Specify Big Fonts using the BigFontFileName property.
某些字母表的文字文件包含数千个非 ASCII 字符。为了适应这些文字,AutoCAD 支持一种特殊的形定义,称作大字体文件。用户可以将样式设置为同时使用常规文件和大字体文件。使用 FileName 特性指定常规字体。使用 BigFontFileName 特性指定大字体。
AutoCAD allows you to specify an alternate font to use when a specified font file cannot be located. Use the FONTALT system variable and the SetSystemVariable member method of the Application to change the alternate font used.
当指定的字体文件不能被定位时,AutoCAD 允许指定使用指定的替换字体。使用 FONTALT 系统变量或 Application 的成员方法 SetSystemVariable 修改可用的替换字体。
The following example code changes the FileName and BigFontFileName properties. You need to replace the path information listed in this example with path and file names appropriate for your system.
本例更改 FileName 和 BigFontFileName 属性。用户需要将本例中的路径信息替换为你系统中实际的系统路径和文件名。
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
<CommandMethod("ChangeFontFiles")> _
Public Sub ChangeFontFiles()
'' 获得当前文档和数据库 Get the current document and database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
''启动一个事务 Start a transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' 以写的方式打开当前文字样式 Open the current text style for write
Dim acTextStyleTblRec As TextStyleTableRecord
acTextStyleTblRec = acTrans.GetObject(acCurDb.Textstyle, _
OpenMode.ForWrite)
'' 修改大字体和常规字体为可用的字体文件 Change the font files used for both Big and Regular fonts
acTextStyleTblRec.BigFontFileName = "C:\AutoCAD\Fonts\bigfont.shx"
acTextStyleTblRec.FileName = "C:\AutoCAD\Fonts\italic.shx"
''保存更改并销毁事务 Save the changes and dispose of the transaction
acTrans.Commit()
End Using
End Sub
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
[CommandMethod("ChangeFontFiles")]
public static void ChangeFontFiles()
{
// 获得当前文档和数据库 Get the current document and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
// 启动一个事务 Start a transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// 以写的方式打开当前文字样式 Open the current text style for write
TextStyleTableRecord acTextStyleTblRec;
acTextStyleTblRec = acTrans.GetObject(acCurDb.Textstyle,
OpenMode.ForWrite) as TextStyleTableRecord;
// Change the font files used for both Big and Regular fonts
acTextStyleTblRec.BigFontFileName = "C:/AutoCAD/Fonts/bigfont.shx";
acTextStyleTblRec.FileName = "C:/AutoCAD/Fonts/italic.shx";
// Save the changes and dispose of the transaction
acTrans.Commit();
}
}