QUESTION: Hi Jory,
I have a question about lisp
Is it possible to get an list of all available font name's like Arial or isocp
If i have a complete list i can set an random font to an text style.
I want to set an random font is my dwg's every time it is opened
This is just for fun.
ANSWER: Hey Don, the task sounds counterproductive ;) regardless, i don't think there's a font table you can just search thru and grab w/in autocad. But however, there's another way you can get a list of all fonts available thru your windows registry. This code to get you started:
_$ (defun myFontList (/ dev reg)
(setq dev "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"
reg (vl-registry-descendents dev "*")
(mapcar '(lambda(x) (list x (vl-registry-read dev x))) reg)
Hope this helps,
---------- FOLLOW-UP ----------
QUESTION: Hi JB,
Thanks for your answer.
First i wanna tell you that this is just for fun bud also for testing purposes.
This is a great start bud it does not get the complete list of all the font's
If i also read out the font map off autocad do you think i can get the complete list??
I'm working on a lisp routine that will normalize a dwg to an standard
I completed the lisp
Basically it select all object's and changes the color and line type to bylayer and in layer 0 for block objects
Then it reads all the content of text objects and remove's font overwriting ( programs like comos do that ) also in blocks
All the text objects are put into one style with one font.
If there are double layers also made by comos it will merge everything to one layer.
and finaly just for fun i made an random color generator ( normal color and true color ) and set every layer in an random color.
Now i try to add an random text font generator.
I hope you wanna help me in this even if its counterproductive :-)
Thanks for your help so far :-)
Hello again Don, now you're getting me really confused buddy. But you're right, the lisp I provided doesn't give you all the font files for autocad. It's obvious that it's going to miss all the native autocad fonts (SHX). In my mind, I thought your intent was to query all the list of true type fonts (TTF) hence you explicitly said 'arial or isocp'. The lisp I provided should be able to spit out all the true type fonts installed in your windows machine as expected. You should then be able to manipulate this list & plug random styles each time you open drawing as you initially requested. And that's why I said this is counterproductive since some people like myself could potentially be mischievous to their colleagues and use this kind of coding to them. Fun stuff!
Now your follow up question has several other topics that requires some time to code & unfortunately I just don't have enough freetime nowadays to do more development stuffs like i used to. However, some of the stuff that you're trying to code can already be done with the following commands:
SetNestedObjectsByBlock and SetBylayer (as i mentioned on previous post)
I'm still intrigued w/this random text font generator of yours. It is feasible & I'll try to research more when time permits. I'll keep you posted.
Take care buddy
Font maps are just list of font and substitutes. If font is not located, another font is substituted based on acad.fmp file. This file doesn't provide you complete list.