I want to use a fixed-width font in an in-game panel. However, style="font-family: ..." seems to have no effect. This is on a <textarea> element. Does the game deliberately limit the set of available fonts?
Please take a moment to read the platform’s guidelines before you get started!
I want to use a fixed-width font in an in-game panel. However, style="font-family: ..." seems to have no effect. This is on a <textarea> element. Does the game deliberately limit the set of available fonts?
The fonts available are not related to the system fonts at all. You will need to load the TTF font of your choice using the @font-face CSS directive, provided that font file exists in the VFS (i.e. in an existing sim package or in your own package):
@font-face { font-family: "RobotoMono-Light"; src: url("/Fonts/RobotoMono-Light.ttf") format("truetype"); font-weight: normal; font-style: normal; }
The path should be relative to the html_ui folder, I believe.
-Matt | Working Title
To add on to @mattnischan's answer, the fonts that come with FS are stored in html_ui/Fonts. Currently the available font families are: Arial, Barlow, Calibri, Consolas, Malgun, Mangal, Montserrat, Nirmalas, Roboto, Simsun and Vrinda. A custom font for the A1000 and icons are provided as well. When you want to use your own font, pack it in the html_ui/Fonts directory of your add-on and specify it in your css file using @font-face, as mentioned in the selected answer above.
3 People are following this question.