AutoCAD 支持 Unicode 字符编码标准。Unicode 字体可以包含 65,535 个字符,具有多种语言的形状。产品附带的所有 AutoCAD SHX 形状字体都支持 Unicode 字体。 某些字母表的文本文件包含数千个非 ASCII 字符。为了容纳此类文本,AutoCAD 支持一种称为“大字体”文件的特殊类型的形状定义。您可以将样式设置为同时使用常规字体文件和大字体文件。使用属性指定普通字体。使用属性指定大字体。FileNameBigFontFileName 注意:字体文件名不能包含逗号。
AutoCAD 允许您指定在找不到指定字体文件时使用的备用字体。使用 FONTALT 系统变量和 Application 的 member 方法来更改使用的备用字体。SetSystemVariable 更改字体文件下面的示例代码更改 and 属性。您需要将此示例中列出的路径信息替换为适合您的系统的路径和文件名。FileNameBigFontFileName VB.NETImports 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 C#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(); } } VBA/ActiveX 代码参考Sub ChangeFontFiles() ThisDrawing.ActiveTextStyle.BigFontFile = _ "C:/AutoCAD/Fonts/bigfont.shx" ThisDrawing.ActiveTextStyle.fontFile = _ "C:/AutoCAD/Fonts/italic.shx" End Sub 相关概念父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:09
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.