Jump to content

Need To Change The Font Of MText


AQucsaiJr

Recommended Posts

I need to change the font of MText in a few drawings. I want to belive there is a better way to do it than do double click on them individually and change it. I also can not highlight them all and use the properties menu to change them because 'font' is not an option. Exploding the MText is also not an option.

 

Anyone know of a lisp or another way to do this?

Link to comment
Share on other sites

Font is not a option, but style is a option, just filter all the mtext you want and change their styles to a similar style with diferent font.

 

Either way, i don't know how to change only the font of a text or mtext, is there a way? (with lisp)

Link to comment
Share on other sites

Here is what I am using right now....

(command "-style" "NEWSTYLE" "ROMANS.SHX" "3/32" "1" "0" "N" "N" "N")
;; edit above for your target font, height, width factor, oblique angle..

(defun C:CHGMTEXT ( / ss )
(setq ss (ssget "X" (list (cons 0 "MTEXT"))))
(if ss
(progn
(setq C 0)
(repeat (sslength ss)
(setq entx (ssname ss C))
(setq ent (entget entx))
(setq ent (subst (cons 7 "NEWSTYLE")(assoc 7 ent) ent))
(entmod ent)
(setq C (+ C 1))
); repeat
); progn
); if
(princ)
); function

 

It does exactly what you are telling me to do, but after it has run the style of all the MText is changed but the font remains the same.

 

Do you have an idea why the font would not change?

Link to comment
Share on other sites

O.o

 

Is the style OK? with a different font?

 

To my knowlege the style is ok... The lisp does not get stuck or have any errors.

 

I tried other fonts but get the same resaults... The style changes in all the MText but the font remains the same as it started.

Link to comment
Share on other sites

I don't know why it's not working for you. The lisp you post works fine here on my pc.

 

Indeed, there is a way to create style wiht entmake (just for your knowledge)

 

(entmake
 (list
   '(0 . "STYLE")
   '(100 . "AcDbSymbolTableRecord")
   '(100 . "AcDbTextStyleTableRecord")
   (cons 2 "NEWSTYLE")
   (cons 3 "ROMANS.SHX")
   '(70 . 0)
   '(40 . 0.0938)
   '(41 . 1.0)
   '(50 . 0.0)
   '(71 . 0)
   '(42 . 0)
   '(4 . "")
   )
 )

 

i'm curious now... there is a way to change only the font with lisp?

Link to comment
Share on other sites

'Font' that is independent of style is encoded within the MText string, not the style.

 

Dang.... That must be what is going on. i received these drawings from a client that does not have many drafting standards. They must be changing them in each of the MText insertions.

 

Is there any way to fix the font if this is the case?

Link to comment
Share on other sites

there is a way to change only the font with lisp?

 

I would be very interested if it is possible. Would save me a big headache.

Link to comment
Share on other sites

Here is an example of what I mean, a crude example at best.

 

(defun c:FontChange (/ i ss ent eLst)

 (if (setq i -1 ss (ssget "_:L" '((0 . "MTEXT"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (entmod
       (subst
         (cons 1
           (strcat "{\\fCopperplate Gothic Bold|b0|i0|c0|p34;"
                   (cdr (assoc 1 (setq eLst (entget ent)))) "}"))
         (assoc 1 eLst)
         eLst))))

 (princ))
 

 

To 'Unformat', see here:

http://www.theswamp.org/index.php?topic=31584.0

Link to comment
Share on other sites

To 'Unformat', see here:

http://www.theswamp.org/index.php?topic=31584.0

 

 

Wow... This is nice! This will work fine. I guess they did change it manually within the MText... Thanks Lee

Link to comment
Share on other sites

To 'Unformat', see here:

http://www.theswamp.org/index.php?topic=31584.0

 

 

I have this problem through multiple drawings... Is there a way to use this program in a script or batch somehow?

 

If it requires to much work it is really not necessary as this program will already save me loads of time.

Link to comment
Share on other sites

Yes, there is a lot more than just font that can be changed with MText - its hell for programmers.
its hell for draughties too. The embedded font information is one of my pet hates with MTEXT.
Link to comment
Share on other sites

I have this problem through multiple drawings... Is there a way to use this program in a script or batch somehow?

 

If it requires to much work it is really not necessary as this program will already save me loads of time.

 

Would you like it to make you a pot of tea while we're at it...

 

its hell for draughties too. The embedded font information is one of my pet hates with MTEXT.

 

I would agree with you there - it seems not to follow the usual properties/methods structure of AutoCAD - why would you find the properties inside the content of the MText...? :?

Link to comment
Share on other sites

On R2006 you can quick select all the mtext entries and just change the style on them without issue in the properties window and it updates to the Font for that style.

 

UNLESS.. the font within the MTEXT has been overridden, either manually, or by pasting information in there that had font formatting on it (ie - not notepad basic text, but wordpad or "rich-text" emails or something).

 

Mtext allows you to change font in midstream, so you'd have to set-it-up to select the text and spaces in the mtext entry itself.. It's like a rich text entry.

 

I dunno' how it would store the changes in a single "font" attribute.. It must use multiple somehow, unless it stores something like "THIS font for the first 3 letters, THIS font for the next 4, etc"

 

I did an MTEXT that used the textstyle font by default, and then selected random portions of it, and changed the fonts in places.. Changing the STYLE changed all the text that was using the default style, but left the customized parts alone.

 

I'd be concerned making mass changes to MTEXT though.. not without verifying it.. I'd have to know how it would treat fractions and stuff.. it might ignore them, or stack/unstack according to unknown rules.

Link to comment
Share on other sites

I dunno' how it would store the changes in a single "font" attribute.. It must use multiple somehow, unless it stores something like "THIS font for the first 3 letters, THIS font for the next 4, etc"

 

Yes, the MText uses formatting codes nested within the textstring itself - see my reply in post #10 for an example of what I am talking about :)

Link to comment
Share on other sites

ahh.. I didn't understand the coding you provided, and couldn't use the link without a log-in for those forums.

 

I registered, but it's still pending their authorization. Thanks though, I'll check later, assuming they let me in.. though I'm guessing from your comment here that it's essentially what I said. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...