本帖最后由 wkq004 于 2020-9-25 16:26 编辑
 - (setq textStyleName "中等线体") ;_字体样式名
- (setq fontFileName "方正中等线简体.ttf") ;_字体文件名
- (entmake (append
- '((0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord"))
- (list (cons 2 textStyleName))
- '((70 . 0) (40 . 1) (41 . 1))
- (list (cons 3 (strcat (getenv "Windir") "\\fonts\\" fontFileName) )) ;(3 . "宋体.ttf")
- )
- )
- ;;命令: (tblsearch "style" "中等线体") ; ;返回不了除"宋体"外的汉字字体名
- ;;((0 . "STYLE") (2 . "中等线体") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 2.5) (3 . "") (4 . ""))
- ;;(vla-get-FontFile (vla-get-ActiveTextStyle (vla-get-ActiveDocument (vlax-get-acad-object)))) ;返回不了除"宋体"外的汉字字体名
- ;;(setvar "TEXTSTYLE" textStyleName) ;_当前字体样式
- ;;(setq styleObj (vla-get-ActiveTextStyle (vla-get-ActiveDocument (vlax-get-acad-object))))
- (setq styleObj (vlax-ename->vla-object (tblobjname "style" textStyleName)))
- (vla-Getfont styleObj 'typeface 'bold 'italic 'charset 'pitchandfamily)
- (print typeface) ;_返回中文字体名
|