You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preloading characters in a GlyphCache creates the new characters, storing them in the cache. However, the characters get their size converted from points to pixels in character():
let size = ((size as f32) * 1.333).round() as u32; // convert points to pixels
This makes it impossible for external users to retrieve preloaded characters without reproducing the points -> pixels conversion themselves.
I personally think that it'd be nice for users to not have to bother with this, so instead we could just do the size conversion when requesting the opt_character(). That way users could just pass in the same font size.
pub fn opt_character(&self, size: FontSize, ch: char) -> Option<Character<T>> {
let size = ((size as f32) * 1.333).round() as u32; // convert points to pixels
// ... rest
}
What do you think?
Happy to put up a PR if this is something that is useful!
The text was updated successfully, but these errors were encountered:
Preloading characters in a GlyphCache creates the new characters, storing them in the cache. However, the characters get their size converted from points to pixels in character():
This makes it impossible for external users to retrieve preloaded characters without reproducing the points -> pixels conversion themselves.
I personally think that it'd be nice for users to not have to bother with this, so instead we could just do the size conversion when requesting the opt_character(). That way users could just pass in the same font size.
What do you think?
Happy to put up a PR if this is something that is useful!
The text was updated successfully, but these errors were encountered: