Is it possible to joint style font

Discussion in 'AutoCAD' started by Adesu, Oct 13, 2004.

  1. Adesu

    Adesu Guest

    Is it possible to joint style font in "Adesu" ?
    A = Arial
    d = Century
    e = Curier
    s = Garamond
    u = Italic
     
    Adesu, Oct 13, 2004
    #1
  2. Adesu -you can apply different fonts to each character in an mtext entity..

    (1 . "A{\\fCentury
    Gothic|b0|i0|c0|p34;d\\fCourier
    New|b0|i0|c0|p49;e\\fGaramond|b0|i0|c0|p18;su}")

    Looks a bit loopy though...

    Peter
     
    petersciganek, Oct 13, 2004
    #2
  3. Adesu

    Adesu Guest

    Hi peter,after you give me advice, here my code, the problem is how to put
    variable on
    (cons 1 "{\\fArial|b0|i0|c0|p34;A
    \\fCentury|b0|i0|c0|p18;d
    \\fLucida Sans|b0|i0|c0|p34;e
    \\fSimSun|b0|i0|c0|p2;s
    \\fTahoma|b0|i0|c0|p34;u}")
    I mean and I would "century,licida,simsun,tahoma" take from
    (while
    (setq style1 (getstring"\nENTER NEW STYLE:")))


    ; jsf is stand for joint style font
    ; Design by Ade Suharna <>
    ; 13 October 2004
    ; Program no 115/10/2004
    ; Edit by petersciganek <> 13/10/2004 1).
    (defun c:jsf (/ oldosmode oldcmdecho ss ent dxf info40
    info71 loc pos1 texhei recwid pos2)
    (setq oldosmode (getvar "osmode")) ; get osmode setting
    (setvar "osmode" 0) ; osmode set to 0
    (setq oldcmdecho (getvar "cmdecho")) ; get cmdecho setting
    (setvar "cmdecho" 0) ; cmdecho set to 0
    (setq ss (ssget '((0 . "MTEXT,TEXT")))
    ent (ssname ss 0)
    dxf (entget ent)
    info40 (rtos (cdr (assoc 40 dxf)) 2 0)
    info71 (cdr (assoc 71 dxf))
    loc (cdr (assoc 10 dxf)))
    (prompt "\n1=TL;2=TC;3=TR;4=ML;5=MC;6=MR;7=BL;8=BC;9=BR")
    (setq pos1
    (atoi
    (rtos
    (getreal "\nENTER NEW ATTACHMENT POINT<1 ; 2 ; 3 or > : ") 2 0))
    texhei
    (getreal
    (strcat"\nENTER TEXT HEIGHT<" info40 ">: ")))
    (setq recwid (getdist "\nENTER NEW RECTANGLE WIDTH: "))
    (prompt "\n1=LtR;3=TtB;5=BY STYLE")
    (setq pos2
    (atoi
    (rtos
    (getreal"\nENTER NEW DRAWING DIRECTION<1 ; 3 ; 5>: ") 2 0)))
    (command "_erase" ss "")
    (entmake (list '(0 . "MTEXT")
    ;1)
    '(100 . "AcDbEntity")
    '(100 . "AcDbMText")
    (cons 71 pos1)
    (cons 10 loc)
    (cons 40 texhei)
    (cons 41 recwid)
    (cons 72 pos2)
    (cons 1 "{\\fArial|b0|i0|c0|p34;A
    \\fCentury|b0|i0|c0|p18;d
    \\fLucida Sans|b0|i0|c0|p34;e
    \\fSimSun|b0|i0|c0|p2;s
    \\fTahoma|b0|i0|c0|p34;u}")
    ))
    (princ)
    (setvar "osmode" oldosmode) ; return setting
    (setvar "cmdecho" oldcmdecho) ; return setting
    )
     
    Adesu, Oct 14, 2004
    #3
  4. Adesu -

    You could either build the string as you prompt the user - e.g.:

    (setq str "{")
    (while (setq s (getstring "\nStyle: "))
    (setq str (strcat str "\\f" s "|b0|i0|c0|p18;d"))
    )

    or add the strings to a list e.g.:

    (while (setq s (getstring "\nStyle: "))
    (setq lst (append lst (list s)))
    )

    then build the text string from the list - e.g.:

    (foreach s lst
    (setq str (strcat str ...


    You should look at the tblnext, tblsearch, initget, and getkword functions as you might want to allow the user only to enter valid style names.

    Peter
     
    petersciganek, Oct 14, 2004
    #4
  5. Adesu

    Adesu Guest

    Hi peter,what meaning of "|b0|i0|c0|p18;d"
    |b0 as ???
    |i0 as ???
    |c0 as ???
    |p18as ???
    ;d as ????
    as you might want to allow the user only to enter valid style names.
     
    Adesu, Oct 15, 2004
    #5
  6. Adesu - check your developers help documentation - I have a German description of these mtext formatting codes so I can't tell you exactly where to look - use search "Mtext".
    I just copied the string value from the mtext entity after formatting it with the editor.

    Peter
     
    petersciganek, Oct 15, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.