Check existence of font files?

Discussion in 'AutoCAD' started by Fatfreek, Sep 27, 2004.

  1. Fatfreek

    Fatfreek Guest

    The following snippet works fine but only if TextStyleName exists . I
    would like to test for its existence before setting the style. For example,
    swiss.ttf, exists on my Windows\Fonts directory. The shx fonts appear in my
    C:\Program Files\AutoCAD 2005\Fonts\ folder. Should I be using (dos_find
    "c:\\windows\\swiss.ttf") or some such?

    Len Miller

    (if (or
    (= StyleExt_GL "ttf")
    (= StyleExt_GL "")
    )
    (command "_.-style" "banner_text" TextStyleName
    "0.0" TextWd_GL TextSlant_GL
    "_N" "_N"
    )
    (command "_.-style" "banner_text" TextStyleName "0.0"
    TextWd_GL TextSlant_GL "_N" "_N"
    "N"
    )
    )
     
    Fatfreek, Sep 27, 2004
    #1
  2. Fatfreek

    T.Willey Guest

    If you just want to make sure the file exist, then you can use (findfile swiss.ttf). I think it has to be in a support path of acad, but you might be able to supply the whole path for it to find.

    Hope that helped
    Tim
     
    T.Willey, Sep 27, 2004
    #2
  3. Fatfreek

    Fatfreek Guest

    You're right. "Searches (only) the AutoCAD library path for the specified
    file" is the Findfile rule. I may have to resort to dos_find.

    Len

    swiss.ttf). I think it has to be in a support path of acad, but you might
    be able to supply the whole path for it to find.
     
    Fatfreek, Sep 27, 2004
    #3
  4. I got this off the news group a long time ago and saved for future use
    (which never happened).
    I don't know who the author is (sorry).
    This returns a list of Windows fonts.
    (defun GET_FONTS ()
    (if (= (substr (getvar "platform") 1 17) "Microsoft Windows")
    (setq key1 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows
    NT\\CurrentVersion\\Fonts"
    key2
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts"
    )
    )
    (setq cnt -1 tst (vl-registry-descendents key1 T))
    (repeat (length tst)
    (princ (strcat "\n" (nth (setq cnt (1+ cnt)) tst)))
    )
    (princ)
    )
     
    Alan Henderson @ A'cad Solutions, Sep 27, 2004
    #4
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.