Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to use custom fonts + "fallback" fonts. #273

Closed
GoodClover opened this issue May 9, 2021 · 5 comments
Closed

Add the ability to use custom fonts + "fallback" fonts. #273

GoodClover opened this issue May 9, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@GoodClover
Copy link

GoodClover commented May 9, 2021

As far as I can tell, Lagrange currently comes with the supported fonts bundled with the program (res/fonts), and the only options are to pick from these. I'm not sure how Lagrange's font system works, but hardcoding the usable fonts seems a bit weird.
It would be very nice if we could use fonts that are installed on our systems, either by a freeform box or a dropdown (or a mix like notepad).
image

It would also be nice if we could set a list of "fallback" fonts (I'm not sure what these are actually called).
For example in VSCode I can set a list of fonts like this, and if the character isn't in the first font, it grabs it from the next one along. The replacement character is only shown if it's not in any of the fonts.
This is very useful for more rare characters, and private use ones.
image

@skyjake skyjake added the enhancement New feature or request label May 9, 2021
@skyjake
Copy link
Owner

skyjake commented May 9, 2021

Related issue: #195

I'm not sure how Lagrange's font system works, but hardcoding the usable fonts seems a bit weird.

The (current) implementation could be characterized as "aggressively platform agnostic". The text renderer does not rely on any external libraries or system APIs. This allows it to work the same way on any platform for maximum portability.

Font and text APIs are quite different depending on the platform, so adding support for system fonts comes with a relatively high implementation cost. The best choice would probably be FreeType, but each new dependency adds to the maintenance burden.

I think the most likely next step here is to add support for user-provided TrueType fonts that need to be copied under the ~/.config/lagrange directory.

@GoodClover
Copy link
Author

GoodClover commented May 9, 2021

Ah, sorry, I hadn't seen that other issue.

I wasn't meaning that you should use the system font renderer, I mean that it should be possible to select a font installed on the system.

In Windows this is really simple, fonts are all just dumped in C:\Windows\fonts, and you can read them from there.
It appears for MacOS there are multiple folders that fonts are stored in, and sigh for Linux there's a gazillion places depending on the distro.

@skyjake
Copy link
Owner

skyjake commented May 9, 2021

fonts are all just dumped in C:\Windows\fonts

Hmm yes, it should be possible to look in there as well as a Windows-specific behavior, in addition to Lagrange's own runtime directory.

@lifelike
Copy link

lifelike commented May 9, 2021

You could do the same on Linux/OSX and look in a few standard font directories (~/.config/fonts and /usr/local/share/fonts/, maybe?).

I think on all systems this is probably going to have some side-effects as I am sure there is more to the standard installed fonts than applications just looking for the TTF files themselves, but it might be close enough that many users will not notice.

@skyjake
Copy link
Owner

skyjake commented Nov 2, 2021

Ability to use custom fonts

Closing this since version 1.8 now has downloadable fonts and support for custom TrueType fonts.

The aspect of using system fonts will be covered in issue #195.

@skyjake skyjake closed this as completed Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants