Determine if a font is installed and available

  1. 3 days ago

    Tim J

    Dec 7 Pre-Release Testers, Xojo Pro Dehydrating in AZ

    Hi Folks,

    Do any of you have experience with determining the availability of a font on the user system to recommend a solution to the below?

    One of my apps needs a reasonable (read NOT Courier) mono spaced font on Linux. I've determined that there are 4 really good options:

    • Liberation Mono
    • Nimbus Mono L
    • Noto Mono
    • Ubuntu Mono

    However, in a beta test we've learned that not every Linux Distro is guaranteed to have any of them specifically (so I would fall back to Courier if that was the only one available). I'd like to have a way to step through the fonts in that order and select the first that is available.

    from LR :

    Function FontAvailable(FontName As String) As Boolean
      Dim fc As Integer
      fc = FontCount - 1
      
      For i As Integer = 0 To fc
        If Font(i) = FontName Then
          Return True
        End If
      Next
      Return False
    End Function
  2. Jean-Yves P

    Dec 7 Pre-Release Testers, Xojo Pro Answer Europe (France, Besançon)

    from LR :

    Function FontAvailable(FontName As String) As Boolean
      Dim fc As Integer
      fc = FontCount - 1
      
      For i As Integer = 0 To fc
        If Font(i) = FontName Then
          Return True
        End If
      Next
      Return False
    End Function
  3. Tim J

    Dec 7 Pre-Release Testers, Xojo Pro Dehydrating in AZ

    Obviousness strikes again :).

    Thanks @Jean-YvesPochez

or Sign Up to reply!