Author Topic: How to find out where Acad reads font files from?  (Read 12530 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
How to find out where Acad reads font files from?
« on: July 20, 2007, 02:49:23 PM »
I want to be able to populate a list box in a dcl with all the font's that show up when a user is in the styles command.  I'm trying to improve one of my routines that I just did to merge text styles.  I want to be able to create text styles from the dialog, but I don't see where one can find out where Acad reads it's font files from.

One thought was looking at all paths within the preferences, and searching for anything that has the extension of a font file, but I don't see how it knows where to find the true type (window) fonts.

Thanks in advance.
Tim

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

Please think about donating if this post helped you.

Guest

  • Guest
Re: How to find out where Acad reads font files from?
« Reply #1 on: July 20, 2007, 02:56:09 PM »
C:\Windows\Fonts is the only location a TTF can be installed as far as I know.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find out where Acad reads font files from?
« Reply #2 on: July 20, 2007, 02:59:31 PM »
C:\Windows\Fonts is the only location a TTF can be installed as far as I know.
Thanks Matt.  Didn't know that.
Tim

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

Please think about donating if this post helped you.

Guest

  • Guest
Re: How to find out where Acad reads font files from?
« Reply #3 on: July 20, 2007, 03:01:19 PM »
You're welcome!

CaddmannQ

  • Guest
Re: How to find out where Acad reads font files from?
« Reply #4 on: July 20, 2007, 08:39:17 PM »
This is because C:/windows/fonts is not a folder. It's a program that just looks like a folder. It serves the fonts up to the O/S when they're called for without the fonts having to reside in memory. (I believe. Windows gurus please correct me if I'm wrong here)

To see this just copy a true type font from Fonts to any other location, and the name will change. What you now see is the true file name. What you see in the Fonts folder is what the font tells the program to display as the name.

Outside of the Fonts folder it cannot do so.

For instance the font Impress BT will display the actual name TT0209M_.TTF once you copy it out of the Fonts folder.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to find out where Acad reads font files from?
« Reply #5 on: July 20, 2007, 08:53:20 PM »
Tim, Does the Fonts Folder in the Acad folder help ?

Personally, I cheat ...
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CaddmannQ

  • Guest
Re: How to find out where Acad reads font files from?
« Reply #6 on: July 20, 2007, 09:23:37 PM »
AFAICT it's got to be in the Windows fonts folder. Putting it in the Autocad fonts folder won't do it.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find out where Acad reads font files from?
« Reply #7 on: July 20, 2007, 09:59:02 PM »
If I pretend to know what you're looking for perhaps this --

Code: [Select]
(defun _GetSpecialFolder ( name / wshShell specialFolders result )
   
    (vl-catch-all-apply
       '(lambda (  )
            (setq
                wshShell       (vlax-create-object "WScript.Shell")
                specialFolders (vlax-get wshShell 'SpecialFolders)
                result         (vlax-invoke specialFolders 'Item name)
            )             
        )
    )

    (if specialFolders (vlax-release-object specialFolders))
    (if wshShell (vlax-release-object wshShell))
   
    result

)

(_GetSpecialFolder "fonts")

=> "C:\\Windows\\Fonts"

Is that what you're looking for Tim?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find out where Acad reads font files from?
« Reply #8 on: July 21, 2007, 12:09:25 AM »
In case anyone is curious about other 'special folders' that are available --

Code: [Select]
(defun _GetSpecialFolders ( / wshShell specialFolders result )
   
    (vl-catch-all-apply
       '(lambda ( )
            (setq
                wshShell       (vlax-create-object "WScript.Shell")
                specialFolders (vlax-get wshShell 'SpecialFolders)
            )
            (setq result
                (mapcar
                   '(lambda ( name )
                        (list
                            name
                            (vlax-invoke specialFolders 'Item name)
                        )                       
                    )
                   '(
                        "AllUsersDesktop"
                        "AllUsersStartMenu"
                        "AllUsersPrograms"
                        "AllUsersStartup"
                        "Desktop"
                        "Favorites"
                        "Fonts"
                        "MyDocuments"
                        "NetHood"
                        "PrintHood"
                        "Programs"
                        "Recent"
                        "SendTo"
                        "StartMenu"
                        "Startup"
                        "Templates"
                    )               
                )
            )             
        )
    )

    (if specialFolders (vlax-release-object specialFolders))
    (if wshShell (vlax-release-object wshShell))
   
    result

)

(GetSpecialFolders) <Vista Ultra> ...

("AllUsersDesktop"   "C:\\Users\\Public\\Desktop")
("AllUsersStartMenu" "C:\\ProgramData\\Microsoft\\Windows\\Start Menu")
("AllUsersPrograms"  "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs")
("AllUsersStartup"   "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup")
("Desktop"           "C:\\Users\\UserName\\Desktop")
("Favorites"         "C:\\Users\\UserName\\Favorites")
("Fonts"             "C:\\Windows\\Fonts")
("MyDocuments"       "C:\\Users\\UserName\\Documents")
("NetHood"           "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts")
("PrintHood"         "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Printer Shortcuts")
("Programs"          "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs")
("Recent"            "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Recent")
("SendTo"            "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\SendTo")
("StartMenu"         "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu")
("Startup"           "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup")
("Templates"         "C:\\Users\\UserName\\AppData\\Roaming\\Microsoft\\Windows\\Templates")


If you want additional info ... looky. There are typos on the linked page, can you find them?

/Later dudes.

:)
« Last Edit: July 21, 2007, 12:27:05 AM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find out where Acad reads font files from?
« Reply #9 on: July 21, 2007, 03:03:10 AM »
Thanks guys.  I will look into this more on monday when I'm not busy, and have Acad with me.  This is how I did it in my code for now.
Code: [Select]
(foreach path (cons "C:\\Windows\\Fonts" (StrParse (getenv "ACAD") ";"))
 (foreach font (append (vl-directory-files path "*.shx" 1) (vl-directory-files path "**.ttf" 1))
  (if (not (assoc font FontList))
   (setq FontList (cons (cons font path) FontList))
  )
 )
)

I think I like the way Michael did it with the special folder, and looking for the font within them.  I like that way as it is not hard coded anywhere.

Tim, Does the Fonts Folder in the Acad folder help ?
It didn't look like any true type fonts were within those folders.  I could have be wrong.  Maybe on others computers there are in there, but mine didn't seem to have any.
Tim

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

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find out where Acad reads font files from?
« Reply #10 on: July 23, 2007, 11:41:35 AM »
Thanks again Michael.  This seems to be the best way to do what I want.
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find out where Acad reads font files from?
« Reply #11 on: July 23, 2007, 11:47:35 AM »
My pleasure Tim, thanks.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to find out where Acad reads font files from?
« Reply #12 on: July 23, 2007, 03:01:57 PM »
 There should be a way to retrieve the font name along with the file name like you see when using the file browser & viewing the Font Folder.  Because you cant tell fron the file name the actual Font Name.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How to find out where Acad reads font files from?
« Reply #13 on: July 23, 2007, 03:20:13 PM »
This is because C:/windows/fonts is not a folder. It's a program that just looks like a folder. It serves the fonts up to the O/S when they're called for without the fonts having to reside in memory. (I believe. Windows gurus please correct me if I'm wrong here)

To see this just copy a true type font from Fonts to any other location, and the name will change. What you now see is the true file name. What you see in the Fonts folder is what the font tells the program to display as the name.

Outside of the Fonts folder it cannot do so.

For instance the font Impress BT will display the actual name TT0209M_.TTF once you copy it out of the Fonts folder.

The windows font folder is simply another folder, just like all other folders. The only difference is the context handler is different for that specific folder.

By looking into the directory from the command window you will see the fonts are listed just like any other file. The long names you see are the names defined in the font file as retrieved by the context handler.

Every "special" folder has a context handler and you can remove that context handler if you wish, but it is not advisable as system instability can occur.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CaddmannQ

  • Guest
Re: How to find out where Acad reads font files from?
« Reply #14 on: July 23, 2007, 04:34:13 PM »

The windows font folder is simply another folder, just like all other folders. The only difference is the context handler is different for that specific folder.

By looking into the directory from the command window you will see the fonts are listed just like any other file. The long names you see are the names defined in the font file as retrieved by the context handler.

Every "special" folder has a context handler and you can remove that context handler if you wish, but it is not advisable as system instability can occur.

OK, that seems a little clearer. So I take it that these "context handlers" are programs called by a folder based on some properties given it? In any event, when you click a typical folder, you are activating the default behavior of Explorer, because it has the "default" context handler assigned to it? When you dump a new TTF into the Fonts folder, it's this context handler that "installs" it as an available font?