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

Create Font by Family name #797

Open
maluoi opened this issue Dec 1, 2023 · 0 comments
Open

Create Font by Family name #797

maluoi opened this issue Dec 1, 2023 · 0 comments

Comments

@maluoi
Copy link
Collaborator

maluoi commented Dec 1, 2023

Describe the feature

Currently, StereoKit uses an explicit list of font files it can search through for glyphs. This is functional, but not ideal as it's much more specific than developers are accustomed to.

A better solution would be to list a high level font family name, or list of names like CSS does. This would likely need a number of different implementations due to differences in how this is done on various OSs.

StereoKit can then turn this font family into a list of concrete ttf files to search through for each character sets glyphs.

For example:

Font f = Font.FromFamily("Segoe UI, Ubuntu, sans-serif");
Font f = Font.FromFamily("Helvetica");
Font f = Font.FromFamily("asset_folder_font.ttf, Segoe UI, Ubuntu, sans-serif");

Each of these would result in a list of font files. Segoe UI would work on Windows, but not Linux, which would likely catch Ubuntu. Other systems would fall back to a generic sans-serif font that works well on the system. Other families including concrete font files would still need to fall back for glyphs not in the concrete font, so would add the concrete font at the top of the list, but then search the rest of the fonts for an appropriate fallback chain.

This needs to work on Windows, Android, and Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant