Is this Font installed (in the user’s computer) ?

The LR says:

This is an example of a function that determines if the font named passed is installed on the user’s computer:

[code]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[/code]

Is this still the valid way to know if a Font is installed in the Boot OS ?

On Mac that will only work for the font family. If you need to verify for a font with a style, for instance “Charlot Bold” or “Laurel Italic”, your method cannot work because since Cocoa, only font families are reported by Xojo. Not styled.

There are declares and plugins to get the styles, but it is not built in.

On Windows, Xojo reports all installed fonts.

Thank you for the tip (I already knew, but it is good to have reminder in case…)

I had to help a friend on Quark XPress years ago, he had the Bold checkbox… checked (and of course used the My_Font.Bold “style“…): he do not knew. But he recalls it.

Feedback ID ?

Feedback ID is (only from last year !):

48424 - Font family and Font variants

I’ve issued some different quest on Gioogle and all I was able to get was… how to install a font (Macintosh / WIndows, Linux is unknow) !!! Or software that install them :frowning:

I found a Microsoft page that stays at the Font family names…

Incredible.

I have to think at a strategy to avoid any troubles. The client have a “graphical charter” (Google Translate) that states uses of Bold, Bold Italic, and so on …

Last one!

Read this entry:
http://documentation.xojo.com/index.php/TextEdit.Bold

If you use MBS Plugins, you could use the font classes there.

See NSFontManagerMBS for Mac and WindowsFontFamilyMBS for Windows.

After using REALbasic / Real Studio / Xojo for 20 years, I feel Xojo is more and more like a skeleton: you need to buy add-ons to make your work !

I was fooling around and saw that I can use Font Family Name and styles name to print text (in a Canvas), but when I pass this text (the full font name), I get False from the FontAvailable Function.

Used font name: “Comic Sans MS Bold”

Nota: I used “Comic Sans MS-Bold” but it was wrong on the Canvas, so I removed the dash and it works.

I do not say how to use a style in a Font Family Name: make your own tests, please.