Jump to content

ACAD cannot find arialbd.ttf


Recommended Posts

Posted

Hi,

 

I am not sure if this really is a lisp or just ACAD related problem. But it crashes my lsp so I will start searching here.

 

I am using (command.....) to create a text style like this:

(command "_.style" "Logstrup Bold" "arialbd.ttf" 0 1 0 "_N" "_N")

 

Acad returns this:

---------------

Schriftdatei existiert nicht.0

1

0

Unbekannter Befehl "N". Drücken Sie F1-Taste für Hilfe.

Unbekannter Befehl "N". Drücken Sie F1-Taste für Hilfe.

---------------

Pardon the German, but user is in Austria. It just says that font file does not exist and then "unknown commands" for the remaining parameters.

 

If I do the same with just arial.ttf then no problem.

 

The Arial bold font is installed on the PC and the file c:\Windows\Fonts\arialbd.ttf does exist.

 

Does anybody have any idea why ACAD does not find it?

(the lisp code is running on several machines, and the problem is only on 1)

 

Best regards

Carsten

Posted

May try to hard-code the path:

(if (findfile "C:\\Windows\\Fonts\\arialbd.ttf")
(command "_.style" "Logstrup Bold" "C:\\Windows\\Fonts\\arialbd.ttf" 0 1 0  "_N" "_N")
(prompt "\nUnable to find ArialBD.ttf font on this workstation!")
)

Posted

Thanks Mircea,

 

The (findfile...) by itself I have already used as part of my trouble-shooting, and it finds the file (because it is there).

I have not tried to code the complete path into the (command "_.style .....) it is worth a try.

Unfortunately I cannot test until after weekend (Austrians leave early on Fridays)

 

BR

Carsten

Posted

That should work well if the path is identical on all workstation.

Posted

A possible workaround:

(foreach thePath '("C:\\Windows\\Fonts\\"
                  "C:\\WinNT\\Fonts\\")
(setq thePath (strcat thePath arialbd.ttf))

(if (findfile thePath)
 (command "_.style" "Logstrup Bold" thePath 0 1 0  "_N" "_N") 
)
)

(if (not (tblsearch "STYLE" "Logstrup Bold"))
(prompt "\nUnable to create \"Logstrup Bold\" text style on this workstation!")
)

Posted

@MSasu,

Here is an alternative method to retrieve the Fonts path:

 

[color=GREEN];; Special Folder  -  Lee Mac[/color]
[color=GREEN];; Queries the WshSpecialFolders collection for the specified folder[/color]
[color=GREEN];; Ref: http://msdn.microsoft.com/en-us/library/9x9e7edx%28v=vs.85%29.aspx[/color]

([color=BLUE]defun[/color] LM:SpecialFolder ( folder [color=BLUE]/[/color] res spf wsh )
   ([color=BLUE]setq[/color] res
       ([color=BLUE]vl-catch-all-apply[/color]
           ([color=BLUE]function[/color]
               ([color=BLUE]lambda[/color] ( )
                   ([color=BLUE]setq[/color] wsh ([color=BLUE]vlax-get-or-create-object[/color] [color=MAROON]"wscript.shell"[/color])
                         spf ([color=BLUE]vlax-get-property[/color] wsh 'specialfolders)
                   )
                   ([color=BLUE]vlax-invoke-method[/color] spf 'item folder)
               )
           )
       )
   )
   ([color=BLUE]if[/color] spf  ([color=BLUE]vlax-release-object[/color]  spf))
   ([color=BLUE]if[/color] wsh  ([color=BLUE]vlax-release-object[/color]  wsh))
   ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]vl-catch-all-error-p[/color] res))
       res
   )
)

Example:

_$ (LM:SpecialFolder "Fonts")
"C:\\Windows\\Fonts"

Posted

Lee, for sure that is the most effective solution.

  • 2 weeks later...
Posted

Thanks for your replies Mircea & Lee,

and apologize for the late response from my side.

I have implemented both parts of the solution in my code:

- Location of fonts folder by Lee

- giving the complete path to the "Command Style...." by Mircea

 

I am almost sure this solves the problem.

BR

Carsten

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...