Eric Schneider,
I found one for you made by John Uhden
(defun sa:CreateTextStyle (name font height width / TextStyles TextStyle
file)
(if
(and
(= (type name) 'STR)
(= (type font) 'STR)
(numberp height)
(> height 0)
(numberp width)
(> width 0)
(setq doc (vla-get-activedocument *acad*)) ; I added this because it
wasn't global here
(setq TextStyles (vla-get-TextStyles doc))
(not
(vl-catch-all-error-p
(setq TextStyle
(vl-catch-all-apply 'vla-Add (list TextStyles name))
)
)
)
;; BTW, if a .TTF file is in the AutoCAD search path,
;; it's full path is not required (at least in 2000i/SP2)
(cond
((setq file (findfile font))(setq file font))
((setq file (findfile (strcat (getenv "windir") "\\fonts\\" font))))
)
(not
(vl-catch-all-error-p
(vl-catch-all-apply 'vla-put-FontFile (list TextStyle file))
)
)
(not
(vl-catch-all-error-p
(vl-catch-all-apply 'vla-put-Width (list TextStyle width))
)
)
(not
(vl-catch-all-error-p
(vl-catch-all-apply 'vla-put-Height (list TextStyle height))
)
)
(not
(vl-catch-all-error-p
(vl-catch-all-apply 'vla-put-ActiveTextStyle (list doc TextStyle))
)
)
;; Actually, these probably don't have to be released
;; if they are local to the function.
(vlax-release-object TextStyle)
(vlax-release-object TextStyles)
)
name
)
)
NOTE: I had copied the Arial.ttf file to my AutoCAD Fonts folder
Command: (sa:createtextstyle "Arial" "Arial.ttf" 2.0 1.5)
"Arial"
Command: (tblsearch "Style" "Arial")
((0 . "STYLE") (2 . "Arial") (70 . 0) (40 . 2.0) (41 . 1.5) (50 . 0.0) (71 .
0)
(42 . 25.8585) (3 . "Arial.ttf") (4 . ""))
--
John Uhden, Cadlantic/formerly CADvantage
[ mailto:juhden@cadlantic.com ]
[ http://www.cadlantic.com ]
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711