-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support using system fonts #1325
Comments
Also: #1017 |
Maybe font-kit could be used? Amethyst does the below: use font_kit::{
error::SelectionError,
family_name::FamilyName,
handle::Handle,
properties::{Properties, Style},
source::SystemSource,
};
/// Returns the default system font.
pub fn default_system_font() -> Result<Handle, SelectionError> {
let source = SystemSource::new();
let default_fonts = &[
FamilyName::Title("arial".to_string()),
FamilyName::SansSerif,
FamilyName::Monospace,
FamilyName::Fantasy,
];
source.select_best_match(default_fonts, Properties::new().style(Style::Normal))
} |
I didn't know about Seems like it would be great to have integrated into bevy (or future Distill?) as the loader/source for font assets. It looks like it could also provide font rendering (as an abstraction over freetype/directwrite/coretext/etc). Would we want to use it for that too? |
@cart is using |
Bevy used to render text using skribo, which in turn depends on font-kit. I explicitly moved off of it because it rendered the same fonts differently on different platforms (because internally it uses the native platform api to rasterize). For me cross platform consistency was more important than consistency of fonts rendered within the same os. Consistency across platforms is a hard requirement for me. Additionally, moving to ab_glyph saved us 24 dependencies. Part of that could have been skribo, but im pretty sure most came from font-kit. Font-kit is "big". All we really need is a way to discover and load fonts on a given platform, and that is a small subset of the features it provides. Before merging a pr with font-kit, I would want a cost benefit breakdown of features gained vs compile time + dependency count. I don't want to reinvent the wheel. But I also don't want to strap on a monster truck wheel to a golf cart. |
It appears the font discovery/loading capability is all within the |
I filed an issue with |
cosmic_text includes font loading features. It looks like a fantastic, well-supported solution, and I think the right path forward for this issue is to migrate to |
When you say migrate, do you mean replace ab-glyph, or simply to add on cosmic_text's system fonts functionality? |
I would like to replace ab-glyph completely. |
Currently, to display text in bevy UI, a font file needs to be loaded as an asset.
Considering that bevy UI should be usable for general GUI applications (such as the future bevy editor) as well as games, it should support using fonts from the operating system. There should be a way to get the standard fonts that other GUI apps on the user's system use, or other installed fonts.
The text was updated successfully, but these errors were encountered: