Checking available fonts?

MitchDabo

New Member
Is it possible to check what fonts are available on the device? I haven't found any examples and can't find a registry value that has the info. Thanks.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Hello Mitch

Please try the code below. It works for my PPC but not necessarily for all devices.

Cheers
Robert

B4X:
Sub Globals  
  Dim Values(0)
End Sub

Sub mnuSysFonts_Click
  Reg.RootKey(Reg.rtLocalMachine)
  Values() = reg.GetValueNames("SOFTWARE\Microsoft\FontLink\SystemLink")
  lbS.Clear  'lbS is a listbox
  lbS.Add("SYSTEM FONTS:")
  For i = 0 To ArrayLen(Values())-1
    lbS.Add(Values(i))
  Next
  lbS.Add("")
  lbS.Add("ADDED FONTS:") 'look for fonts in \Windows\Fonts
  FileSearch (alFiles, hard.GetSpecialFolder(hard.sfFonts), "*.ttf")
  alFiles.Sort(cCaseUnsensitive) 'alFiles is an array list for sorting purposes
  For i = 0 To alFiles.Count - 1
    lbS.Add(FileName(alFiles.item(i)))
  Next
End Sub
 

MitchDabo

New Member
It did work. The system font seems to be at HKEY_LOCAL_MACHINE\System\GDI\SYSFNT on my Mogul. Although I could get the added font file names with your program, I couldn't get the actual font names - needed to select them with a program. Maybe this is because I couldn't get "hard.GetSpecialFolder(hard.sfFonts)" to work. Thanks for your help.
 
Top