Facepunch / garrysmod-requests

Feature requests for Garry's Mod
83 stars 24 forks source link

Add ability to find installed fonts #823

Open dearmochi opened 7 years ago

dearmochi commented 7 years ago

This would allow developers to give players more freedom when it comes to customizing their interface's font. Since I am coding a chat box, I want to part with giving a preset list of fonts (that may not even work depending on the system) - instead I want to show a list of available fonts the user has on their PC.

60percentCaffeine commented 7 years ago

On Windows you can open system drive letter:\Windows\Fonts to find all pre-installed fonts, also search in GarrysMod/garrysmod/resource/fonts.

MinIsMin commented 7 years ago

With Lua you can't access files outside of the garrysmod folder. (OP wants a realtime list) But it's possible to search all *.ttf files in the gmod fonts folder (should be safe for use)

Also I wouldn't scan the system for installed fonts because of the TrueType Font Parsing risks.

60percentCaffeine commented 7 years ago

@MinIsMin Windows fonts don't change much between different Windows versions, so using built-in Windows fonts should be safe. Realtime list is not needed.