;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;幕匠LISP实验室;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;程序功能：问题字体替代   [备注：]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:font ( / lb_eng lb_chn lb_sech lb_tt1 lb_tt2 lb_a1 lb_a2 lb_hh)
  (setvar "REGENMODE" 0)
  (setq lb_eng (getstring "英文替代<romans>:") lb_chn (getstring "中文替代<Hztxt>:"))
  (if (= "" lb_eng)(setq lb_eng "romans"))
  (if (= "" lb_chn)(setq lb_chn "hztxt"))
  (setq lb_sech (tblnext "style" t))
  (while lb_sech
    (setq lb_tt1 (cdr(assoc 3 lb_sech)) lb_tt2 (cdr(assoc 4 lb_sech)))
    (if (or (<= (strlen lb_tt1) 4)
            (/= "." (strcase(substr lb_tt1 (- (strlen lb_tt1) 3) 1)))        
        )
        (setq lb_tt1 (strcat lb_tt1 ".shx"))
    )
    (if (or (<= (strlen lb_tt2) 4)
            (/= "." (strcase(substr lb_tt2 (- (strlen lb_tt2) 3) 1)))
        )
        (if (/= "" lb_tt2)(setq lb_tt2 (strcat lb_tt2 ".shx")))
    )
    (if (/= ".TTF" (strcase(substr lb_tt1 (- (strlen lb_tt1) 3) 4)))
      (progn
        (if (null (findfile lb_tt1))(setq lb_a1 lb_eng)(setq lb_a1 lb_tt1))
        (if (= "" lb_tt2)
          (setq lb_a2 "")
          (if (null (findfile lb_tt2))(setq lb_a2 lb_chn)(setq lb_a2 lb_tt2))
        )
        (setq lb_hh (strcat lb_a1 "," lb_a2))
        (command "-style" (cdr(assoc 2 lb_sech)) lb_hh "" "" "" "" "" "")
      )
      (if (null (findfile lb_tt1))(command "-style" (cdr(assoc 2 lb_sech)) (strcat lb_eng "," lb_chn) "" "" "" "" "" ""))
    )
    (setq lb_sech (tblnext "style"))
  )
(setvar "REGENMODE" 1)
(command "regen")
) 