找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1037|回复: 0

[求助] [求助]:entmak 建立windows字体样式的问题.

[复制链接]

已领礼包: 208个

财富等级: 日进斗金

发表于 2006-12-17 21:40:19 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
[php]
;|
(gps->chk_style styname styshx stybig)
(gps->chk_style 字体样式名 西文字体名  中文字体名 )
检查给定字体名是否存在不存在则建立
存在则检查是否与给定字体名相同不同则修改该字体样式,修改默认字高为0.
设置完字体样式默认字高为0
优点:
避免了有的字体例如"hztxt0.shx"就不支持 "是否垂直? <N>"而造成command设置style命令出错的问题.
|;
(defun gps->chk_style (styname styshx stybig / chksty ent_list stybig2 styheight styshx2)
(if (null stybig) (setq stybig "")) ;使用windows 字体时.
(setq chksty (tblsearch "style" styname))
(if (null chksty)
    (ENTMAKE (LIST
           '(0 . "STYLE")                       ;对象名称
           '(100 . "AcDbSymbolTableRecord")
           '(100 . "AcDbTextStyleTableRecord")  ;子类标记
           (cons 2  styname)    ;字体样式名
           '(70 . 0)            ;标注位码
           '(40 . 0.0)          ;文字高度
           '(41 . 0.70)         ;宽度系数
           '(50 . 0.0)          ;字斜角
           '(71 . 0)            ;文字生成标注位码2=反向,4=颠倒
           (cons 3  styshx)     ;西文字体名
           (cons 4  stybig)     ;中文字体名
         ) ;_ end LIST
    ) ;_ end ENTMAKE
   ;检查存在字体样式与给定参数是否相等.
    (progn
    (setq ent_list (entget (tblobjname "style" styname)))
    (setq styshx2 (dxf 3 ent_list) stybig2 (dxf 4 ent_list) styheight (dxf 40 ent_list))
    ;检查中西文字体是否相同、及默认字高是否为0.
    (if (or (/= styshx styshx2) (/= stybig stybig2) (/= styheight 0))
            (progn
              (setq ent_list (subst (cons 40 0.0) (assoc 40 ent_list) ent_list))
              (setq ent_list (subst (cons 3 styshx) (assoc 3 ent_list) ent_list))
              (setq ent_list (subst (cons 4 stybig) (assoc 4 ent_list) ent_list))
              (entmod ent_list)      
            )
     )   
    );end progn
);end if
(setvar "textstyle" styname) ;当前文字样式
)[/php]

e.g.
(gps->chk_style "hxz" "hztxt_e.shx" "hztxt.shx")
(gps->chk_style "complex" "complex.shx" "") ;无中文字体名.

(gps->chk_style "黑体"   "SIMHEI.TTF" "")
(gps->chk_style "仿宋"   "SIMFANG.TTF" "")
(gps->chk_style "楷体"   "SIMKAI.TTF" "")
----------------------------------------------------------------------------
(gps->chk_style "宋体"   "SimSun.ttf" "")
(gps->chk_style "新宋体" "NSimSun.ttf" "")
---------------------------------------------------------------------------
黑体、仿宋、楷体建立都可以成功!!

问题.只有宋体、新宋体不成功............

windows字体
系统只有SimSun.ttc 不是SimSun.ttf.?什么?
SimSun.ttf   宋体     ;有问题????为什么!!!!!!
NSimSun.ttf  新宋

SIMKAI.TTF   楷体_bg2312
SIMFANG.TTF  仿宋_bg2312
SIMHEI.TTF   黑体.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-22 20:36 , Processed in 0.182080 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表