Author Topic: Is there a way to modify the Font Style  (Read 4727 times)

0 Members and 1 Guest are viewing this topic.

bmossman

  • Guest
Is there a way to modify the Font Style
« on: January 11, 2008, 10:36:20 AM »
using lisp...ie, control whether it's roman, bold, italic?
Code: [Select]
(defun c:SIMPLEX (/)
(command "-style"
"SIMPLEX" ; name of text style
"SIMPLEX" ; font name
"0" ; height of text
"1" ; width factor
"0" ; obliquing angle
"n" ; text backwards
"n" ; text upside-down
""
)
(princ)
)

Guest

  • Guest
Re: Is there a way to modify the Font Style
« Reply #1 on: January 11, 2008, 10:40:30 AM »
For starters, you can't apply the bold property to SIMPLEX.

BUT...  If you use Arial and want to make it bold, you have to enter ARIALBD.TTF to make the text style Arial Bold.  Confused?

Code: [Select]
(command "-style" "TAGS1" "arialbd.ttf" "20.0" "1" "0" "n" "n")

bmossman

  • Guest
Re: Is there a way to modify the Font Style
« Reply #2 on: January 11, 2008, 10:58:58 AM »
What about swiss.ttf? How would you control the font style using lisp?

Guest

  • Guest
Re: Is there a way to modify the Font Style
« Reply #3 on: January 11, 2008, 11:03:44 AM »
What I just did was create a text style that uses the Swiss 721 Black BT.ttf font style, then from the command line, found out what the name is...


Quote
Command: -style
Enter name of text style or [?] <TAGS1>:

Existing style. Full font name = Swiss 721 Black BT
Specify full font name or font filename (TTF or SHX) <swissk.ttf>:
Specify height of text or [Annotative] <1'-8">:
Specify width factor <1.0000>:
Specify obliquing angle <0.00>:
Display text backwards? [Yes/No] <No>:
Display text upside-down? [Yes/No] <No>:
"TAGS1" is now the current text style.

Command:

bmossman

  • Guest
Re: Is there a way to modify the Font Style
« Reply #4 on: January 11, 2008, 11:10:14 AM »
I just figured it out after I explored the fonts directory & saw the different font types. Thanks for your help!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Is there a way to modify the Font Style
« Reply #5 on: January 11, 2008, 11:12:31 AM »
Here is what I use:

Code: [Select]
(defun c:af (/ doc txtstyle)
  (setq doc (vla-get-activedocument (vlax-get-acad-object))
txtstyle (vla-add (vla-get-textstyles doc) "Arial")
  )
  (vlax-put-property txtstyle 'fontfile "arial.ttf")
  (vlax-put-property txtstyle 'width 1.0)
  (vlax-put-property txtstyle 'height 0.0)
  (vla-put-activetextstyle doc txtstyle)
  (princ "\nARIAL is now the current text style")
  (princ)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Guest

  • Guest
Re: Is there a way to modify the Font Style
« Reply #6 on: January 11, 2008, 11:13:49 AM »
I just figured it out after I explored the fonts directory...

Lucky.... I can't see my "C" drive.  They've locked us out, so I've learned to do things the hard way.


And, you're welcome.

daron

  • Guest
Re: Is there a way to modify the Font Style
« Reply #7 on: January 11, 2008, 11:18:27 AM »
Man, I hate when ITwit's do that. I worked at a company that made it so we couldn't alter one word in a folder structure to switch to another folder, like:
c:\this\that\images
to
c:\this\these\images
Had to go about it the long way. Annoying.

bmossman

  • Guest
Re: Is there a way to modify the Font Style
« Reply #8 on: January 11, 2008, 11:19:49 AM »
Quote
Lucky.... I can't see my "C" drive.  They've locked us out, so I've learned to do things the hard way.
Damn communists! :-D

Guest

  • Guest
Re: Is there a way to modify the Font Style
« Reply #9 on: January 11, 2008, 11:20:11 AM »
Man, I hate when ITwit's do that. I worked at a company that made it so we couldn't alter one word in a folder structure to switch to another folder, like:
c:\this\that\images
to
c:\this\these\images
Had to go about it the long way. Annoying.

Yup.... we've got that too.

Harrie

  • Guest
Re: Is there a way to modify the Font Style
« Reply #10 on: January 14, 2008, 05:59:16 AM »
Here is what I use:

Code: [Select]
(defun c:af (/ doc txtstyle)
  (setq doc (vla-get-activedocument (vlax-get-acad-object))
txtstyle (vla-add (vla-get-textstyles doc) "Arial")
  )
  (vlax-put-property txtstyle 'fontfile "arial.ttf")
  (vlax-put-property txtstyle 'width 1.0)
  (vlax-put-property txtstyle 'height 0.0)
  (vla-put-activetextstyle doc txtstyle)
  (princ "\nARIAL is now the current text style")
  (princ)
)

Dear Ron,

When I use your program. I get:
Error: Automation Error. Filer error

Regards

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Is there a way to modify the Font Style
« Reply #11 on: January 14, 2008, 09:46:26 AM »
Not sure about that one.....maybe add (vl-load-com) to the top line?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

GDF

  • Water Moccasin
  • Posts: 2081
Re: Is there a way to modify the Font Style
« Reply #12 on: January 14, 2008, 11:31:56 AM »
Not sure about that one.....maybe add (vl-load-com) to the top line?

Ron

That was it. I also get the error.


Command: af
; error: Automation Error. Filer error
Command:

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Is there a way to modify the Font Style
« Reply #13 on: January 14, 2008, 11:38:59 AM »
Wonder if it can't find the file.  Try (findfile "arial.ttf") and see what it returns.

/guess
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Is there a way to modify the Font Style
« Reply #14 on: January 14, 2008, 11:40:40 AM »
Not sure about that one.....maybe add (vl-load-com) to the top line?

Ron

That was it. I also get the error.


Command: af
; error: Automation Error. Filer error
Command:

Gary

Good to hear...thanks Gary.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC