firstinti 发表于 2013-12-11 19:35 
因为在text没生成之前是不会知道字段的真实长度的,如果根据文字内容能算出来文字长度就根本就没有这个问 ...
没有生成之前,如果知道字体,好象可以知道真实长度
这是别人写的
 - ;;str -- string
- ;;h -- height
- (defun XD::String:Len (sty str h scl)
- (and (or (not sty)
- (= sty "")
- (not (tblsearch "style" sty))
- )
- (setq sty (getvar "textstyle"))
- )
- (abs
- (car
- (apply 'mapcar
- (cons '-
- (textbox (list (cons 1 str) (cons 7 sty) (cons 40 h) (cons 41 scl))
- )
- )
- )
- )
- )
|