need lisp code to convert shape fonts to true type fonts.

i need a small script to convert shape fonts (shx) in dwg file to true type fonts. this script should be able to replace all the text fonts including block attributes with true type fonts in one go.

thank a lot in advance.

Comments

  • Hi Kotesh,

    You can convert from a .SHX font to truetype by updating the STYLE that the text on your drawing is using. You don't necessarily need to create a program to automate. Depending on how consistent the drawings you are working on a simple script may suffice.
    [code]; File     : CCL-Text
    ; -----------------------------------------------------------------------------
    ._UNDO _BEGIN
    ._STYLE
    CCL-TITLE1
    ROMAND
    0.0
    0.8
    0
    _NO
    _NO
    _NO
    ._STYLE
    CCL-TITLE2
    ROMANS
    0.0
    0.8
    0
    _NO
    _NO
    _NO
    ._STYLE
    CCL-TITLE3
    ROMANS
    0.0
    1.0
    0
    _NO
    _NO
    _NO
    ._STYLE
    CCL-ROMANS
    ROMANS
    0.0
    0.9
    0
    _NO
    _NO
    _NO
    ._UNDO _END[/code]

    To see what responses you need to provide your script you need to run the command line version of style. You can do this by adding a "-" minus sign. e.g. ._-STYLE

    Regards,

    Jason Bourhill

    CAD Concepts


  • Try the code below.

    If you have been "creative" with mtext entities and have some with font sequences you may also need StripMtext.
    StripMtext can be found here:
    http://cadabyss.wordpress.com/

    [code](defun ResetTextStyles (fontFile / cnt)
      (setq cnt 0)
      (vlax-for style (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))
        (if (/= (vla-get-name style) "") ; Skip hidden textstyles used by comlex linetypes.
          (progn
            (setq cnt (1+ cnt))
            (vla-put-fontfile style fontFile)
          )
        )
      )
      (princ (strcat "\n" (itoa cnt) " textstyles have been updated "))
    )

    (defun c:ResetTextStyles_Comic ()
      (ResetTextStyles "comic.ttf")
      (princ)
    )[/code]
  • thanks. i will try the code and let you all know.
  • @kotesh,

    Instead of modifying the drawings you could use a font mapping file. Bricscad uses default.fmp by default. The font mapping file allows you to re-map fonts to other fonts, such as shx -> ttf. this mapping takes precedence over the drawing settings. Couldn't find any info on fmp files Bricscad help, but did find some  info and explanation here: http://autode.sk/Ng6Ets

    File format is pretty simple, attach an example. Because the substituted font is ttf then PDF text search will work, which is what I think you were looking to do with this.

    Regards,

    Jason Bourhill

    CAD Concepts


    default.fmp

This discussion has been closed.