Author Topic: Font file issues  (Read 9883 times)

0 Members and 1 Guest are viewing this topic.

Pepe

  • Newt
  • Posts: 87
Re: Font file issues
« Reply #30 on: February 09, 2011, 05:35:32 AM »
Quote
Code: [Select]
(defun GetTTFs (/)
  ((lambda (reg)
     (mapcar (function (lambda (n) (cons n (vl-registry-read reg n))))
             (vl-registry-descendents reg "")
     )
   )
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"
  )
)

Much better and elegant  :lol: !  (Indeed!) I should write this kind of stuff sooner in the day... :ugly: Thank you, alanjt.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Font file issues
« Reply #31 on: February 09, 2011, 08:37:26 AM »
Quote
Only that I said it was untested. ATM, I don't have AutoCAD on my home machine.
I tried again. I can't figure it out.
Could you please check it when you are at work?
Thanks.
Try this, I forgot to capitalize the value before checking...

Code: [Select]
(defun doesTTFexist (ttf)
  ((lambda (reg ttf)
     (vl-some (function (lambda (x / n)
                          (if (eq (setq n (strcase (vl-registry-read reg x))) ttf)
                            n
                          )
                        )
              )
              (vl-registry-descendents reg "")
     )
   )
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"
    (strcase ttf)
  )
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Font file issues
« Reply #32 on: February 09, 2011, 04:56:48 PM »
It works graet!
Thanks, Alan.  :-D

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Font file issues
« Reply #33 on: February 09, 2011, 04:58:24 PM »
It works graet!
Thanks, Alan.  :-D
Rock 'n Roll baby
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Font file issues
« Reply #34 on: February 09, 2011, 05:17:16 PM »
BTW, what is the reason that you make it uppercase?
What if you keep the value lowercase?

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Font file issues
« Reply #35 on: February 09, 2011, 05:24:05 PM »
Just curious, does this work?

Code: [Select]
(findfile (strcat (_GetSpecialFolder "Fonts") "\\" font))
I just didn't see why the registry needs to get involved is all...

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Font file issues
« Reply #36 on: February 09, 2011, 05:46:41 PM »
Just curious, does this work?

Code: [Select]
(findfile (strcat (_GetSpecialFolder "Fonts") "\\" font))
I just didn't see why the registry needs to get involved is all...

I was thinking the same thing ... this should work as well:
Code: [Select]
(findfile (strcat (getenv "windir") "\\fonts\\arial.ttf"))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Font file issues
« Reply #37 on: February 09, 2011, 05:54:02 PM »
Just curious, does this work?

Code: [Select]
(findfile (strcat (_GetSpecialFolder "Fonts") "\\" font))
I just didn't see why the registry needs to get involved is all...

I was thinking the same thing ... this should work as well:
Code: [Select]
(findfile (strcat (getenv "windir") "\\fonts\\arial.ttf"))
Agreed. I guess I had the fun blinders on. Don't listen to me.
I was just trying to remember that sysvar.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Font file issues
« Reply #38 on: February 09, 2011, 05:55:15 PM »
BTW, nice work, Ron.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Font file issues
« Reply #39 on: February 09, 2011, 06:16:04 PM »
Sorry, Lee.

Code: [Select]
(setq fontfile (findfile (strcat (_GetSpecialFolder "Fonts") "\\" font)))

It is much the same as the following mensioned previously:
Because the they may return a fake result.

Code: [Select]
(findfile "c:\\windows\\fonts\\arial.ttf")

I have just read your latest post & check this one gives the same result as above:

Code: [Select]
(findfile (strcat (getenv "windir") "\\fonts\\arial.ttf"))

I was wondering if there is a way to check the font file name.
Because the "fildfile" lines above may return a fake result as menstioned.

I discuss this issue because the font file name could be changed in some cases.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Font file issues
« Reply #40 on: February 09, 2011, 06:16:14 PM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Font file issues
« Reply #41 on: February 09, 2011, 06:19:32 PM »
Code: [Select]
(setq fontfile (findfile (strcat (_GetSpecialFolder "Fonts") "\\" font)))

It is much the same as the following mensioned previously:
Because the they may return a fake result.

I'm just a little puzzled since the result you posted from running my previous code (the first post) indicated that the font assignment was successful. Which raises the question: What font was assigned to the new TextStyle?

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Font file issues
« Reply #42 on: February 09, 2011, 06:22:38 PM »
Code: [Select]
(setq fontfile (findfile (strcat (_GetSpecialFolder "Fonts") "\\" font)))

It is much the same as the following mensioned previously:
Because the they may return a fake result.

I'm just a little puzzled since the result you posted from running my previous code (the first post) indicated that the font assignment was successful. Which raises the question: What font was assigned to the new TextStyle?
It's a wacky mystery!   :lol:
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Font file issues
« Reply #43 on: February 09, 2011, 06:27:09 PM »
I have already renamed the "arial_6.ttf" to the original "arial.ttf" in my system.
By continuing the tests I use the "ariali_5.ttf" (my "ariali.ttf" name was changed as well).

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Font file issues
« Reply #44 on: February 09, 2011, 06:29:39 PM »
Alan, did you read my post #34?
Thanks.