Actual font location and name

Just starting out? Need help? Post your questions and find answers here.
normeus
Enthusiast
Enthusiast
Posts: 322
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Actual font location and name

Post by normeus »

I can get a font file name by reading the registry, for example "Bahnschrift":

Code: Select all

;https://www.purebasic.fr/english/memberlist.php?mode=viewprofile&u=17681
Procedure.s RegReadString(HKMain, HKSub$, HKEntry$)
  hKey = 0
  If RegOpenKeyEx_(HKMain, HKSub$, 0, #KEY_QUERY_VALUE, @hKey) = #ERROR_SUCCESS
    result$ = Space(260)
    bufLen = Len(result$)
    If hKey
      If RegQueryValueEx_(hKey, HKEntry$, 0, 0, @result$, @bufLen) <> #ERROR_SUCCESS
        result$ = ""
      EndIf
      RegCloseKey_(hKey)
    EndIf
  Else
    result$ = ""
  EndIf
ProcedureReturn result$
EndProcedure
namer$ = "Bahnschrift" + " (TrueType)"
Debug RegReadString(#HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows NT\CurrentVersion\fonts",namer$)

When you select a font using FontRequester() it gives you a font family name like "Bahnschrift Light Condensed". I couldn't find anything on the registry with "Light Condensed". I also tried using GDI retrieving font family using tagLOGFONTW structure, and also GetTextFace_ but they both return the name with qualifiers and I am not able to find a match for the actual font. Any one has any workaround for this or any other ideas and how to get the font file name?

Thank you.
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
JHPJHP
Addict
Addict
Posts: 1851
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Actual font location and name

Post by JHPJHP »

Hi normeus,

I sent you a PM; see this post for additional information.

Example has been added to Windows Services & Other Stuff\Other_Stuff\FontStuff\...

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
normeus
Enthusiast
Enthusiast
Posts: 322
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: Actual font location and name

Post by normeus »

Thank you! JHPJHP
I really appreciate you taking the time to answer my question.


Thank you.
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
JHPJHP
Addict
Addict
Posts: 1851
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Actual font location and name

Post by JHPJHP »

Hi normeus,

I've added a new example that is a good companion to the other font scripts; see the following post Find Font File.

If you're interested, but do not have an access key, send me a PM and I'll package up the new example with the improved versions of FontStuffFromFile.pb and EnumerateSystemFonts.pb.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
normeus
Enthusiast
Enthusiast
Posts: 322
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: Actual font location and name

Post by normeus »

JHPJHP,

I do have an access key. I have not logged in because I haven't had time to program in PureBasic ( no time for fun).
I will check out the new example over the weekend.

Thank you.
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Post Reply