PDA

View Full Version : SubstitutedFontReport



msjca
2004-09-08, 02:53 PM
Hello.

Want to create a routine (prefer AutoLISP) to get/report when fonts are substituted/missing. Ideally, per Style. (e.g., , style x is using substituted font y for missing font z). But I cannot determine where this info is stored. I can get it manually if I list [text] styles but I need report. I thinking it in a dictionary or in style table but I can't find the info. Assume I don't know if any fonts are not found, I want AutoLISP to determine if ANY [text] styles don't find a font and/or is using a substituted font, please (style name not necessarily same as missing font name)

How is it stored, how can I get to it, please? (using AutoCAD 2000 and 2005)

(I not a dictionary expert, I can create and use but I not good with AutoDesk dictionaries)

kennet.sjoberg
2004-09-08, 03:04 PM
Hi msjca ! ?

Here is a hint :

(if (tblsearch "STYLE" "goober")
(princ "I find goober")
(princ "goober is not found load arial")
)

Happy Computing !

kennet

msjca
2004-09-08, 03:58 PM
Thanks for hint, but

I need something that tells me IF a style does not find the font it wants .... WAIT, I see. I can search/get each style, get the name of the font it wants (since that IS stored in the style table) and then do a file search. If that file/font not found then it can report. Hmmm, That won't tell me what the substituted font is but, I don't really need that, eh. That will address the problem, I think yes. THank you.


(If anyone know if AutoCAD stores the info somewhere/how though I would still be interested.)
--------------------------------------------------------------------------------------------------------------------------
Modified question:
style x is using substituted font y for missing font z). But I cannot determine where this info is stored. I can get it manually if I list [text] styles but I need report. I thinking it in a dictionary or in style table but I can't find the info. Assume I don't know if any fonts are not found, I want AutoLISP to determine if ANY [text] styles don't find a font and/or is using a substituted font, please (style name not necessarily same as missing font name)

How is it stored, how can I get to it, please? (using AutoCAD 2000 and 2005)

kennet.sjoberg
2004-09-08, 08:48 PM
Next hint ; )

(getvar "FONTALT" )
(getvar "FONTMAP" )

Happy Computing !

kennet

msjca
2004-09-08, 09:25 PM
Thank you.

But I like your first hint better. I don't use font map or font alt (I set to nothing "" so that I do get popup error message if first drawing opened in a session does not find its font)

kennet.sjoberg
2004-09-10, 09:28 AM
Command: LIST
Select objects: 1 found

Select objects:
TEXT Layer: "K381"
Space: Model space
Color: 3 (green) Linetype: "BYLAYER"
Handle = 10B1B0
Style = "FakeFont3"
Font file = fakefont.shx <--------------------- Do You mean this row ??
substituted by iso.shx
start point, X=-35469.43 Y= 60410.14 Z= 0.00
height 157.50
text uppsidedown
rotation angle 0.00000
width scale factor 1.00
obliquing angle 0.00000
generation upside-down

kennet.sjoberg
2004-09-13, 07:11 AM
Last hint ?

A text is using a fontfile, example = FakeFont.shx, that builds the vectors of the characters. To use a style is to manipulate the visibility like, width, slantic upside-down...
but they all use a fontfile.

Before
Style = "FakeFont1", Font file = fakeFont.shx, obliquing angle 15.00000
Style = "FakeFont2", Font file = fakefont.shx, generation backwards
Style = "FakeFont3", Font file = fakefont.shx, generation upside-down

When that fontfile fakeFont.shx is missing there will be a fontfile Substitution

After
Style = "FakeFont1", Font file = fakeFont.shx, substituted by iso.shx, obliquing angle 15.00000
Style = "FakeFont2", Font file = fakefont.shx, substituted by iso.shx, generation backwards
Style = "FakeFont3", Font file = fakefont.shx, substituted by iso.shx, generation upside-down

But the stylename and manipulation will remain, because it is inside the textobjects dxf code.
(51 . 0.261799) (7 . FakeFont1) (71 . 0)
(51 . 0.0) (7 . FakeFont2) (71 . 2)
(51 . 0.0) (7 . FakeFont3) (71 . 4)

And in the styletable

(defun c:ChkFontStyles ( / FontList )
(setq FontList (list (cdr (assoc 2 (tblnext "STYLE" T )))) )
(while (car (reverse FontList ))
(setq FontList (append FontList (list (cdr (assoc 2 (tblnext "STYLE" nil ))))) )
)
(setq FontList (vl-remove nil FontList ) )
(foreach FontStyle FontList
(princ (strcat "Style " FontStyle " belong to fontfile " (cdr (assoc 3 (tblsearch "STYLE" fontstyle )) ) "n" ))
)
(textscr)
(princ "nHappy Computing !nnkennet" )
(princ)
)

Command: ChkFontStyles REPORT LIKE :
Style Standard belong to fontfile txt
Style Iso belong to fontfile iso.shx
Style FakeFont3 belong to fontfile FakeFont.shx

Happy Computing !

kennet